Bugzilla bug 247896 and bug 331216: fixed the bug that 'end' was moved one NSPR_4_6_BRANCH
authorwtchang%redhat.com
Tue, 11 Apr 2006 20:04:31 +0000
branchNSPR_4_6_BRANCH
changeset 3634 8e53d2c6d44fffa02d84542cbe8346c6a98c84ea
parent 3630 3ceb70b2a9dcf91b68255cd633e87cb975189c61
child 3640 a18e8b335a4ab4a8919326c65c7c6e078989a50f
push idunknown
push userunknown
push dateunknown
bugs247896, 331216
Bugzilla bug 247896 and bug 331216: fixed the bug that 'end' was moved one character too far when parsing the minutes, and simplified the code. r=timeless,darin. Tag: NSPR_4_6_BRANCH
pr/src/misc/prtime.c
--- a/pr/src/misc/prtime.c
+++ b/pr/src/misc/prtime.c
@@ -1237,23 +1237,19 @@ PR_ParseTimeString(
                                   /* it is [0-9][0-9][0-9]+: */
                                   break;
                                 else if ((end - rest) == 2)
                                   tmp_hour = ((rest[0]-'0')*10 +
                                                           (rest[1]-'0'));
                                 else
                                   tmp_hour = (rest[0]-'0');
 
-                                while (*rest && *rest != ':')
-                                  rest++;
-                                rest++;
-
                                 /* move over the colon, and parse minutes */
 
-                                end = rest + 1;
+                                rest = ++end;
                                 while (*end >= '0' && *end <= '9')
                                   end++;
 
                                 if (end == rest)
                                   /* no digits after first colon? */
                                   break;
                                 else if ((end - rest) > 2)
                                   /* it is [0-9][0-9][0-9]+: */