Overview
Comment: | Always cast to unsigned char for to{upper,lower}()
This is required as passing something signed to it is an error on |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
09a0d12baec2694035a7203afd5ecd34 |
User & Date: | js on 2016-06-05 21:17:57 |
Other Links: | manifest | tags |
Context
2016-06-06
| ||
20:56 | Make OF_INVALID_INIT_METHOD compatible with ARC check-in: 29d691e834 user: js tags: trunk | |
2016-06-05
| ||
21:17 | Always cast to unsigned char for to{upper,lower}() check-in: 09a0d12bae user: js tags: trunk | |
20:37 | Implement Key Value Coding for OFSet check-in: ef8d57bd4e user: js tags: trunk | |
Changes
Modified src/OFHTTPClient.m from [a71d96fcc8] to [cf407bada1].
︙ | ︙ | |||
41 42 43 44 45 46 47 | #import "OFUnsupportedProtocolException.h" #import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" static OF_INLINE void normalizeKey(char *str_) { | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #import "OFUnsupportedProtocolException.h" #import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" static OF_INLINE void normalizeKey(char *str_) { unsigned char *str = (unsigned char*)str_; bool firstLetter = true; while (*str != '\0') { if (!isalnum(*str)) { firstLetter = true; str++; continue; |
︙ | ︙ |
Modified src/OFHTTPServer.m from [eb56a06a9a] to [b9d140020a].
︙ | ︙ | |||
142 143 144 145 146 147 148 | } } static OF_INLINE OFString* normalizedKey(OFString *key) { char *cString = of_strdup([key UTF8String]); | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | } } static OF_INLINE OFString* normalizedKey(OFString *key) { char *cString = of_strdup([key UTF8String]); unsigned char *tmp = (unsigned char*)cString; bool firstLetter = true; if (cString == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: strlen([key UTF8String])]; while (*tmp != '\0') { |
︙ | ︙ |
Modified src/OFIntrospection.m from [ce69904b51] to [5bbbc65fa4].
︙ | ︙ | |||
273 274 275 276 277 278 279 | if ((_attributes & OF_PROPERTY_READWRITE) && _setter == nil) { of_unichar_t first = [_name characterAtIndex: 0]; OFMutableString *tmp = [_name mutableCopy]; _setter = tmp; if (first < 0x80) { | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | if ((_attributes & OF_PROPERTY_READWRITE) && _setter == nil) { of_unichar_t first = [_name characterAtIndex: 0]; OFMutableString *tmp = [_name mutableCopy]; _setter = tmp; if (first < 0x80) { [tmp setCharacter: toupper((unsigned char)first) atIndex: 0]; } [tmp prependString: @"set"]; [tmp makeImmutable]; } |
︙ | ︙ |
Modified src/OFObject+KeyValueCoding.m from [6d4c66aa16] to [3eca7b4ec4].
︙ | ︙ | |||
60 61 62 63 64 65 66 | exceptionWithRequestedSize: keyLength + 3]; @try { memcpy(name, "is", 2); memcpy(name + 2, [key UTF8String], keyLength); name[keyLength + 2] = '\0'; | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | exceptionWithRequestedSize: keyLength + 3]; @try { memcpy(name, "is", 2); memcpy(name + 2, [key UTF8String], keyLength); name[keyLength + 2] = '\0'; name[2] = toupper((unsigned char)name[2]); selector = sel_registerName(name); } @finally { free(name); } typeEncoding = [self typeEncodingForSelector: selector]; |
︙ | ︙ | |||
142 143 144 145 146 147 148 | exceptionWithRequestedSize: keyLength + 5]; @try { memcpy(name, "set", 3); memcpy(name + 3, [key UTF8String], keyLength); memcpy(name + keyLength + 3, ":", 2); | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | exceptionWithRequestedSize: keyLength + 5]; @try { memcpy(name, "set", 3); memcpy(name + 3, [key UTF8String], keyLength); memcpy(name + keyLength + 3, ":", 2); name[3] = toupper((unsigned char)name[3]); selector = sel_registerName(name); } @finally { free(name); } typeEncoding = [self typeEncodingForSelector: selector]; |
︙ | ︙ |
Modified src/OFString_UTF8.m from [c460dbfe91] to [f214cc2fb6].
︙ | ︙ | |||
42 43 44 45 46 47 48 | extern const of_char16_t of_windows_1252[128]; extern const of_char16_t of_codepage_437[128]; static inline int memcasecmp(const char *first, const char *second, size_t length) { for (size_t i = 0; i < length; i++) { | | > | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | extern const of_char16_t of_windows_1252[128]; extern const of_char16_t of_codepage_437[128]; static inline int memcasecmp(const char *first, const char *second, size_t length) { for (size_t i = 0; i < length; i++) { if (tolower((unsigned char)first[i]) > tolower((unsigned char)second[i])) return OF_ORDERED_DESCENDING; if (tolower((unsigned char)first[i]) < tolower((unsigned char)second[i])) return OF_ORDERED_ASCENDING; } return OF_ORDERED_SAME; } int |
︙ | ︙ |
Modified src/OFURL.m from [bdf49c5547] to [ad4fe54b6f].
︙ | ︙ | |||
81 82 83 84 85 86 87 | UTF8String = UTF8String2; if ((tmp = strstr(UTF8String, "://")) == NULL) @throw [OFInvalidFormatException exception]; for (tmp2 = UTF8String; tmp2 < tmp; tmp2++) | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | UTF8String = UTF8String2; if ((tmp = strstr(UTF8String, "://")) == NULL) @throw [OFInvalidFormatException exception]; for (tmp2 = UTF8String; tmp2 < tmp; tmp2++) *tmp2 = tolower((unsigned char)*tmp2); _scheme = [[[OFString stringWithUTF8String: UTF8String length: tmp - UTF8String] stringByURLDecoding] copy]; UTF8String = tmp + 3; |
︙ | ︙ |