@@ -116,12 +116,11 @@ pos += parseObject(buffer + pos, length - pos, &key, depthLimit); pos += parseObject(buffer + pos, length - pos, &value, depthLimit); - [*object setObject: value - forKey: key]; + [*object setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } return pos; @@ -133,19 +132,19 @@ switch (data.count) { case 4: { uint32_t timestamp; memcpy(×tamp, data.items, 4); - timestamp = OF_BSWAP32_IF_LE(timestamp); + timestamp = OFFromBigEndian32(timestamp); return [OFDate dateWithTimeIntervalSince1970: timestamp]; } case 8: { uint64_t combined; memcpy(&combined, data.items, 8); - combined = OF_BSWAP64_IF_LE(combined); + combined = OFFromBigEndian64(combined); return [OFDate dateWithTimeIntervalSince1970: (double)(combined & 0x3FFFFFFFF) + (double)(combined >> 34) / 1000000000]; } @@ -154,12 +153,12 @@ int64_t seconds; memcpy(&nanoseconds, data.items, 4); memcpy(&seconds, (char *)data.items + 4, 8); - nanoseconds = OF_BSWAP32_IF_LE(nanoseconds); - seconds = OF_BSWAP64_IF_LE(seconds); + nanoseconds = OFFromBigEndian32(nanoseconds); + seconds = OFFromBigEndian64(seconds); return [OFDate dateWithTimeIntervalSince1970: (double)seconds + (double)nanoseconds / 1000000000]; } default: @@ -286,21 +285,21 @@ if (length < 5) @throw [OFTruncatedDataException exception]; memcpy(&f, buffer + 1, 4); - *object = [OFNumber numberWithFloat: OF_BSWAP_FLOAT_IF_LE(f)]; + *object = [OFNumber numberWithFloat: OFFromBigEndianFloat(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)]; + *object = [OFNumber numberWithDouble: OFFromBigEndianDouble(d)]; return 9; /* nil */ case 0xC0: *object = [OFNull null]; return 1; @@ -320,12 +319,11 @@ count = buffer[1]; if (length < count + 2) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 2 - count: count]; + *object = [OFData dataWithItems: buffer + 2 count: count]; return count + 2; case 0xC5: /* bin 16 */ if (length < 3) @throw [OFTruncatedDataException exception]; @@ -333,12 +331,11 @@ count = readUInt16(buffer + 1); if (length < count + 3) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 3 - count: count]; + *object = [OFData dataWithItems: buffer + 3 count: count]; return count + 3; case 0xC6: /* bin 32 */ if (length < 5) @throw [OFTruncatedDataException exception]; @@ -346,12 +343,11 @@ count = readUInt32(buffer + 1); if (length < count + 5) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 5 - count: count]; + *object = [OFData dataWithItems: buffer + 5 count: count]; return count + 5; /* Extensions */ case 0xC7: /* ext 8 */ if (length < 3) @@ -360,12 +356,11 @@ count = buffer[1]; if (length < count + 3) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 3 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 3 count: count]; @try { *object = createExtension(buffer[2], data); } @finally { [data release]; } @@ -378,12 +373,11 @@ count = readUInt16(buffer + 1); if (length < count + 4) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 4 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 4 count: count]; @try { *object = createExtension(buffer[3], data); } @finally { [data release]; } @@ -396,12 +390,11 @@ count = readUInt32(buffer + 1); if (length < count + 6) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 6 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 6 count: count]; @try { *object = createExtension(buffer[5], data); } @finally { [data release]; } @@ -409,12 +402,11 @@ return count + 6; case 0xD4: /* fixext 1 */ if (length < 3) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 1]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 1]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -422,12 +414,11 @@ return 3; case 0xD5: /* fixext 2 */ if (length < 4) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 2]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 2]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -435,12 +426,11 @@ return 4; case 0xD6: /* fixext 4 */ if (length < 6) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 4]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 4]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -448,12 +438,11 @@ return 6; case 0xD7: /* fixext 8 */ if (length < 10) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 8]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 8]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -461,12 +450,11 @@ return 10; case 0xD8: /* fixext 16 */ if (length < 18) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 16]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 16]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; }