ObjFW  Check-in [e3001a706c]

Overview
Comment:-[objectByParsingMessagePack]: Fix signed numbers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e3001a706c0f973161ff3dcd4674357f4a3e1fc31a9a9a3dcc64fcc8287c4dfd
User & Date: js on 2024-03-17 22:40:22
Other Links: manifest | tags
Context
2024-03-17
22:41
-[objectByParsingMessagePack]: Fix signed numbers check-in: 355d3a9dc3 user: js tags: 1.0
22:40
Add OFMessagePackTests check-in: cb8e2e3fa6 user: js tags: trunk
22:40
-[objectByParsingMessagePack]: Fix signed numbers check-in: e3001a706c user: js tags: trunk
17:36
GitHub Actions: Split MSYS2 into multiple steps check-in: 34045e21d6 user: js tags: trunk
Changes

Modified src/OFData+MessagePackParsing.m from [5553f1238c] to [e56d8e63a6].

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

280
281
282
283
284
285
286
		    readUInt64(buffer + 1)];
		return 9;
	/* Signed integers */
	case 0xD0: /* int 8 */
		if (length < 2)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithChar: buffer[1]];
		return 2;
	case 0xD1: /* int 16 */
		if (length < 3)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithShort: readUInt16(buffer + 1)];

		return 3;
	case 0xD2: /* int 32 */
		if (length < 5)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLong: readUInt32(buffer + 1)];

		return 5;
	case 0xD3: /* int 64 */
		if (length < 9)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLongLong: readUInt64(buffer + 1)];

		return 9;
	/* Floating point */
	case 0xCA:; /* float 32 */
		float f;

		if (length < 5)
			@throw [OFTruncatedDataException exception];







|





|
>





|
>





|
>







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
280
281
282
283
284
285
286
287
288
289
		    readUInt64(buffer + 1)];
		return 9;
	/* Signed integers */
	case 0xD0: /* int 8 */
		if (length < 2)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithChar: (int8_t)buffer[1]];
		return 2;
	case 0xD1: /* int 16 */
		if (length < 3)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithShort:
		    (int16_t)readUInt16(buffer + 1)];
		return 3;
	case 0xD2: /* int 32 */
		if (length < 5)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLong:
		    (int32_t)readUInt32(buffer + 1)];
		return 5;
	case 0xD3: /* int 64 */
		if (length < 9)
			@throw [OFTruncatedDataException exception];

		*object = [OFNumber numberWithLongLong:
		    (int64_t)readUInt64(buffer + 1)];
		return 9;
	/* Floating point */
	case 0xCA:; /* float 32 */
		float f;

		if (length < 5)
			@throw [OFTruncatedDataException exception];