]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:util: Use _DATA_BYTE(_CONST) from bytearray.h
authorAndreas Schneider <asn@samba.org>
Thu, 20 Dec 2018 10:21:00 +0000 (11:21 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 21 Feb 2020 02:09:33 +0000 (02:09 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/byteorder.h

index d58e6d0b7d7c730a4ddd29db6053d7f9316361d5..8db14d3ab8a8aa8b9ffe8991ddaf99d29b7c8d5a 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef _BYTEORDER_H
 #define _BYTEORDER_H
 
+#include "bytearray.h"
+
 /*
    This file implements macros for machine independent short and 
    int manipulation
@@ -88,8 +90,8 @@ it also defines lots of intermediate macros, just ignore those :-)
 */
 
 
-#define CVAL(buf,pos) ((unsigned int)(((const uint8_t *)(buf))[pos]))
-#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */
+#define CVAL(buf,pos) ((uint32_t)_DATA_BYTE_CONST(buf, pos))
+#define CVAL_NC(buf,pos) _DATA_BYTE(buf, pos) /* Non-const version of CVAL */
 #define PVAL(buf,pos) (CVAL(buf,pos))
 #define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))