ObjFW  Diff

Differences From Artifact [ba03f0d3c5]:

To Artifact [6a39e4a81c]:


1315
1316
1317
1318
1319
1320
1321
1322








1323
1324
1325
1326
1327
1328
1329

1330
1331
1332

1333
1334
1335
1336
1337
1338

1339
1340
1341
1342
1343
1344
1345
1346








1347
1348

1349
1350
1351

1352
1353
1354
1355
1356
1357

1358
1359
1360

1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375







1376
1377
1378
1379
1380
1381
1382
1383

1384
1385
1386
1387
1388
1389
1390
1315
1316
1317
1318
1319
1320
1321

1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335

1336
1337
1338

1339
1340
1341
1342
1343
1344
1345
1346








1347
1348
1349
1350
1351
1352
1353
1354


1355



1356






1357



1358















1359
1360
1361
1362
1363
1364
1365



1366
1367
1368
1369

1370
1371
1372
1373
1374
1375
1376
1377







-
+
+
+
+
+
+
+
+






-
+


-
+






+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
-
-
+
-
-
-
-
-
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-




-
+







	[JSON appendString: @"\""];

	[JSON makeImmutable];

	return JSON;
}

- (size_t)indexOfFirstOccurrenceOfString: (OFString*)string
- (of_range_t)rangeOfString: (OFString*)string
{
	return [self rangeOfString: string
			   options: 0];
}

- (of_range_t)rangeOfString: (OFString*)string
		    options: (of_string_search_options_t)options
{
	void *pool;
	const of_unichar_t *unicodeString, *searchString;
	size_t i, length, searchLength;

	if ((searchLength = [string length]) == 0)
		return [self length];
		return of_range(0, 0);

	if (searchLength > (length = [self length]))
		return OF_INVALID_INDEX;
		return of_range(OF_INVALID_INDEX, 0);

	pool = objc_autoreleasePoolPush();

	unicodeString = [self unicodeString];
	searchString = [string unicodeString];

	if (options & OF_STRING_SEARCH_BACKWARDS) {
	for (i = 0; i <= length - searchLength; i++) {
		if (!memcmp(unicodeString + i, searchString,
		    searchLength * sizeof(of_unichar_t))) {
			objc_autoreleasePoolPop(pool);
			return i;
		}
	}

		for (i = length - searchLength;; i--) {
			if (!memcmp(unicodeString + i, searchString,
			    searchLength * sizeof(of_unichar_t))) {
				objc_autoreleasePoolPop(pool);
				return of_range(i, searchLength);
			}

			/* Did not match and we're at the last character */
	objc_autoreleasePoolPop(pool);

			if (i == 0)
	return OF_INVALID_INDEX;
}

				break;
- (size_t)indexOfLastOccurrenceOfString: (OFString*)string
{
	void *pool;
	const of_unichar_t *unicodeString, *searchString;
	size_t i, length, searchLength;

		}
	if ((searchLength = [string length]) == 0)
		return [self length];

	} else {
	if (searchLength > (length = [self length]))
		return OF_INVALID_INDEX;

	pool = objc_autoreleasePoolPush();

	unicodeString = [self unicodeString];
	searchString = [string unicodeString];

	for (i = length - searchLength;; i--) {
		if (!memcmp(unicodeString + i, searchString,
		    searchLength * sizeof(of_unichar_t))) {
			objc_autoreleasePoolPop(pool);
			return i;
		}

		for (i = 0; i <= length - searchLength; i++) {
			if (!memcmp(unicodeString + i, searchString,
			    searchLength * sizeof(of_unichar_t))) {
				objc_autoreleasePoolPop(pool);
				return of_range(i, searchLength);
			}
		}
		/* Did not match and we're at the last character */
		if (i == 0)
			break;
	}

	objc_autoreleasePoolPop(pool);

	return OF_INVALID_INDEX;
	return of_range(OF_INVALID_INDEX, 0);
}

- (BOOL)containsString: (OFString*)string
{
	void *pool;
	const of_unichar_t *unicodeString, *searchString;
	size_t i, length, searchLength;