Accept CRLF line endings in .txt and .ts files.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1058 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2003-07-17 22:16:33 +00:00
parent 3a0c430a6a
commit 2a62981df3
3 changed files with 14 additions and 9 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3:
- Accept CRLF line endings in .txt and .ts files - SvdB
- Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika
- MixSDL now handles resampling correctly (less cracklings);
added cubic interpolation for high quality mode -Mika
+6 -5
View File
@@ -196,7 +196,7 @@ GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
{
int pos;
int num = 0;
while (*TimeStamps && (pos = wstrcspn (TimeStamps, ",\n")))
while (*TimeStamps && (pos = wstrcspn (TimeStamps, ",\r\n")))
{
UNICODE valStr[10];
uint32 val;
@@ -210,8 +210,7 @@ GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
time_stamps++;
}
TimeStamps += pos;
if (*TimeStamps)
TimeStamps++;
TimeStamps += strspn(TimeStamps, ",\r\n");
}
return (num);
}
@@ -241,7 +240,7 @@ SplitSubPages (UNICODE *text, sint32 *timestamp, int *num_pages)
wstrcpy (split_text[page] + ellips + pos, "...");
timestamp[page] = - pos * TEXT_SPEED;
ellips = 2;
text = text + pos + 1;
text = text + pos;
pos = 0;
page ++;
}
@@ -254,10 +253,12 @@ SplitSubPages (UNICODE *text, sint32 *timestamp, int *num_pages)
*(split_text[page] + ellips + pos) = 0;
timestamp[page] = - pos * TEXT_SPEED;
ellips = 0;
text = text + pos + 1;
text = text + pos;
pos = 0;
page ++;
}
while (text[pos] == '\n' || text[pos] == '\r')
text++;
}
else
pos++;
+7 -4
View File
@@ -121,7 +121,9 @@ _GetStringData (uio_Stream *fp, DWORD length)
{
if (n >= 0)
{
while (slen[n] > 1 && strdata[StringOffs - 2] == '\n')
while (slen[n] > 1 &&
(strdata[StringOffs - 2] == '\n' ||
strdata[StringOffs - 2] == '\r'))
{
--slen[n];
--StringOffs;
@@ -144,7 +146,7 @@ _GetStringData (uio_Stream *fp, DWORD length)
&& (++tsptr))
{
ts_ok = TRUE;
while (! strcspn(tsptr," \t\n") && *tsptr)
while (! strcspn(tsptr," \t\r\n") && *tsptr)
tsptr++;
if (*tsptr)
{
@@ -173,7 +175,7 @@ _GetStringData (uio_Stream *fp, DWORD length)
}
}
clen[n] = 0;
s = strtok (NULL, " \t\n)");
s = strtok (NULL, " \t\r\n)");
if (s)
{
l = path_len + strlen (s) + 1;
@@ -220,7 +222,8 @@ _GetStringData (uio_Stream *fp, DWORD length)
}
if (n >= 0)
{
while (slen[n] > 1 && strdata[StringOffs - 2] == '\n')
while (slen[n] > 1 && (strdata[StringOffs - 2] == '\n'
|| strdata[StringOffs - 2] == '\r'))
{
--slen[n];
--StringOffs;