qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 037/111] Correct invalid use of "const void *" with


From: Bryce Lanham
Subject: [Qemu-devel] [PATCH 037/111] Correct invalid use of "const void *" with "const uint8_t *"
Date: Wed, 17 Aug 2011 15:46:42 -0500

From: Laurent Vivier <address@hidden>

When cpu-all.h is used with m68k-tester (an m68k testsuite),
the header is compiled with g++ and reports the following errors:

../qemu-m68k/cpu-all.h: In function ‘int lduw_be_p(const void*)’:
../qemu-m68k/cpu-all.h:414: error: invalid conversion from ‘const void*’ to 
‘const uint8_t*’
../qemu-m68k/cpu-all.h: In function ‘int ldsw_be_p(const void*)’:
../qemu-m68k/cpu-all.h:429: error: invalid conversion from ‘const void*’ to 
‘const uint8_t*’

This patch casts the variable to "const uint8_t*"

Signed-off-by: Laurent Vivier <address@hidden>
---
 bswap.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bswap.h b/bswap.h
index f41bebe..13fd5cf 100644
--- a/bswap.h
+++ b/bswap.h
@@ -533,7 +533,7 @@ static inline int lduw_be_p(const void *ptr)
                   : "m" (*(uint16_t *)ptr));
     return val;
 #else
-    const uint8_t *b = ptr;
+    const uint8_t *b = (const uint8_t *)ptr;
     return ((b[0] << 8) | b[1]);
 #endif
 }
@@ -548,7 +548,7 @@ static inline int ldsw_be_p(const void *ptr)
                   : "m" (*(uint16_t *)ptr));
     return (int16_t)val;
 #else
-    const uint8_t *b = ptr;
+    const uint8_t *b = (const uint8_t *)ptr;
     return (int16_t)((b[0] << 8) | b[1]);
 #endif
 }
@@ -563,7 +563,7 @@ static inline int ldl_be_p(const void *ptr)
                   : "m" (*(uint32_t *)ptr));
     return val;
 #else
-    const uint8_t *b = ptr;
+    const uint8_t *b = (const uint8_t *)ptr;
     return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
 #endif
 }
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]