ObjFW  Diff

Differences From Artifact [92fa7c4194]:

To Artifact [7c81772fe9]:


91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
91
92
93
94
95
96
97

98

99
100
101
102
103
104
105







-
+
-







	} @catch (OFInvalidFormatException *e) {
		/* Not an IP address -> we can use it if it contains a dot. */
		size_t pos = [domain rangeOfString: @"."].location;

		if (pos == OF_NOT_FOUND)
			return nil;

		ret = [domain substringWithRange:
		ret = [domain substringFromIndex: pos + 1];
		    of_range(pos + 1, domain.length - pos - 1)];
	}

	return ret;
}
#endif

@implementation OFDNSResolverSettings
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
189
190
191
192
193
194
195

196
197
198
199
200
201
202
203







-
+







		void *pool2 = objc_autoreleasePoolPush();
		OFArray *components, *hosts;
		size_t pos;
		OFString *address;

		pos = [line rangeOfString: @"#"].location;
		if (pos != OF_NOT_FOUND)
			line = [line substringWithRange: of_range(0, pos)];
			line = [line substringToIndex: pos];

		components = [line
		    componentsSeparatedByCharactersInSet: whitespaceCharacterSet
						 options: OF_STRING_SKIP_EMPTY];

		if (components.count < 2) {
			objc_autoreleasePoolPop(pool2);
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262

263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
238
239
240
241
242
243
244

245

246
247
248
249
250
251
252

253

254
255
256
257
258

259

260
261
262
263
264
265
266

267

268
269
270
271
272
273
274







-
+
-







-
+
-





-
+
-







-
+
-







# if !defined(OF_WINDOWS) && !defined(OF_AMIGAOS4)
- (void)parseResolvConfOption: (OFString *)option
{
	@try {
		if ([option hasPrefix: @"ndots:"]) {
			unsigned long long number;

			option = [option substringWithRange:
			option = [option substringFromIndex: 6];
			    of_range(6, option.length - 6)];
			number = option.unsignedLongLongValue;

			if (number > UINT_MAX)
				@throw [OFOutOfRangeException exception];

			_minNumberOfDotsInAbsoluteName = (unsigned int)number;
		} else if ([option hasPrefix: @"timeout:"]) {
			option = [option substringWithRange:
			option = [option substringFromIndex: 8];
			    of_range(8, option.length - 8)];

			_timeout = option.unsignedLongLongValue;
		} else if ([option hasPrefix: @"attempts:"]) {
			unsigned long long number;

			option = [option substringWithRange:
			option = [option substringFromIndex: 9];
			    of_range(9, option.length - 9)];
			number = option.unsignedLongLongValue;

			if (number > UINT_MAX)
				@throw [OFOutOfRangeException exception];

			_maxAttempts = (unsigned int)number;
		} else if ([option hasPrefix: @"reload-period:"]) {
			option = [option substringWithRange:
			option = [option substringFromIndex: 14];
			    of_range(14, option.length - 14)];

			_configReloadInterval = option.unsignedLongLongValue;
		} else if ([option isEqual: @"tcp"])
			_usesTCP = true;
	} @catch (OFInvalidFormatException *e) {
	}
}
304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
299
300
301
302
303
304
305

306
307
308
309
310
311
312
313







-
+







		void *pool2 = objc_autoreleasePoolPush();
		size_t pos;
		OFArray *components, *arguments;
		OFString *option;

		pos = [line indexOfCharacterFromSet: commentCharacters];
		if (pos != OF_NOT_FOUND)
			line = [line substringWithRange: of_range(0, pos)];
			line = [line substringToIndex: pos];

		components = [line
		    componentsSeparatedByCharactersInSet: whitespaceCharacterSet
						 options: OF_STRING_SKIP_EMPTY];

		if (components.count < 2) {
			objc_autoreleasePoolPop(pool2);