Differences From Artifact [fc3aaeaea9]:
- File src/OFDataArray.m — part of check-in [590c377d8a] at 2013-04-26 19:42:52 on branch trunk — Make it possible to disable sockets. (user: js, size: 18061) [annotate] [blame] [check-ins using]
To Artifact [c47726834e]:
- File
src/OFDataArray.m
— part of check-in
[cba771824e]
at
2013-06-19 19:14:11
on branch trunk
— Implement the new MessagePack specification.
No support for extensions yet.
This obsoletes BinaryPack. (user: js, size: 18063) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
46 47 48 49 50 51 52 | #import "autorelease.h" #import "base64.h" #import "macros.h" /* References for static linking */ void _references_to_categories_of_OFDataArray(void) { | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #import "autorelease.h" #import "base64.h" #import "macros.h" /* References for static linking */ void _references_to_categories_of_OFDataArray(void) { _OFDataArray_MessagePackValue_reference = 1; _OFDataArray_Hashing_reference = 1; } @implementation OFDataArray + (instancetype)dataArray { return [[[self alloc] init] autorelease]; |
︙ | ︙ | |||
624 625 626 627 628 629 630 | [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } | | | | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFDataArray*)messagePackRepresentation { OFDataArray *data; if (_itemSize != 1) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; if (_count <= UINT8_MAX) { uint8_t type = 0xC4; uint8_t tmp = (uint8_t)_count; data = [OFDataArray dataArrayWithItemSize: 1 capacity: _count + 2]; [data addItem: &type]; [data addItem: &tmp]; } else if (_count <= UINT16_MAX) { uint8_t type = 0xC5; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)_count); data = [OFDataArray dataArrayWithItemSize: 1 capacity: _count + 3]; [data addItem: &type]; [data addItems: &tmp count: sizeof(tmp)]; } else if (_count <= UINT32_MAX) { uint8_t type = 0xC6; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)_count); data = [OFDataArray dataArrayWithItemSize: 1 capacity: _count + 5]; [data addItem: &type]; [data addItems: &tmp |
︙ | ︙ |