From 4f20234c7884cfdc4b0abc8350e8af70d2afe302 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 12 Feb 1999 15:34:57 +0000 Subject: const issues with byte mod / byte read macros. (This used to be commit 98ecb88704c3db26de8b548f4f1526f23401a161) --- source3/include/byteorder.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h index 2a615e9dde..113de607fb 100644 --- a/source3/include/byteorder.h +++ b/source3/include/byteorder.h @@ -154,16 +154,21 @@ it also defines lots of intermediate macros, just ignore those :-) */ /* get single value from an SMB buffer */ -#define SVAL(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) -#define IVAL(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) -#define SVALS(buf,pos) (*(int16 *)((char *)(buf) + (pos))) -#define IVALS(buf,pos) (*(int32 *)((char *)(buf) + (pos))) +#define SVAL(buf,pos) (*(const uint16 *)((const char *)(buf) + (pos))) +#define IVAL(buf,pos) (*(const uint32 *)((const char *)(buf) + (pos))) +#define SVALS(buf,pos) (*(const int16 *)((const char *)(buf) + (pos))) +#define IVALS(buf,pos) (*(const int32 *)((const char *)(buf) + (pos))) + +#define SVALMOD(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) +#define IVALMOD(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) +#define SVALMODS(buf,pos) (*(int16 *)((char *)(buf) + (pos))) +#define IVALMODS(buf,pos) (*(int32 *)((char *)(buf) + (pos))) /* store single value in an SMB buffer */ -#define SSVAL(buf,pos,val) SVAL(buf,pos)=((uint16)(val)) -#define SIVAL(buf,pos,val) IVAL(buf,pos)=((uint32)(val)) -#define SSVALS(buf,pos,val) SVALS(buf,pos)=((int16)(val)) -#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val)) +#define SSVAL(buf,pos,val) SVALMOD(buf,pos)=((uint16)(val)) +#define SIVAL(buf,pos,val) IVALMOD(buf,pos)=((uint32)(val)) +#define SSVALS(buf,pos,val) SVALMODS(buf,pos)=((int16)(val)) +#define SIVALS(buf,pos,val) IVALMODS(buf,pos)=((int32)(val)) #endif -- cgit