Overview
Comment: | Always cast argument to isspace() to unsigned char
Some implementations define this as a macro that indexes into a table, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ce5dfd4a83c495ce1b668e315c7e1719 |
User & Date: | js on 2020-08-13 19:27:37 |
Other Links: | manifest | tags |
Context
2020-08-13
| ||
19:43 | Set errno to 0 before calling strto* check-in: 04bb18457a user: js tags: trunk | |
19:27 | Always cast argument to isspace() to unsigned char check-in: ce5dfd4a83 user: js tags: trunk | |
2020-08-12
| ||
20:56 | Avoid using (u)intmax_t in methods check-in: d74f244ab7 user: js tags: trunk | |
Changes
Modified src/OFString.m from [a680f97b80] to [fbf885bed7].
︙ | ︙ | |||
2331 2332 2333 2334 2335 2336 2337 | if ((value == LLONG_MIN || value == LLONG_MAX) && errno == ERANGE) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtoll uses the same. */ | | | | | 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 | if ((value == LLONG_MIN || value == LLONG_MAX) && errno == ERANGE) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtoll uses the same. */ if (!isspace((unsigned char)*endPointer)) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return value; } - (unsigned long long)unsignedLongLongValue { return [self unsignedLongLongValueWithBase: 10]; } - (unsigned long long)unsignedLongLongValueWithBase: (int)base { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = self.UTF8String; char *endPointer = NULL; unsigned long long value; /* Use isspace since strtoull uses the same. */ while (isspace((unsigned char)*UTF8String)) UTF8String++; if (*UTF8String == '-') @throw [OFInvalidFormatException exception]; value = strtoull(UTF8String, &endPointer, base); if (value == ULLONG_MAX && errno == ERANGE) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtoull uses the same. */ if (!isspace((unsigned char)*endPointer)) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return value; } |
︙ | ︙ | |||
2415 2416 2417 2418 2419 2420 2421 | if (value == HUGE_VALF) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtof uses the same. */ | | | 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 | if (value == HUGE_VALF) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtof uses the same. */ if (!isspace((unsigned char)*endPointer)) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return value; } |
︙ | ︙ | |||
2463 2464 2465 2466 2467 2468 2469 | if (value == HUGE_VAL) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtod uses the same. */ | | | 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 | if (value == HUGE_VAL) @throw [OFOutOfRangeException exception]; /* Check if there are any invalid chars left */ if (endPointer != NULL) for (; *endPointer != '\0'; endPointer++) /* Use isspace since strtod uses the same. */ if (!isspace((unsigned char)*endPointer)) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return value; } |
︙ | ︙ |