Tabified.

Indent adjusted.
This commit is contained in:
Takatoshi Kondo
2013-09-04 17:59:16 +09:00
parent 27629a8dd6
commit 7ce8abe5d6

View File

@@ -112,7 +112,7 @@ private:
template <typename Stream, typename T>
inline void pack(Stream* s, const T& v)
{
packer<Stream>(s).pack(v);
packer<Stream>(*s).pack(v);
}
template <typename Stream, typename T>
@@ -121,23 +121,6 @@ inline void pack(Stream& s, const T& v)
packer<Stream>(s).pack(v);
}
#define msgpack_pack_inline_func(name) \
template <typename Stream> \
inline void packer<Stream>::_pack ## name
#define msgpack_pack_inline_func_cint(name) \
template <typename Stream> \
inline void packer<Stream>::_pack ## name
#define msgpack_pack_inline_func_fixint(name) \
template <typename Stream> \
inline void packer<Stream>::_pack_fix ## name
#define msgpack_pack_user Stream&
#define msgpack_pack_append_buffer append_buffer
#if defined(__LITTLE_ENDIAN__)
#define TAKE8_8(d) ((uint8_t*)&d)[0]
#define TAKE8_16(d) ((uint8_t*)&d)[0]
@@ -197,8 +180,8 @@ template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_uint8(uint8_t d)
{
unsigned char buf[2] = {0xcc, TAKE8_8(d)};
append_buffer(buf, 2);
return *this;
append_buffer(buf, 2);
return *this;
}
template <typename Stream>
@@ -206,8 +189,8 @@ inline packer<Stream>& packer<Stream>::pack_fix_uint16(uint16_t d)
{
unsigned char buf[3];
buf[0] = 0xcd; _msgpack_store16(&buf[1], d);
append_buffer(buf, 3);
return *this;
append_buffer(buf, 3);
return *this;
}
template <typename Stream>
@@ -215,8 +198,8 @@ inline packer<Stream>& packer<Stream>::pack_fix_uint32(uint32_t d)
{
unsigned char buf[5];
buf[0] = 0xce; _msgpack_store32(&buf[1], d);
append_buffer(buf, 5);
return *this;
append_buffer(buf, 5);
return *this;
}
template <typename Stream>
@@ -224,16 +207,16 @@ inline packer<Stream>& packer<Stream>::pack_fix_uint64(uint64_t d)
{
unsigned char buf[9];
buf[0] = 0xcf; _msgpack_store64(&buf[1], d);
append_buffer(buf, 9);
return *this;
append_buffer(buf, 9);
return *this;
}
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_int8(int8_t d)
{
unsigned char buf[2] = {0xd0, TAKE8_8(d)};
append_buffer(buf, 2);
return *this;
append_buffer(buf, 2);
return *this;
}
template <typename Stream>
@@ -241,8 +224,8 @@ inline packer<Stream>& packer<Stream>::pack_fix_int16(int16_t d)
{
unsigned char buf[3];
buf[0] = 0xd1; _msgpack_store16(&buf[1], d);
append_buffer(buf, 3);
return *this;
append_buffer(buf, 3);
return *this;
}
template <typename Stream>
@@ -250,8 +233,8 @@ inline packer<Stream>& packer<Stream>::pack_fix_int32(int32_t d)
{
unsigned char buf[5];
buf[0] = 0xd2; _msgpack_store32(&buf[1], d);
append_buffer(buf, 5);
return *this;
append_buffer(buf, 5);
return *this;
}
template <typename Stream>
@@ -259,8 +242,8 @@ inline packer<Stream>& packer<Stream>::pack_fix_int64(int64_t d)
{
unsigned char buf[9];
buf[0] = 0xd3; _msgpack_store64(&buf[1], d);
append_buffer(buf, 9);
return *this;
append_buffer(buf, 9);
return *this;
}
@@ -294,13 +277,13 @@ inline packer<Stream>& packer<Stream>::pack_short(short d)
#endif
#else
if(sizeof(short) == 2) {
pack_real_int16(d);
} else if(sizeof(short) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
if(sizeof(short) == 2) {
pack_real_int16(d);
} else if(sizeof(short) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
#endif
return *this;
}
@@ -327,13 +310,13 @@ inline packer<Stream>& packer<Stream>::pack_int(int d)
#endif
#else
if(sizeof(int) == 2) {
pack_real_int16(d);
} else if(sizeof(int) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
if(sizeof(int) == 2) {
pack_real_int16(d);
} else if(sizeof(int) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
#endif
return *this;
}
@@ -360,13 +343,13 @@ inline packer<Stream>& packer<Stream>::pack_long(long d)
#endif
#else
if(sizeof(long) == 2) {
pack_real_int16(d);
} else if(sizeof(long) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
if(sizeof(long) == 2) {
pack_real_int16(d);
} else if(sizeof(long) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
#endif
return *this;
}
@@ -393,13 +376,13 @@ inline packer<Stream>& packer<Stream>::pack_long_long(long long d)
#endif
#else
if(sizeof(long long) == 2) {
pack_real_int16(d);
} else if(sizeof(long long) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
if(sizeof(long long) == 2) {
pack_real_int16(d);
} else if(sizeof(long long) == 4) {
pack_real_int32(d);
} else {
pack_real_int64(d);
}
#endif
return *this;
}
@@ -431,13 +414,13 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_short(unsigned short d)
#endif
#else
if(sizeof(unsigned short) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned short) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
if(sizeof(unsigned short) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned short) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
#endif
return *this;
}
@@ -464,13 +447,13 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_int(unsigned int d)
#endif
#else
if(sizeof(unsigned int) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned int) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
if(sizeof(unsigned int) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned int) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
#endif
return *this;
}
@@ -497,13 +480,13 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_long(unsigned long d)
#endif
#else
if(sizeof(unsigned long) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned long) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
if(sizeof(unsigned long) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned long) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
#endif
return *this;
}
@@ -530,13 +513,13 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_long_long(unsigned long lon
#endif
#else
if(sizeof(unsigned long long) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned long long) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
if(sizeof(unsigned long long) == 2) {
pack_real_uint16(d);
} else if(sizeof(unsigned long long) == 4) {
pack_real_uint32(d);
} else {
pack_real_uint64(d);
}
#endif
return *this;
}
@@ -561,10 +544,10 @@ inline packer<Stream>& packer<Stream>::pack_double(double d)
unsigned char buf[9];
buf[0] = 0xcb;
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
_msgpack_store64(&buf[1], mem.i);
_msgpack_store64(&buf[1], mem.i);
append_buffer(buf, 9);
return *this;
}