Skip to content

Commit a8ac076

Browse files
committed
Bugfixes parsing OBJ file under MSys build
1 parent 30f94ef commit a8ac076

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

include/lsp-plug.in/fmt/obj/PullParser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ namespace lsp
4949
lsp_wchar_t *pBuffer; // Buffer for character data
5050
size_t nBufOff; // Buffer offset
5151
size_t nBufLen; // Buffer length
52-
bool bSkipLF; // Skip line-feed character
5352
size_t nLines; // Number of lines read
5453

5554
event_t sEvent;

src/main/fmt/obj/PullParser.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ namespace lsp
4141
nBufOff = 0;
4242
nBufLen = 0;
4343
nLines = 0;
44-
bSkipLF = false;
4544
nVx = 0;
4645
nParVx = 0;
4746
nTexVx = 0;
@@ -210,7 +209,6 @@ namespace lsp
210209
pBuffer = b;
211210
nBufOff = 0;
212211
nBufLen = 0;
213-
bSkipLF = false;
214212
nLines = 0;
215213
nVx = 0;
216214
nParVx = 0;
@@ -234,7 +232,6 @@ namespace lsp
234232
nBufOff = 0;
235233
nBufLen = 0;
236234
nLines = 0;
237-
bSkipLF = false;
238235

239236
// Release input sequence
240237
if (pIn != NULL)
@@ -351,27 +348,13 @@ namespace lsp
351348
nBufOff = 0;
352349
}
353350

354-
// Scan for line ending
355-
if (bSkipLF)
356-
{
357-
bSkipLF = false;
358-
if (pBuffer[nBufOff] == '\r')
359-
{
360-
if ((++nBufOff) >= nBufLen)
361-
continue;
362-
}
363-
}
364-
365351
// Scan for line ending character
366352
size_t tail = nBufOff;
367353
while (tail < nBufLen)
368354
{
369355
lsp_wchar_t ch = pBuffer[tail++];
370356
if (ch == '\n') // Found!
371-
{
372-
bSkipLF = true;
373357
break;
374-
}
375358
}
376359

377360
// Append data to string and update buffer state
@@ -383,6 +366,8 @@ namespace lsp
383366
if (sLine.last() != '\n') // Not end of line?
384367
continue;
385368
sLine.set_length(--len);
369+
if (sLine.last() == '\r') // Remove carriage-return symbol if it is present
370+
sLine.set_length(--len);
386371

387372
// Compute number of terminating '\\' characters
388373
ssize_t slashes = 0, xoff = len-1;

0 commit comments

Comments
 (0)