Differences From Artifact [aa73e544ea]:
- File src/OFTarArchiveEntry.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 7989) [annotate] [blame] [check-ins using] [more...]
To Artifact [66844c18ae]:
- File
src/OFTarArchiveEntry.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: 8044) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
49 50 51 52 53 54 55 | memcpy(buffer, [string cStringWithEncoding: encoding], cStringLength); for (size_t i = cStringLength; i < length; i++) buffer[i] = '\0'; } | | | > | | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | memcpy(buffer, [string cStringWithEncoding: encoding], cStringLength); for (size_t i = cStringLength; i < length; i++) buffer[i] = '\0'; } static unsigned long long octalValueFromBuffer(const unsigned char *buffer, size_t length, unsigned long long max) { unsigned long long value = 0; if (length == 0) return 0; if (buffer[0] == 0x80) { for (size_t i = 1; i < length; i++) value = (value << 8) | buffer[i]; } else value = [stringFromBuffer(buffer, length, OF_STRING_ENCODING_ASCII) unsignedLongLongValueWithBase: 8]; if (value > max) @throw [OFOutOfRangeException exception]; return value; } |
︙ | ︙ |