change read_xxx_xxx methods to not return
input value by ref.
This commit is contained in:
parent
cad0261e55
commit
7f91fb7b1e
1 changed files with 6 additions and 12 deletions
|
@ -74,7 +74,7 @@ typedef boost::uint8_t byte;
|
|||
|
||||
|
||||
// read int16_t NDR (little endian)
|
||||
inline boost::int16_t& read_int16_ndr(const char* data, boost::int16_t & val)
|
||||
inline void read_int16_ndr(const char* data, boost::int16_t & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
std::memcpy(&val,data,2);
|
||||
|
@ -82,11 +82,10 @@ inline boost::int16_t& read_int16_ndr(const char* data, boost::int16_t & val)
|
|||
val = (data[0]&0xff) |
|
||||
((data[1]&0xff)<<8);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
// read int32_t NDR (little endian)
|
||||
inline boost::int32_t& read_int32_ndr(const char* data, boost::int32_t & val)
|
||||
inline void read_int32_ndr(const char* data, boost::int32_t & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
std::memcpy(&val,data,4);
|
||||
|
@ -96,11 +95,10 @@ inline boost::int32_t& read_int32_ndr(const char* data, boost::int32_t & val)
|
|||
((data[2]&0xff)<<16) |
|
||||
((data[3]&0xff)<<24);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
// read double NDR (little endian)
|
||||
inline double& read_double_ndr(const char* data, double & val)
|
||||
inline void read_double_ndr(const char* data, double & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
std::memcpy(&val,&data[0],8);
|
||||
|
@ -115,33 +113,30 @@ inline double& read_double_ndr(const char* data, double & val)
|
|||
((boost::int64_t)data[7] & 0xff) << 56 ;
|
||||
std::memcpy(&val,&bits,8);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
// read int16_t XDR (big endian)
|
||||
inline boost::int16_t& read_int16_xdr(const char* data, boost::int16_t & val)
|
||||
inline void read_int16_xdr(const char* data, boost::int16_t & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
val = (data[3]&0xff) | ((data[2]&0xff)<<8);
|
||||
#else
|
||||
std::memcpy(&val,data,2);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
// read int32_t XDR (big endian)
|
||||
inline boost::int32_t& read_int32_xdr(const char* data, boost::int32_t & val)
|
||||
inline void read_int32_xdr(const char* data, boost::int32_t & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
val = (data[3]&0xff) | ((data[2]&0xff)<<8) | ((data[1]&0xff)<<16) | ((data[0]&0xff)<<24);
|
||||
#else
|
||||
std::memcpy(&val,data,4);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
// read double XDR (big endian)
|
||||
inline double& read_double_xdr(const char* data, double & val)
|
||||
inline void read_double_xdr(const char* data, double & val)
|
||||
{
|
||||
#ifndef MAPNIK_BIG_ENDIAN
|
||||
boost::int64_t bits = ((boost::int64_t)data[7] & 0xff) |
|
||||
|
@ -156,7 +151,6 @@ inline double& read_double_xdr(const char* data, double & val)
|
|||
#else
|
||||
std::memcpy(&val,&data[0],8);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
|
Loading…
Reference in a new issue