Changeset 10800 in webkit
- Timestamp:
- Oct 8, 2005 9:45:29 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r10798 r10800 1 2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 Reviewed by Geoff. 4 Tweaked and landed by Darin. 5 6 - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266 7 Support parenthesized comments in Date.parse() 8 9 * kjs/date_object.cpp: 10 (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces, 11 and also past anything enclosed in parentheses. 12 (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had 13 code to skip spaces. 14 1 15 2005-10-08 Justin Haygood <justin@xiondigital.net> 2 16 -
trunk/JavaScriptCore/kjs/date_object.cpp
r10713 r10800 1032 1032 } 1033 1033 1034 inline static void skipSpacesAndComments(const char *&s) 1035 { 1036 int nesting = 0; 1037 char ch; 1038 while ((ch = *s)) { 1039 if (!isspace(ch)) { 1040 if (ch == '(') 1041 nesting++; 1042 else if (ch == ')' && nesting > 0) 1043 nesting--; 1044 else if (nesting == 0) 1045 break; 1046 } 1047 s++; 1048 } 1049 } 1050 1034 1051 // returns 0-11 (Jan-Dec); -1 on failure 1035 1052 static int findMonth(const char *monthStr) … … 1084 1101 1085 1102 // Skip leading space 1086 while(isspace(*dateString)) 1087 dateString++; 1103 skipSpacesAndComments(dateString); 1088 1104 1089 1105 const char *wordStart = dateString; 1090 1106 // Check contents of first words if not number 1091 while(*dateString && !isdigit(*dateString)) 1092 { 1093 if ( isspace(*dateString) && dateString - wordStart >= 3 ) 1094 { 1095 month = findMonth(wordStart); 1096 while(isspace(*dateString)) 1097 dateString++; 1098 wordStart = dateString; 1107 while (*dateString && !isdigit(*dateString)) { 1108 if (isspace(*dateString) || *dateString == '(') { 1109 if (dateString - wordStart >= 3) 1110 month = findMonth(wordStart); 1111 skipSpacesAndComments(dateString); 1112 wordStart = dateString; 1099 1113 } 1100 1114 else … … 1107 1121 } 1108 1122 1109 while(isspace(*dateString)) 1110 dateString++; 1123 skipSpacesAndComments(dateString); 1111 1124 1112 1125 if (!*dateString) … … 1163 1176 dateString++; 1164 1177 1165 while(isspace(*dateString)) 1166 dateString++; 1178 skipSpacesAndComments(dateString); 1167 1179 1168 1180 if (*dateString == ',') … … 1175 1187 return invalidDate; 1176 1188 1177 while (*dateString && (*dateString != '-') && !isspace(*dateString))1189 while (*dateString && (*dateString != '-') && !isspace(*dateString)) 1178 1190 dateString++; 1179 1191 … … 1207 1219 else 1208 1220 return invalidDate; 1209 } else // in the normal case (we parsed the year), advance to the next number 1221 } else { 1222 // in the normal case (we parsed the year), advance to the next number 1210 1223 dateString = ++newPosStr; 1224 skipSpacesAndComments(dateString); 1225 } 1211 1226 1212 1227 hour = strtol(dateString, &newPosStr, 10); … … 1255 1270 } 1256 1271 1257 while(isspace(*dateString)) 1258 dateString++; 1272 skipSpacesAndComments(dateString); 1259 1273 1260 1274 if (strncasecmp(dateString, "AM", 2) == 0) { … … 1264 1278 hour = 0; 1265 1279 dateString += 2; 1266 while (isspace(*dateString)) 1267 dateString++; 1280 skipSpacesAndComments(dateString); 1268 1281 } else if (strncasecmp(dateString, "PM", 2) == 0) { 1269 1282 if (hour > 12) … … 1272 1285 hour += 12; 1273 1286 dateString += 2; 1274 while (isspace(*dateString)) 1275 dateString++; 1287 skipSpacesAndComments(dateString); 1276 1288 } 1277 1289 } … … 1289 1301 } 1290 1302 1291 while (isspace(*dateString)) 1292 ++dateString; 1303 skipSpacesAndComments(dateString); 1293 1304 1294 1305 if (strncasecmp(dateString, "GMT", 3) == 0) { … … 1328 1339 } 1329 1340 1330 while(isspace(*dateString)) 1331 dateString++; 1341 skipSpacesAndComments(dateString); 1332 1342 1333 1343 if ( *dateString && year == -1 ) { … … 1338 1348 } 1339 1349 1340 while (isspace(*dateString)) 1341 dateString++; 1350 skipSpacesAndComments(dateString); 1342 1351 1343 1352 // Trailing garbage -
trunk/LayoutTests/ChangeLog
r10799 r10800 1 2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 - added a test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5266 4 Support parenthesized comments in Date.parse() 5 6 * fast/js/date-parse-comments-test-expected.txt: Added. 7 * fast/js/date-parse-comments-test.html: Added. 8 1 9 2005-10-08 Alexey Proskuryakov <ap@nypop.com> 2 10
Note: See TracChangeset
for help on using the changeset viewer.