Differences From Artifact [91d033cd37]:
- File src/OFData+MessagePackParsing.m — part of check-in [6cfa8f5c7e] at 2020-08-13 21:12:03 on branch trunk — messagePackValue -> objectByParsingMessagePack (user: js, size: 13357) [annotate] [blame] [check-ins using]
To Artifact [464ca7dfaa]:
- File
src/OFData+MessagePackParsing.m
— part of check-in
[25c985fec1]
at
2020-08-25 00:11:24
on branch trunk
— OFNumber: Remove (u)int{8,16,32,64} methods
Since C guarantees minimum sizes for char, short, int, long and long
long, these can be used instead. (user: js, size: 13414) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
189 190 191 192 193 194 195 | OFData *data; if (length < 1) @throw [OFTruncatedDataException exception]; /* positive fixint */ if ((buffer[0] & 0x80) == 0) { | | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | OFData *data; if (length < 1) @throw [OFTruncatedDataException exception]; /* positive fixint */ if ((buffer[0] & 0x80) == 0) { *object = [OFNumber numberWithUnsignedChar: buffer[0] & 0x7F]; return 1; } /* negative fixint */ if ((buffer[0] & 0xE0) == 0xE0) { *object = [OFNumber numberWithChar: ((int8_t)(buffer[0] & 0x1F)) - 32]; return 1; } /* fixstr */ if ((buffer[0] & 0xE0) == 0xA0) { count = buffer[0] & 0x1F; |
︙ | ︙ | |||
229 230 231 232 233 234 235 | /* Prefix byte */ switch (buffer[0]) { /* Unsigned integers */ case 0xCC: /* uint8 */ if (length < 2) @throw [OFTruncatedDataException exception]; | | | > | > | > | | | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 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 | /* Prefix byte */ switch (buffer[0]) { /* Unsigned integers */ case 0xCC: /* uint8 */ if (length < 2) @throw [OFTruncatedDataException exception]; *object = [OFNumber numberWithUnsignedChar: buffer[1]]; return 2; case 0xCD: /* uint 16 */ if (length < 3) @throw [OFTruncatedDataException exception]; *object = [OFNumber numberWithUnsignedShort: readUInt16(buffer + 1)]; return 3; case 0xCE: /* uint 32 */ if (length < 5) @throw [OFTruncatedDataException exception]; *object = [OFNumber numberWithUnsignedLong: readUInt32(buffer + 1)]; return 5; case 0xCF: /* uint 64 */ if (length < 9) @throw [OFTruncatedDataException exception]; *object = [OFNumber numberWithUnsignedLongLong: 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]; |
︙ | ︙ |