ObjFW  Diff

Differences From Artifact [032c647d7b]:

To Artifact [c56cc9efc9]:


1
2
3
4

5
6
7
8
9
10
11
1



2
3
4
5
6
7
8
9

-
-
-
+







/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018, 2019, 2020
 *   Jonathan Schleifer <js@nil.im>
 * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
271
272
273
274
275
276
277
278

279
280
281
282
283
284
285
286
287
288
289
290

291
292
293
294
295
296
297
298
299
300
301
302

303
304
305
306
307
308
309
310
269
270
271
272
273
274
275

276

277
278
279
280
281
282
283
284
285
286

287

288
289
290
291
292
293
294
295
296
297

298

299
300
301
302
303
304
305







-
+
-










-
+
-










-
+
-







		      name: name
		    prefix: prefix
		 namespace: ns
		attributes: nil
		    string: nil];
}

-    (void)parser: (OFXMLParser *)parser
- (void)parser: (OFXMLParser *)parser foundCharacters: (OFString *)string
  foundCharacters: (OFString *)string
{
	[self	    parser: parser
	    didCreateEvent: STRING
		      name: nil
		    prefix: nil
		 namespace: nil
		attributes: nil
		    string: string];
}

- (void)parser: (OFXMLParser *)parser
- (void)parser: (OFXMLParser *)parser foundCDATA: (OFString *)cdata
    foundCDATA: (OFString *)cdata
{
	[self	    parser: parser
	    didCreateEvent: CDATA
		      name: nil
		    prefix: nil
		 namespace: nil
		attributes: nil
		    string: cdata];
}

- (void)parser: (OFXMLParser *)parser
- (void)parser: (OFXMLParser *)parser foundComment: (OFString *)comment
  foundComment: (OFString *)comment
{
	[self	    parser: parser
	    didCreateEvent: COMMENT
		      name: nil
		    prefix: nil
		 namespace: nil
		attributes: nil
349
350
351
352
353
354
355
356

357
358
359

360
361
362
363
364
365
366
367
344
345
346
347
348
349
350

351

352

353

354
355
356
357
358
359
360







-
+
-

-
+
-







	len = strlen(str);

	for (j = 0; j < len; j+= 2) {
		if (parser.hasFinishedParsing)
			abort();

		if (j + 2 > len)
			[parser parseBuffer: str + j
			[parser parseBuffer: str + j length: 1];
				     length: 1];
		else
			[parser parseBuffer: str + j
			[parser parseBuffer: str + j length: 2];
				     length: 2];
	}

	TEST(@"Checking if everything was parsed",
	    i == 32 && parser.lineNumber == 18)

	TEST(@"-[hasFinishedParsing]", parser.hasFinishedParsing)