ObjFW  Check-in [ea4a43461c]

Overview
Comment:Never compare to @"", use length instead.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ea4a43461c151f42b6d46f724673d46d83ee5dba7c2369ff37c7162b40fc2d51
User & Date: js on 2013-01-23 21:52:54
Other Links: manifest | tags
Context
2013-01-23
21:53
autorelease.h: Add documentation. check-in: 13c5836ad2 user: js tags: trunk
21:52
Never compare to @"", use length instead. check-in: ea4a43461c user: js tags: trunk
18:32
extra.mk.in: Remove variables not used anymore. check-in: c7d7db5486 user: js tags: trunk
Changes

Modified src/OFFile.m from [7dcc3acfc8] to [981d954d73].

287
288
289
290
291
292
293
294

295
296
297
298
299
300
301
287
288
289
290
291
292
293

294
295
296
297
298
299
300
301







-
+








		if (currentPath != nil)
			currentPath = [OFString
			    stringWithPath: currentPath, component, nil];
		else
			currentPath = component;

		if (![currentPath isEqual: @""] &&
		if ([currentPath length] > 0 &&
		    ![OFFile directoryExistsAtPath: currentPath])
			[OFFile createDirectoryAtPath: currentPath];

		[currentPath retain];

		objc_autoreleasePoolPop(pool2);

Modified src/OFHTTPClient.m from [24ee97d7ac] to [07b706d2dd].

171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185







-
+







	if (requestType == OF_HTTP_REQUEST_TYPE_GET)
		type = "GET";
	if (requestType == OF_HTTP_REQUEST_TYPE_HEAD)
		type = "HEAD";
	if (requestType == OF_HTTP_REQUEST_TYPE_POST)
		type = "POST";

	if ([(path = [URL path]) isEqual: @""])
	if ([(path = [URL path]) length] == 0)
		path = @"/";

	if ([URL query] != nil)
		[sock writeFormat: @"%s %@?%@ HTTP/1.1\r\n",
		    type, path, [URL query]];
	else
		[sock writeFormat: @"%s %@ HTTP/1.1\r\n", type, path];
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
258
259
260
261
262
263
264

265
266
267
268
269
270
271
272







-
+







			    exceptionWithClass: [self class]];
		}

		if (line == nil)
			@throw [OFInvalidServerReplyException
			    exceptionWithClass: [self class]];

		if ([line isEqual: @""])
		if ([line length] == 0)
			break;

		lineC = [line UTF8String];

		if ((tmp = strchr(lineC, ':')) == NULL)
			@throw [OFInvalidServerReplyException
			    exceptionWithClass: [self class]];
427
428
429
430
431
432
433
434

435
436
437
438
439
440
441
427
428
429
430
431
432
433

434
435
436
437
438
439
440
441







-
+







				@try {
					line = [sock readLine];
				} @catch (OFInvalidEncodingException *e) {
					@throw [OFInvalidServerReplyException
					    exceptionWithClass: [self class]];
				}

				if (![line isEqual: @""])
				if ([line length] > 0)
					@throw [OFInvalidServerReplyException
					    exceptionWithClass: [self class]];

				objc_autoreleasePoolPop(pool2);
			}
		} else {
			size_t length;

Modified src/OFHTTPServer.m from [85b2274e9b] to [34f30ba48f].

321
322
323
324
325
326
327
328

329
330
331
332
333
334
335
321
322
323
324
325
326
327

328
329
330
331
332
333
334
335







-
+







}

- (BOOL)parseHeaders: (OFString*)line
{
	OFString *key, *value;
	size_t pos;

	if ([line isEqual: @""]) {
	if ([line length] == 0) {
		switch (requestType) {
		case OF_HTTP_REQUEST_TYPE_GET:
		case OF_HTTP_REQUEST_TYPE_HEAD:
			state = SEND_REPLY;
			break;
		case OF_HTTP_REQUEST_TYPE_POST:;
			OFString *tmp;

Modified src/OFString.m from [0f2f5910d1] to [7077269c5c].

1944
1945
1946
1947
1948
1949
1950
1951

1952
1953
1954
1955
1956
1957
1958

1959
1960
1961
1962
1963
1964
1965
1944
1945
1946
1947
1948
1949
1950

1951
1952
1953
1954
1955
1956
1957

1958
1959
1960
1961
1962
1963
1964
1965







-
+






-
+








	for (i = 0, last = 0; i <= length - delimiterLength; i++) {
		if (memcmp(characters + i, delimiterCharacters,
		    delimiterLength * sizeof(of_unichar_t)))
			continue;

		component = [self substringWithRange: of_range(last, i - last)];
		if (!skipEmpty || ![component isEqual: @""])
		if (!skipEmpty || [component length] > 0)
			[array addObject: component];

		i += delimiterLength - 1;
		last = i + 1;
	}
	component = [self substringWithRange: of_range(last, length - last)];
	if (!skipEmpty || ![component isEqual: @""])
	if (!skipEmpty || [component length] > 0)
		[array addObject: component];

	[array makeImmutable];

	objc_autoreleasePoolPop(pool);

	return array;

Modified src/OFString_UTF8.m from [17c27fdf19] to [0615761918].

1163
1164
1165
1166
1167
1168
1169
1170

1171
1172
1173
1174
1175
1176
1177

1178
1179
1180
1181
1182
1183
1184
1163
1164
1165
1166
1167
1168
1169

1170
1171
1172
1173
1174
1175
1176

1177
1178
1179
1180
1181
1182
1183
1184







-
+






-
+








	for (i = 0, last = 0; i <= s->cStringLength - cStringLength; i++) {
		if (memcmp(s->cString + i, cString, cStringLength))
			continue;

		component = [OFString stringWithUTF8String: s->cString + last
						    length: i - last];
		if (!skipEmpty || ![component isEqual: @""])
		if (!skipEmpty || [component length] > 0)
			[array addObject: component];

		i += cStringLength - 1;
		last = i + 1;
	}
	component = [OFString stringWithUTF8String: s->cString + last];
	if (!skipEmpty || ![component isEqual: @""])
	if (!skipEmpty || [component length] > 0)
		[array addObject: component];

	[array makeImmutable];

	objc_autoreleasePoolPop(pool);

	return array;

Modified src/OFXMLElement.m from [e07bcbe98a] to [da574fc59a].

899
900
901
902
903
904
905
906

907
908
909
910
911
912
913
899
900
901
902
903
904
905

906
907
908
909
910
911
912
913







-
+







		}
	}
}

- (void)setPrefix: (OFString*)prefix
     forNamespace: (OFString*)ns_
{
	if (prefix == nil || [prefix isEqual: @""])
	if ([prefix length] == 0)
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];
	if (ns_ == nil)
		ns_ = @"";

	[namespaces setObject: prefix