Overview
Context
Changes
Modified src/OFCString.m
from [dc3a9e9583]
to [cc01727386].
︙ | | |
41
42
43
44
45
46
47
48
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
|
41
42
43
44
45
46
47
48
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
|
-
+
-
+
|
- (size_t)length
{
return length;
}
- (OFString*)clone
{
return [OFString newWithCString: string];
return [OFString newAsCString: string];
}
- (int)compareTo: (OFString*)str
{
return strcmp(string, [str cString]);
}
- (OFString*)append: (OFString*)str
{
return [self appendCString: [str cString]];
}
- (OFString*)appendCString: (const char*)str
{
char *newstr;
size_t newlen, strlength;
if (string == NULL)
return [self setTo: [OFString newWithCString: (char*)str]];
return [self setTo: [OFString newAsCString: (char*)str]];
strlength = strlen(str);
newlen = length + strlength;
newstr = [self resizeMem: string
toSize: newlen + 1];
|
︙ | | |
Modified src/OFConstCString.m
from [1ea6deb553]
to [294711f4b4].
︙ | | |
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-
+
|
- (size_t)length
{
return length;
}
- (OFString*)clone
{
return [OFString newWithConstCString: string];
return [OFString newAsConstCString: string];
}
- (int)compareTo: (OFString*)str
{
return strcmp(string, [str cString]);
}
@end
|
Modified src/OFConstWideCString.m
from [d6f7c115da]
to [68175f182a].
︙ | | |
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-
+
|
- (size_t)length
{
return length;
}
- (OFString*)clone
{
return [OFString newWithConstWideCString: string];
return [OFString newAsConstWideCString: string];
}
- (int)compareTo: (OFString*)str
{
return wcscmp(string, [str wcString]);
}
@end
|
Modified src/OFString.h
from [19fb63cd94]
to [a2a6f02dc3].
︙ | | |
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
-
-
-
-
+
+
+
+
-
+
|
*/
#import <wchar.h>
#import <stddef.h>
#import "OFObject.h"
@interface OFString: OFObject
+ newWithConstCString: (const char*)str;
+ newWithConstWideCString: (const wchar_t*)str;
+ newWithCString: (char*)str;
+ newWithWideCString: (wchar_t*)str;
+ newAsConstCString: (const char*)str;
+ newAsConstWideCString: (const wchar_t*)str;
+ newAsCString: (char*)str;
+ newAsWideCString: (wchar_t*)str;
- (char*)cString;
- (wchar_t*)wcString;
- (size_t)length;
- (OFString*)setTo: (OFString*)str;
- (OFString*)clone;
- (int)compareTo: (OFString*)str;
- (OFString*)append: (OFString*)str;
- (OFString*)appendCString: (const char*)str;
- (OFString*)appendWideCString: (const char*)str;
- (OFString*)appendWideCString: (const wchar_t*)str;
@end
|
Modified src/OFString.m
from [34596a2a5f]
to [ffab6838ef].
︙ | | |
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
+
-
+
-
+
-
+
|
#import "OFConstCString.h"
#import "OFConstWideCString.h"
#import "OFCString.h"
#import "OFWideCString.h"
#import "OFExceptions.h"
@implementation OFString
+ newWithConstCString: (const char*)str
+ newAsConstCString: (const char*)str
{
return [[OFConstCString alloc] initWithConstCString: str];
}
+ newWithConstWideCString: (const wchar_t*)str
+ newAsConstWideCString: (const wchar_t*)str
{
return [[OFConstWideCString alloc] initWithConstWideCString: str];
}
+ newWithCString: (char*)str
+ newAsCString: (char*)str
{
return [[OFCString alloc] initWithCString: str];
}
+ newWithWideCString: (wchar_t*)str
+ newAsWideCString: (wchar_t*)str
{
return [[OFWideCString alloc] initWithWideCString: str];
}
- (char*)cString
{
[[OFNotImplementedException newWithObject: self
|
︙ | | |
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
-
+
|
{
[[OFNotImplementedException newWithObject: self
andSelector: @selector(appendCString:)]
raise];
return nil;
}
- (OFString*)appendWideCString: (const char*)str
- (OFString*)appendWideCString: (const wchar_t*)str
{
[[OFNotImplementedException newWithObject: self
andSelector: @selector(
appendWideCString:)]
raise];
return nil;
}
@end
|
Modified src/OFWideCString.m
from [39f7445e2b]
to [0d25058214].
︙ | | |
43
44
45
46
47
48
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
|
43
44
45
46
47
48
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
|
-
+
-
+
|
- (size_t)length
{
return length;
}
- (OFString*)clone
{
return [OFString newWithWideCString: string];
return [OFString newAsWideCString: string];
}
- (int)compareTo: (OFString*)str
{
return wcscmp(string, [str wcString]);
}
- (OFString*)append: (OFString*)str
{
return [self appendWideCString: [str wcString]];
}
- (OFString*)appendWideCString: (const wchar_t*)str
{
wchar_t *newstr;
size_t newlen, strlength;
if (string == NULL)
return [self setTo: [OFString
newWithWideCString: (wchar_t*)str]];
newAsWideCString: (wchar_t*)str]];
strlength = wcslen(str);
newlen = length + strlength;
newstr = [self resizeMem: string
toSize: (newlen + 1) * sizeof(wchar_t)];
|
︙ | | |
Modified tests/OFList/OFList.m
from [1645530892]
to [913aa88c30].
︙ | | |
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
-
-
-
+
+
+
|
{
size_t i;
OFList *list;
OFListObject *iter;
list = [OFList new];
[list addNew: [OFString newWithConstCString: strings[0]]];
[list addNew: [OFString newWithConstCString: strings[1]]];
[list addNew: [OFString newWithConstCString: strings[2]]];
[list addNew: [OFString newAsConstCString: strings[0]]];
[list addNew: [OFString newAsConstCString: strings[1]]];
[list addNew: [OFString newAsConstCString: strings[2]]];
for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++)
if (!strcmp([(OFString*)[iter data] cString], strings[i]))
printf("Element %zu is expected element. GOOD!\n", i);
else {
printf("Element %zu is not expected element!\n", i);
return 1;
|
︙ | | |
Modified tests/OFString/OFString.m
from [c0f30552d4]
to [1ba1ce211e].
︙ | | |
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-
-
+
+
-
+
-
+
|
#import "OFString.h"
/* TODO: Do real checks */
int
main()
{
OFString *s1 = [OFString newWithCString: "test"];
OFString *s2 = [OFString newWithCString: ""];
OFString *s1 = [OFString newAsCString: "test"];
OFString *s2 = [OFString newAsCString: ""];
OFString *s3;
OFString *s4 = [OFString newWithConstCString: NULL];
OFString *s4 = [OFString newAsConstCString: NULL];
[s2 append: [OFString newWithConstCString: "123"]];
[s2 appendCString: "123"];
s3 = [s1 clone];
[s4 setTo: s2];
if (![s1 compareTo: s3])
puts("s1 and s3 match! GOOD!");
else {
|
︙ | | |
Modified tests/OFWideString/OFWideString.m
from [1a00935b6a]
to [437fd29f56].
︙ | | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
-
-
+
+
-
+
-
+
|
#import "OFString.h"
/* TODO: Do real checks */
int
main()
{
OFString *s1 = [OFString newWithWideCString: L"test"];
OFString *s2 = [OFString newWithWideCString: L""];
OFString *s1 = [OFString newAsWideCString: L"test"];
OFString *s2 = [OFString newAsWideCString: L""];
OFString *s3;
OFString *s4 = [OFString newWithConstWideCString: NULL];
OFString *s4 = [OFString newAsConstWideCString: NULL];
[s2 append: [OFString newWithConstWideCString: L"123"]];
[s2 appendWideCString: L"123"];
s3 = [s1 clone];
[s4 setTo: s2];
if (![s1 compareTo: s3])
puts("s1 and s3 match! GOOD!");
else {
|
︙ | | |