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
311
312
313
314
|
if (length < 9)
@throw [OFTruncatedDataException exception];
*object = [OFNumber numberWithInt64: readUInt64(buffer + 1)];
return 9;
/* Floating point */
case 0xCA:; /* float 32 */
union {
unsigned char u8[4];
float f;
} f;
if (length < 5)
@throw [OFTruncatedDataException exception];
memcpy(&f.u8, buffer + 1, 4);
*object = [OFNumber numberWithFloat: OF_BSWAP_FLOAT_IF_LE(f.f)];
return 5;
case 0xCB:; /* float 64 */
union {
unsigned char u8[8];
double d;
} d;
if (length < 9)
@throw [OFTruncatedDataException exception];
memcpy(&d.u8, buffer + 1, 8);
*object = [OFNumber numberWithDouble:
OF_BSWAP_DOUBLE_IF_LE(d.d)];
return 9;
/* nil */
case 0xC0:
*object = [OFNull null];
return 1;
/* false */
case 0xC2:
|
<
<
|
<
|
|
<
<
|
<
|
|
<
|
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
|
if (length < 9)
@throw [OFTruncatedDataException exception];
*object = [OFNumber numberWithInt64: readUInt64(buffer + 1)];
return 9;
/* Floating point */
case 0xCA:; /* float 32 */
float f;
if (length < 5)
@throw [OFTruncatedDataException exception];
memcpy(&f, buffer + 1, 4);
*object = [OFNumber numberWithFloat: OF_BSWAP_FLOAT_IF_LE(f)];
return 5;
case 0xCB:; /* float 64 */
double d;
if (length < 9)
@throw [OFTruncatedDataException exception];
memcpy(&d, buffer + 1, 8);
*object = [OFNumber numberWithDouble: OF_BSWAP_DOUBLE_IF_LE(d)];
return 9;
/* nil */
case 0xC0:
*object = [OFNull null];
return 1;
/* false */
case 0xC2:
|