| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 // Step 8 | 209 // Step 8 |
| 210 Vector<UChar, 16> digits; | 210 Vector<UChar, 16> digits; |
| 211 while (position < end) { | 211 while (position < end) { |
| 212 if (!isASCIIDigit(*position)) | 212 if (!isASCIIDigit(*position)) |
| 213 break; | 213 break; |
| 214 digits.append(*position++); | 214 digits.append(*position++); |
| 215 } | 215 } |
| 216 | 216 |
| 217 // Step 9 | 217 // Step 9 |
| 218 value = sign * charactersToIntStrict(digits.data(), digits.size()); | 218 bool ok; |
| 219 return true; | 219 value = sign * charactersToIntStrict(digits.data(), digits.size(), &ok); |
| 220 return ok; |
| 220 } | 221 } |
| 221 | 222 |
| 222 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-nega
tive-integers | 223 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-nega
tive-integers |
| 223 bool parseHTMLNonNegativeInteger(const String& input, unsigned int& value) | 224 bool parseHTMLNonNegativeInteger(const String& input, unsigned int& value) |
| 224 { | 225 { |
| 225 // Step 1 | 226 // Step 1 |
| 226 // Step 2 | 227 // Step 2 |
| 227 const UChar* position = input.characters(); | 228 const UChar* position = input.characters(); |
| 228 const UChar* end = position + input.length(); | 229 const UChar* end = position + input.length(); |
| 229 | 230 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 254 | 255 |
| 255 // Step 8 | 256 // Step 8 |
| 256 Vector<UChar, 16> digits; | 257 Vector<UChar, 16> digits; |
| 257 while (position < end) { | 258 while (position < end) { |
| 258 if (!isASCIIDigit(*position)) | 259 if (!isASCIIDigit(*position)) |
| 259 break; | 260 break; |
| 260 digits.append(*position++); | 261 digits.append(*position++); |
| 261 } | 262 } |
| 262 | 263 |
| 263 // Step 9 | 264 // Step 9 |
| 264 value = charactersToUIntStrict(digits.data(), digits.size()); | 265 bool ok; |
| 265 return true; | 266 value = charactersToUIntStrict(digits.data(), digits.size(), &ok); |
| 267 return ok; |
| 266 } | 268 } |
| 267 | 269 |
| 268 } | 270 } |
| OLD | NEW |