ObjFW  Check-in [88053589dc]

Overview
Comment:Very small API change.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 88053589dcc8f78d1fd627ba161dae7006e0f0a71b3ab523b1c1e5619c65ff57
User & Date: js on 2008-12-07 10:48:12
Other Links: manifest | tags
Context
2008-12-07
12:41
OFXMLFactory: Fix FIXMEs, TODOs and possible off-by-one. check-in: 4073a31454 user: js tags: trunk
10:48
Very small API change. check-in: 88053589dc user: js tags: trunk
10:39
Remove redundant method definitions. check-in: 06c6cdbd34 user: js tags: trunk
Changes

Modified src/OFStream.h from [794f822abd] to [a9317063cc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

/**
 * The OFStream protocol provides functions to read and write streams.
 */
@protocol OFStream
/**
 * Reads from the stream into a buffer.
 *
 * \param buf The buffer into which the data is read
 * \param size The size of the data that should be read.












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

/**
 * The OFStream protocol provides functions to read from and write to streams.
 */
@protocol OFStream
/**
 * Reads from the stream into a buffer.
 *
 * \param buf The buffer into which the data is read
 * \param size The size of the data that should be read.

Modified src/OFString.h from [a0c9234128] to [02ec2a897c].

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

/**
 * Compares the OFString to another OFString.
 *
 * \param str An OFString to compare with
 * \return An integer which is the result of the comparison, see wcscmp
 */
- (int)compare: (OFString*)str;

/**
 * Append another OFString to the OFString.
 *
 * \param str An OFString to append
 */
- append: (OFString*)str;







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

/**
 * Compares the OFString to another OFString.
 *
 * \param str An OFString to compare with
 * \return An integer which is the result of the comparison, see wcscmp
 */
- (int)compareTo: (OFString*)str;

/**
 * Append another OFString to the OFString.
 *
 * \param str An OFString to append
 */
- append: (OFString*)str;

Modified src/OFString.m from [a1f83fb4fc] to [1aa922997d].

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

- (OFString*)setTo: (OFString*)str
{
	[self free];
	return (self = [str clone]);
}

- (int)compare: (OFString*)str
{
	return wcscmp(string, [str wideCString]);
}

- append: (OFString*)str
{
	return [self appendWideCString: [str wideCString]];







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

- (OFString*)setTo: (OFString*)str
{
	[self free];
	return (self = [str clone]);
}

- (int)compareTo: (OFString*)str
{
	return wcscmp(string, [str wideCString]);
}

- append: (OFString*)str
{
	return [self appendWideCString: [str wideCString]];

Modified tests/OFString/OFString.m from [2882aa104f] to [2ae4bbf292].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	OFString *s1 = [OFString newFromCString: "test"];
	OFString *s2 = [OFString newFromCString: ""];
	OFString *s3;
	OFString *s4 = [OFString new];

	s3 = [s1 clone];

	if (![s1 compare: s3])
		puts("s1 and s3 match! GOOD!");
	else {
		puts("s1 and s3 don't match!");
		return 1;
	}

	[s2 appendCString: "123"];
	[s4 setTo: s2];

	if (![s2 compare: s4])
		puts("s2 and s4 match! GOOD!");
	else {
		puts("s2 and s4 don't match!");
		return 1;
	}

	if (!strcmp([[s1 append: s2] getCString], "test123"))







|









|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	OFString *s1 = [OFString newFromCString: "test"];
	OFString *s2 = [OFString newFromCString: ""];
	OFString *s3;
	OFString *s4 = [OFString new];

	s3 = [s1 clone];

	if (![s1 compareTo: s3])
		puts("s1 and s3 match! GOOD!");
	else {
		puts("s1 and s3 don't match!");
		return 1;
	}

	[s2 appendCString: "123"];
	[s4 setTo: s2];

	if (![s2 compareTo: s4])
		puts("s2 and s4 match! GOOD!");
	else {
		puts("s2 and s4 don't match!");
		return 1;
	}

	if (!strcmp([[s1 append: s2] getCString], "test123"))