Constified some pointers.
committer: mfx <mfx> 976877986 +0000
This commit is contained in:
parent
376db3edca
commit
2ed6608f08
20
src/bele.h
20
src/bele.h
@ -36,7 +36,7 @@
|
||||
|
||||
inline unsigned short get_be16(const void *bb, int off=0)
|
||||
{
|
||||
const upx_bytep b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
const upx_bytep const b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
unsigned v;
|
||||
v = (unsigned) b[1] << 0;
|
||||
v |= (unsigned) b[0] << 8;
|
||||
@ -45,7 +45,7 @@ inline unsigned short get_be16(const void * bb, int off=0)
|
||||
|
||||
inline void set_be16(void *bb, unsigned v, int off=0)
|
||||
{
|
||||
upx_bytep b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
upx_bytep const b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
b[1] = (unsigned char) (v >> 0);
|
||||
b[0] = (unsigned char) (v >> 8);
|
||||
}
|
||||
@ -53,7 +53,7 @@ inline void set_be16(void * bb, unsigned v, int off=0)
|
||||
|
||||
inline unsigned get_be32(const void *bb, int off=0)
|
||||
{
|
||||
const upx_bytep b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
const upx_bytep const b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
unsigned v;
|
||||
v = (unsigned) b[3] << 0;
|
||||
v |= (unsigned) b[2] << 8;
|
||||
@ -64,7 +64,7 @@ inline unsigned get_be32(const void * bb, int off=0)
|
||||
|
||||
inline void set_be32(void *bb, unsigned v, int off=0)
|
||||
{
|
||||
upx_bytep b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
upx_bytep const b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
b[3] = (unsigned char) (v >> 0);
|
||||
b[2] = (unsigned char) (v >> 8);
|
||||
b[1] = (unsigned char) (v >> 16);
|
||||
@ -74,7 +74,7 @@ inline void set_be32(void * bb, unsigned v, int off=0)
|
||||
|
||||
inline unsigned short get_le16(const void *bb, int off=0)
|
||||
{
|
||||
const upx_bytep b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
const upx_bytep const b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
unsigned v;
|
||||
#if defined(__i386__)
|
||||
v = * (const unsigned short *) b;
|
||||
@ -87,7 +87,7 @@ inline unsigned short get_le16(const void * bb, int off=0)
|
||||
|
||||
inline void set_le16(void *bb, unsigned v, int off=0)
|
||||
{
|
||||
upx_bytep b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
upx_bytep const b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
#if defined(__i386__)
|
||||
(* (unsigned short *) b) = (unsigned short) v;
|
||||
#else
|
||||
@ -99,7 +99,7 @@ inline void set_le16(void * bb, unsigned v, int off=0)
|
||||
|
||||
inline unsigned get_le24(const void *bb, int off=0)
|
||||
{
|
||||
const upx_bytep b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
const upx_bytep const b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
unsigned v;
|
||||
v = (unsigned) b[0] << 0;
|
||||
v |= (unsigned) b[1] << 8;
|
||||
@ -109,7 +109,7 @@ inline unsigned get_le24(const void * bb, int off=0)
|
||||
|
||||
inline void set_le24(void *bb, unsigned v, int off=0)
|
||||
{
|
||||
upx_bytep b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
upx_bytep const b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
b[0] = (unsigned char) (v >> 0);
|
||||
b[1] = (unsigned char) (v >> 8);
|
||||
b[2] = (unsigned char) (v >> 16);
|
||||
@ -118,7 +118,7 @@ inline void set_le24(void * bb, unsigned v, int off=0)
|
||||
|
||||
inline unsigned get_le32(const void *bb, int off=0)
|
||||
{
|
||||
const upx_bytep b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
const upx_bytep const b = reinterpret_cast<const upx_bytep>(bb) + off;
|
||||
unsigned v;
|
||||
#if defined(__i386__)
|
||||
v = * (const unsigned *) b;
|
||||
@ -133,7 +133,7 @@ inline unsigned get_le32(const void * bb, int off=0)
|
||||
|
||||
inline void set_le32(void *bb, unsigned v, int off=0)
|
||||
{
|
||||
upx_bytep b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
upx_bytep const b = reinterpret_cast<upx_bytep>(bb) + off;
|
||||
#if defined(__i386__)
|
||||
(* (unsigned *) b) = v;
|
||||
#else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user