Differences From Artifact [3425587555]:
- File
src/OFString_UTF8.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 30509) [annotate] [blame] [check-ins using]
To Artifact [9568261c3b]:
- File src/OFString_UTF8.m — part of check-in [a06354b42a] at 2017-10-22 15:05:39 on branch trunk — Make Apple GCC with -Wshadow happy (user: js, size: 30476) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
147 148 149 150 151 152 153 | return isUTF8; } size_t of_string_utf8_get_index(const char *string, size_t position) { | | | | | | | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | return isUTF8; } size_t of_string_utf8_get_index(const char *string, size_t position) { size_t idx = position; for (size_t i = 0; i < position; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) idx--; return idx; } size_t of_string_utf8_get_position(const char *string, size_t idx, size_t length) { for (size_t i = 0; i <= idx; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) if (++idx > length) return OF_NOT_FOUND; return idx; } @implementation OFString_UTF8 - (instancetype)init { self = [super init]; |
︙ | ︙ | |||
942 943 944 945 946 947 948 | _s->hash = hash; _s->hashed = true; return hash; } | | | | | < | | | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | _s->hash = hash; _s->hashed = true; return hash; } - (of_unichar_t)characterAtIndex: (size_t)idx { of_unichar_t character; if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) return _s->cString[idx]; idx = of_string_utf8_get_position(_s->cString, idx, _s->cStringLength); if (of_string_utf8_decode(_s->cString + idx, _s->cStringLength - idx, &character) <= 0) @throw [OFInvalidEncodingException exception]; return character; } - (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range |
︙ | ︙ |