Differences From Artifact [2f361d6379]:
- File
src/OFString+JSONValue.m
— part of check-in
[b6ee372b98]
at
2020-08-11 19:45:36
on branch trunk
— OFString: Rework number parsing API
This solves the old signed vs. unsigned problem and allows for more
bases than just 8, 10 and 16, as well as auto-detection of the base (if
base is 0). (user: js, size: 13084) [annotate] [blame] [check-ins using]
To Artifact [706b49d04b]:
- File src/OFString+JSONParsing.m — part of check-in [8611f48f42] at 2020-08-13 21:07:20 on branch trunk — OFString: Rename JSONValue to objectByParsingJSON (user: js, size: 13120) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include <stdlib.h> #include <string.h> #include <math.h> #include <assert.h> | | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include <stdlib.h> #include <string.h> #include <math.h> #include <assert.h> #import "OFString+JSONParsing.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFNull.h" #import "OFInvalidJSONException.h" int _OFString_JSONParsing_reference; static id nextObject(const char **pointer, const char *stop, size_t *line, size_t depthLimit); static void skipWhitespaces(const char **pointer, const char *stop, size_t *line) { |
︙ | ︙ | |||
637 638 639 640 641 642 643 | case 'I': return parseNumber(pointer, stop, line); default: return nil; } } | | | | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | case 'I': return parseNumber(pointer, stop, line); default: return nil; } } @implementation OFString (JSONParsing) - (id)objectByParsingJSON { return [self objectByParsingJSONWithDepthLimit: 32]; } - (id)objectByParsingJSONWithDepthLimit: (size_t)depthLimit { void *pool = objc_autoreleasePoolPush(); const char *pointer = self.UTF8String; const char *stop = pointer + self.UTF8StringLength; id object; size_t line = 1; |
︙ | ︙ |