18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
-
-
-
-
|
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#ifdef _WIN32
# include <malloc.h>
#endif
#import "OFString.h"
#import "OFString_UTF8.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFURL.h"
#import "OFHTTPRequest.h"
|
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
|
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
|
-
+
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
+
+
+
|
[new makeImmutable];
return new;
}
- (BOOL)hasPrefix: (OFString*)prefix
{
OFAutoreleasePool *pool;
of_unichar_t *tmp;
const of_unichar_t *prefixString;
size_t prefixLength;
int compare;
if ((prefixLength = [prefix length]) > [self length])
return NO;
tmp = [self allocMemoryForNItems: prefixLength
tmp = alloca(prefixLength * sizeof(of_unichar_t));
[self getCharacters: tmp
inRange: of_range(0, prefixLength)];
ofSize: sizeof(of_unichar_t)];
@try {
OFAutoreleasePool *pool;
[self getCharacters: tmp
inRange: of_range(0, prefixLength)];
pool = [[OFAutoreleasePool alloc] init];
pool = [[OFAutoreleasePool alloc] init];
prefixString = [prefix unicodeString];
compare = memcmp(tmp, prefixString,
prefixLength * sizeof(of_unichar_t));
prefixString = [prefix unicodeString];
compare = memcmp(tmp, prefixString,
prefixLength * sizeof(of_unichar_t));
[pool release];
[pool release];
} @finally {
[self freeMemory: tmp];
}
return !compare;
}
- (BOOL)hasSuffix: (OFString*)suffix
{
OFAutoreleasePool *pool;
of_unichar_t *tmp;
const of_unichar_t *suffixString;
size_t length, suffixLength;
int compare;
if ((suffixLength = [suffix length]) > [self length])
return NO;
length = [self length];
tmp = [self allocMemoryForNItems: suffixLength
tmp = alloca(suffixLength * sizeof(of_unichar_t));
[self getCharacters: tmp
inRange: of_range(length - suffixLength, suffixLength)];
ofSize: sizeof(of_unichar_t)];
@try {
OFAutoreleasePool *pool;
[self getCharacters: tmp
inRange: of_range(length - suffixLength,
suffixLength)];
pool = [[OFAutoreleasePool alloc] init];
pool = [[OFAutoreleasePool alloc] init];
suffixString = [suffix unicodeString];
compare = memcmp(tmp, suffixString,
suffixLength * sizeof(of_unichar_t));
suffixString = [suffix unicodeString];
compare = memcmp(tmp, suffixString,
suffixLength * sizeof(of_unichar_t));
[pool release];
[pool release];
} @finally {
[self freeMemory: tmp];
}
return !compare;
}
- (OFArray*)componentsSeparatedByString: (OFString*)delimiter
{
OFAutoreleasePool *pool;
|