Differences From Artifact [0041614de1]:
- File
src/OFMessagePackExtension.m
— part of check-in
[aeb403a1ed]
at
2020-10-10 14:27:37
on branch trunk
— OFObject: Change type of -[hash] to unsigned long
The internal hash is still 32 bit in most places, but this way, it is at
least not baked into the API and ABI and can be upgraded later, should
that ever be necessary. (user: js, size: 3686) [annotate] [blame] [check-ins using] [more...]
To Artifact [bfafebb5dc]:
- File src/OFMessagePackExtension.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 3567) [annotate] [blame] [check-ins using] [more...]
1 | /* | < < | | 1 2 3 4 5 6 7 8 9 | /* * 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. * |
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OFString.h" #import "OFInvalidArgumentException.h" @implementation OFMessagePackExtension @synthesize type = _type, data = _data; | | < | < | < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFString.h" #import "OFInvalidArgumentException.h" @implementation OFMessagePackExtension @synthesize type = _type, data = _data; + (instancetype)extensionWithType: (int8_t)type data: (OFData *)data { return [[[self alloc] initWithType: type data: data] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithType: (int8_t)type data: (OFData *)data { self = [super init]; @try { if (data == nil || data.itemSize != 1) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | ret = [OFMutableData dataWithCapacity: count + 4]; prefix = 0xC8; [ret addItem: &prefix]; length = OF_BSWAP16_IF_LE((uint16_t)count); | | < | < | < < | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | ret = [OFMutableData dataWithCapacity: count + 4]; prefix = 0xC8; [ret addItem: &prefix]; length = OF_BSWAP16_IF_LE((uint16_t)count); [ret addItems: &length count: 2]; [ret addItem: &_type]; } else { uint32_t length; ret = [OFMutableData dataWithCapacity: count + 6]; prefix = 0xC9; [ret addItem: &prefix]; length = OF_BSWAP32_IF_LE((uint32_t)count); [ret addItems: &length count: 4]; [ret addItem: &_type]; } [ret addItems: _data.items count: _data.count]; [ret makeImmutable]; return ret; } - (OFString *)description { |
︙ | ︙ |