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: 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 - Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika
- MixSDL now handles resampling correctly (less cracklings); - MixSDL now handles resampling correctly (less cracklings);
added cubic interpolation for high quality mode -Mika 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 pos;
int num = 0; int num = 0;
while (*TimeStamps && (pos = wstrcspn (TimeStamps, ",\n"))) while (*TimeStamps && (pos = wstrcspn (TimeStamps, ",\r\n")))
{ {
UNICODE valStr[10]; UNICODE valStr[10];
uint32 val; uint32 val;
@@ -210,8 +210,7 @@ GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
time_stamps++; time_stamps++;
} }
TimeStamps += pos; TimeStamps += pos;
if (*TimeStamps) TimeStamps += strspn(TimeStamps, ",\r\n");
TimeStamps++;
} }
return (num); return (num);
} }
@@ -241,7 +240,7 @@ SplitSubPages (UNICODE *text, sint32 *timestamp, int *num_pages)
wstrcpy (split_text[page] + ellips + pos, "..."); wstrcpy (split_text[page] + ellips + pos, "...");
timestamp[page] = - pos * TEXT_SPEED; timestamp[page] = - pos * TEXT_SPEED;
ellips = 2; ellips = 2;
text = text + pos + 1; text = text + pos;
pos = 0; pos = 0;
page ++; page ++;
} }
@@ -254,10 +253,12 @@ SplitSubPages (UNICODE *text, sint32 *timestamp, int *num_pages)
*(split_text[page] + ellips + pos) = 0; *(split_text[page] + ellips + pos) = 0;
timestamp[page] = - pos * TEXT_SPEED; timestamp[page] = - pos * TEXT_SPEED;
ellips = 0; ellips = 0;
text = text + pos + 1; text = text + pos;
pos = 0; pos = 0;
page ++; page ++;
} }
while (text[pos] == '\n' || text[pos] == '\r')
text++;
} }
else else
pos++; pos++;
+7 -4
View File
@@ -121,7 +121,9 @@ _GetStringData (uio_Stream *fp, DWORD length)
{ {
if (n >= 0) 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]; --slen[n];
--StringOffs; --StringOffs;
@@ -144,7 +146,7 @@ _GetStringData (uio_Stream *fp, DWORD length)
&& (++tsptr)) && (++tsptr))
{ {
ts_ok = TRUE; ts_ok = TRUE;
while (! strcspn(tsptr," \t\n") && *tsptr) while (! strcspn(tsptr," \t\r\n") && *tsptr)
tsptr++; tsptr++;
if (*tsptr) if (*tsptr)
{ {
@@ -173,7 +175,7 @@ _GetStringData (uio_Stream *fp, DWORD length)
} }
} }
clen[n] = 0; clen[n] = 0;
s = strtok (NULL, " \t\n)"); s = strtok (NULL, " \t\r\n)");
if (s) if (s)
{ {
l = path_len + strlen (s) + 1; l = path_len + strlen (s) + 1;
@@ -220,7 +222,8 @@ _GetStringData (uio_Stream *fp, DWORD length)
} }
if (n >= 0) 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]; --slen[n];
--StringOffs; --StringOffs;