︙ | | | ︙ | |
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
{
of_unichar_t c;
of_unichar_t *unicodeString;
size_t unicodeLen, newCStringLength, cLen;
size_t i, j, d;
char *newCString;
if (!s->isUTF8) {
assert(tableSize >= 1);
uint8_t *p = (uint8_t*)s->cString + s->cStringLength;
uint8_t t;
while (--p >= (uint8_t*)s->cString)
if ((t = table[0][*p]) != 0)
|
|
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
{
of_unichar_t c;
of_unichar_t *unicodeString;
size_t unicodeLen, newCStringLength, cLen;
size_t i, j, d;
char *newCString;
if (!s->UTF8) {
assert(tableSize >= 1);
uint8_t *p = (uint8_t*)s->cString + s->cStringLength;
uint8_t t;
while (--p >= (uint8_t*)s->cString)
if ((t = table[0][*p]) != 0)
|
︙ | | | ︙ | |
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
UTF8String += 3;
UTF8StringLength -= 3;
}
switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) {
case 1:
s->isUTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException newWithClass: isa];
}
s->cString = [self resizeMemory: s->cString
toSize: s->cStringLength +
|
|
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
UTF8String += 3;
UTF8StringLength -= 3;
}
switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) {
case 1:
s->UTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException newWithClass: isa];
}
s->cString = [self resizeMemory: s->cString
toSize: s->cStringLength +
|
︙ | | | ︙ | |
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
UTF8String += 3;
UTF8StringLength -= 3;
}
switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) {
case 1:
s->isUTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException newWithClass: isa];
}
s->cString = [self resizeMemory: s->cString
toSize: s->cStringLength +
|
|
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) {
UTF8String += 3;
UTF8StringLength -= 3;
}
switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) {
case 1:
s->UTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException newWithClass: isa];
}
s->cString = [self resizeMemory: s->cString
toSize: s->cStringLength +
|
︙ | | | ︙ | |
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
UTF8StringLength);
s->cStringLength += UTF8StringLength;
s->length += string->s->length;
s->cString[s->cStringLength] = 0;
if (string->s->isUTF8)
s->isUTF8 = YES;
}
- (void)appendFormat: (OFConstantString*)format, ...
{
va_list arguments;
va_start(arguments, format);
|
|
|
|
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
UTF8StringLength);
s->cStringLength += UTF8StringLength;
s->length += string->s->length;
s->cString[s->cStringLength] = 0;
if (string->s->UTF8)
s->UTF8 = YES;
}
- (void)appendFormat: (OFConstantString*)format, ...
{
va_list arguments;
va_start(arguments, format);
|
︙ | | | ︙ | |
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
for (i = 0, j = s->cStringLength - 1; i < s->cStringLength / 2;
i++, j--) {
s->cString[i] ^= s->cString[j];
s->cString[j] ^= s->cString[i];
s->cString[i] ^= s->cString[j];
}
if (!s->isUTF8) {
madvise(s->cString, s->cStringLength, MADV_NORMAL);
return;
}
for (i = 0; i < s->cStringLength; i++) {
/* ASCII */
if (OF_LIKELY(!(s->cString[i] & 0x80)))
|
|
|
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
for (i = 0, j = s->cStringLength - 1; i < s->cStringLength / 2;
i++, j--) {
s->cString[i] ^= s->cString[j];
s->cString[j] ^= s->cString[i];
s->cString[i] ^= s->cString[j];
}
if (!s->UTF8) {
madvise(s->cString, s->cStringLength, MADV_NORMAL);
return;
}
for (i = 0; i < s->cStringLength; i++) {
/* ASCII */
if (OF_LIKELY(!(s->cString[i] & 0x80)))
|
︙ | | | ︙ | |
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
atIndex: (size_t)index
{
size_t newCStringLength;
if (index > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (s->isUTF8)
index = of_string_index_to_position(s->cString, index,
s->cStringLength);
newCStringLength = s->cStringLength + [string UTF8StringLength];
s->cString = [self resizeMemory: s->cString
toSize: newCStringLength + 1];
|
|
|
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
atIndex: (size_t)index
{
size_t newCStringLength;
if (index > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (s->UTF8)
index = of_string_index_to_position(s->cString, index,
s->cStringLength);
newCStringLength = s->cStringLength + [string UTF8StringLength];
s->cString = [self resizeMemory: s->cString
toSize: newCStringLength + 1];
|
︙ | | | ︙ | |
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
selector: _cmd];
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
s->length -= end - start;
if (s->isUTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
memmove(s->cString + start, s->cString + end, s->cStringLength - end);
|
|
|
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
selector: _cmd];
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
s->length -= end - start;
if (s->UTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
memmove(s->cString + start, s->cString + end, s->cStringLength - end);
|
︙ | | | ︙ | |
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
selector: _cmd];
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
newLength = s->length - (end - start) + [replacement length];
if (s->isUTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
newCStringLength = s->cStringLength - (end - start) +
|
|
|
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
selector: _cmd];
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
newLength = s->length - (end - start) + [replacement length];
if (s->UTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
newCStringLength = s->cStringLength - (end - start) +
|
︙ | | | ︙ | |
︙ | | | ︙ | |
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
return OF_ORDERED_SAME;
}
int
of_string_check_utf8(const char *cString, size_t cStringLength, size_t *length)
{
size_t i, tmpLength = cStringLength;
int isUTF8 = 0;
madvise((void*)cString, cStringLength, MADV_SEQUENTIAL);
for (i = 0; i < cStringLength; i++) {
/* No sign of UTF-8 here */
if (OF_LIKELY(!(cString[i] & 0x80)))
continue;
isUTF8 = 1;
/* We're missing a start byte here */
if (OF_UNLIKELY(!(cString[i] & 0x40))) {
madvise((void*)cString, cStringLength, MADV_NORMAL);
return -1;
}
|
|
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
return OF_ORDERED_SAME;
}
int
of_string_check_utf8(const char *cString, size_t cStringLength, size_t *length)
{
size_t i, tmpLength = cStringLength;
int UTF8 = 0;
madvise((void*)cString, cStringLength, MADV_SEQUENTIAL);
for (i = 0; i < cStringLength; i++) {
/* No sign of UTF-8 here */
if (OF_LIKELY(!(cString[i] & 0x80)))
continue;
UTF8 = 1;
/* We're missing a start byte here */
if (OF_UNLIKELY(!(cString[i] & 0x40))) {
madvise((void*)cString, cStringLength, MADV_NORMAL);
return -1;
}
|
︙ | | | ︙ | |
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
}
madvise((void*)cString, cStringLength, MADV_NORMAL);
if (length != NULL)
*length = tmpLength;
return isUTF8;
}
size_t
of_string_unicode_to_utf8(of_unichar_t character, char *buffer)
{
size_t i = 0;
|
|
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
}
madvise((void*)cString, cStringLength, MADV_NORMAL);
if (length != NULL)
*length = tmpLength;
return UTF8;
}
size_t
of_string_unicode_to_utf8(of_unichar_t character, char *buffer)
{
size_t i = 0;
|
︙ | | | ︙ | |
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
switch (of_string_check_utf8(cString, cStringLength,
&s->length)) {
case 1:
if (encoding == OF_STRING_ENCODING_ASCII)
@throw [OFInvalidEncodingException
newWithClass: isa];
s->isUTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException
newWithClass: isa];
}
memcpy(s->cString, cString, cStringLength);
|
|
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
switch (of_string_check_utf8(cString, cStringLength,
&s->length)) {
case 1:
if (encoding == OF_STRING_ENCODING_ASCII)
@throw [OFInvalidEncodingException
newWithClass: isa];
s->UTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException
newWithClass: isa];
}
memcpy(s->cString, cString, cStringLength);
|
︙ | | | ︙ | |
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
size_t bytes;
if (!(cString[i] & 0x80)) {
s->cString[j++] = cString[i];
continue;
}
s->isUTF8 = YES;
bytes = of_string_unicode_to_utf8(
(uint8_t)cString[i], buffer);
if (bytes == 0)
@throw [OFInvalidEncodingException
newWithClass: isa];
|
|
|
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
size_t bytes;
if (!(cString[i] & 0x80)) {
s->cString[j++] = cString[i];
continue;
}
s->UTF8 = YES;
bytes = of_string_unicode_to_utf8(
(uint8_t)cString[i], buffer);
if (bytes == 0)
@throw [OFInvalidEncodingException
newWithClass: isa];
|
︙ | | | ︙ | |
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
|
character = table[(uint8_t)cString[i]];
if (character == 0xFFFD)
@throw [OFInvalidEncodingException
newWithClass: isa];
s->isUTF8 = YES;
characterBytes = of_string_unicode_to_utf8(character,
buffer);
if (characterBytes == 0)
@throw [OFInvalidEncodingException
newWithClass: isa];
|
|
|
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
|
character = table[(uint8_t)cString[i]];
if (character == 0xFFFD)
@throw [OFInvalidEncodingException
newWithClass: isa];
s->UTF8 = YES;
characterBytes = of_string_unicode_to_utf8(character,
buffer);
if (characterBytes == 0)
@throw [OFInvalidEncodingException
newWithClass: isa];
|
︙ | | | ︙ | |
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
|
memset(s, 0, sizeof(*s));
/*
* We need one call to make sure it's initialized (in case it's
* a constant string).
*/
s->cStringLength = [string UTF8StringLength];
s->isUTF8 = string->s->isUTF8;
s->length = string->s->length;
s->cString = [self allocMemoryWithSize: s->cStringLength + 1];
memcpy(s->cString, string->s->cString, s->cStringLength + 1);
} @catch (id e) {
[self release];
@throw e;
|
|
|
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
|
memset(s, 0, sizeof(*s));
/*
* We need one call to make sure it's initialized (in case it's
* a constant string).
*/
s->cStringLength = [string UTF8StringLength];
s->UTF8 = string->s->UTF8;
s->length = string->s->length;
s->cString = [self allocMemoryWithSize: s->cStringLength + 1];
memcpy(s->cString, string->s->cString, s->cStringLength + 1);
} @catch (id e) {
[self release];
@throw e;
|
︙ | | | ︙ | |
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
buffer);
switch (characterLen) {
case 1:
s->cString[j++] = buffer[0];
break;
case 2:
s->isUTF8 = YES;
s->cStringLength++;
memcpy(s->cString + j, buffer, 2);
j += 2;
break;
case 3:
s->isUTF8 = YES;
s->cStringLength += 2;
memcpy(s->cString + j, buffer, 3);
j += 3;
break;
case 4:
s->isUTF8 = YES;
s->cStringLength += 3;
memcpy(s->cString + j, buffer, 4);
j += 4;
break;
default:
|
|
|
|
|
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
buffer);
switch (characterLen) {
case 1:
s->cString[j++] = buffer[0];
break;
case 2:
s->UTF8 = YES;
s->cStringLength++;
memcpy(s->cString + j, buffer, 2);
j += 2;
break;
case 3:
s->UTF8 = YES;
s->cStringLength += 2;
memcpy(s->cString + j, buffer, 3);
j += 3;
break;
case 4:
s->UTF8 = YES;
s->cStringLength += 3;
memcpy(s->cString + j, buffer, 4);
j += 4;
break;
default:
|
︙ | | | ︙ | |
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
|
character, buffer);
switch (characterLen) {
case 1:
s->cString[j++] = buffer[0];
break;
case 2:
s->isUTF8 = YES;
s->cStringLength++;
memcpy(s->cString + j, buffer, 2);
j += 2;
break;
case 3:
s->isUTF8 = YES;
s->cStringLength += 2;
memcpy(s->cString + j, buffer, 3);
j += 3;
break;
case 4:
s->isUTF8 = YES;
s->cStringLength += 3;
memcpy(s->cString + j, buffer, 4);
j += 4;
break;
default:
|
|
|
|
|
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
|
character, buffer);
switch (characterLen) {
case 1:
s->cString[j++] = buffer[0];
break;
case 2:
s->UTF8 = YES;
s->cStringLength++;
memcpy(s->cString + j, buffer, 2);
j += 2;
break;
case 3:
s->UTF8 = YES;
s->cStringLength += 2;
memcpy(s->cString + j, buffer, 3);
j += 3;
break;
case 4:
s->UTF8 = YES;
s->cStringLength += 3;
memcpy(s->cString + j, buffer, 4);
j += 4;
break;
default:
|
︙ | | | ︙ | |
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
|
s->cStringLength = cStringLength;
@try {
switch (of_string_check_utf8(s->cString,
cStringLength, &s->length)) {
case 1:
s->isUTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException
newWithClass: isa];
}
[self addMemoryToPool: s->cString];
|
|
|
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
|
s->cStringLength = cStringLength;
@try {
switch (of_string_check_utf8(s->cString,
cStringLength, &s->length)) {
case 1:
s->UTF8 = YES;
break;
case -1:
@throw [OFInvalidEncodingException
newWithClass: isa];
}
[self addMemoryToPool: s->cString];
|
︙ | | | ︙ | |
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
memset(s, 0, sizeof(*s));
/*
* First needs to be a call to be sure it is initialized, in
* case it's a constant string.
*/
s->cStringLength = [firstComponent UTF8StringLength];
s->isUTF8 = firstComponent->s->isUTF8;
s->length = firstComponent->s->length;
/* Calculate length and see if we need UTF-8 */
va_copy(argumentsCopy, arguments);
while ((component = va_arg(argumentsCopy, OFString*)) != nil) {
/* First needs to be a call, see above */
s->cStringLength += 1 + [component UTF8StringLength];
s->length += 1 + component->s->length;
if (component->s->isUTF8)
s->isUTF8 = YES;
}
s->cString = [self allocMemoryWithSize: s->cStringLength + 1];
cStringLength = [firstComponent UTF8StringLength];
memcpy(s->cString, [firstComponent UTF8String], cStringLength);
i = cStringLength;
|
|
|
|
|
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
memset(s, 0, sizeof(*s));
/*
* First needs to be a call to be sure it is initialized, in
* case it's a constant string.
*/
s->cStringLength = [firstComponent UTF8StringLength];
s->UTF8 = firstComponent->s->UTF8;
s->length = firstComponent->s->length;
/* Calculate length and see if we need UTF-8 */
va_copy(argumentsCopy, arguments);
while ((component = va_arg(argumentsCopy, OFString*)) != nil) {
/* First needs to be a call, see above */
s->cStringLength += 1 + [component UTF8StringLength];
s->length += 1 + component->s->length;
if (component->s->UTF8)
s->UTF8 = YES;
}
s->cString = [self allocMemoryWithSize: s->cStringLength + 1];
cStringLength = [firstComponent UTF8StringLength];
memcpy(s->cString, [firstComponent UTF8String], cStringLength);
i = cStringLength;
|
︙ | | | ︙ | |
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
|
- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding
{
switch (encoding) {
case OF_STRING_ENCODING_UTF_8:
return s->cString;
case OF_STRING_ENCODING_ASCII:
if (s->isUTF8)
@throw [OFInvalidEncodingException newWithClass: isa];
return s->cString;
default:
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
|
|
|
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
|
- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding
{
switch (encoding) {
case OF_STRING_ENCODING_UTF_8:
return s->cString;
case OF_STRING_ENCODING_ASCII:
if (s->UTF8)
@throw [OFInvalidEncodingException newWithClass: isa];
return s->cString;
default:
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
|
︙ | | | ︙ | |
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
|
- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding
{
switch (encoding) {
case OF_STRING_ENCODING_UTF_8:
return s->cStringLength;
case OF_STRING_ENCODING_ASCII:
if (s->isUTF8)
@throw [OFInvalidEncodingException newWithClass: isa];
return s->cStringLength;
default:
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
|
|
|
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
|
- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding
{
switch (encoding) {
case OF_STRING_ENCODING_UTF_8:
return s->cStringLength;
case OF_STRING_ENCODING_ASCII:
if (s->UTF8)
@throw [OFInvalidEncodingException newWithClass: isa];
return s->cStringLength;
default:
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
|
︙ | | | ︙ | |
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
|
if (![otherString isKindOfClass: [OFString class]])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
otherCString = [otherString UTF8String];
otherCStringLength = [otherString UTF8StringLength];
if (!s->isUTF8) {
minimumCStringLength = (s->cStringLength > otherCStringLength
? otherCStringLength : s->cStringLength);
if ((compare = memcasecmp(s->cString, otherCString,
minimumCStringLength)) == 0) {
if (s->cStringLength > otherCStringLength)
return OF_ORDERED_DESCENDING;
|
|
|
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
|
if (![otherString isKindOfClass: [OFString class]])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
otherCString = [otherString UTF8String];
otherCStringLength = [otherString UTF8StringLength];
if (!s->UTF8) {
minimumCStringLength = (s->cStringLength > otherCStringLength
? otherCStringLength : s->cStringLength);
if ((compare = memcasecmp(s->cString, otherCString,
minimumCStringLength)) == 0) {
if (s->cStringLength > otherCStringLength)
return OF_ORDERED_DESCENDING;
|
︙ | | | ︙ | |
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
|
- (of_unichar_t)characterAtIndex: (size_t)index
{
of_unichar_t character;
if (index >= s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (!s->isUTF8)
return s->cString[index];
index = of_string_index_to_position(s->cString, index,
s->cStringLength);
if (!of_string_utf8_to_unicode(s->cString + index,
s->cStringLength - index, &character))
|
|
|
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
|
- (of_unichar_t)characterAtIndex: (size_t)index
{
of_unichar_t character;
if (index >= s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (!s->UTF8)
return s->cString[index];
index = of_string_index_to_position(s->cString, index,
s->cStringLength);
if (!of_string_utf8_to_unicode(s->cString + index,
s->cStringLength - index, &character))
|
︙ | | | ︙ | |
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
|
{
size_t start = range.start;
size_t end = range.start + range.length;
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (s->isUTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
return [OFString stringWithUTF8String: s->cString + start
|
|
|
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
|
{
size_t start = range.start;
size_t end = range.start + range.length;
if (end > s->length)
@throw [OFOutOfRangeException newWithClass: isa];
if (s->UTF8) {
start = of_string_index_to_position(s->cString, start,
s->cStringLength);
end = of_string_index_to_position(s->cString, end,
s->cStringLength);
}
return [OFString stringWithUTF8String: s->cString + start
|
︙ | | | ︙ | |