Commit ff794171 authored by Michael Niedermayer's avatar Michael Niedermayer

Do not cast const away.

Originally committed as revision 11707 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b1f5712e
...@@ -38,9 +38,9 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -38,9 +38,9 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#else /* __GNUC__ */ #else /* __GNUC__ */
#define AV_RN16(a) (*((uint16_t*)(a))) #define AV_RN16(a) (*((const uint16_t*)(a)))
#define AV_RN32(a) (*((uint32_t*)(a))) #define AV_RN32(a) (*((const uint32_t*)(a)))
#define AV_RN64(a) (*((uint64_t*)(a))) #define AV_RN64(a) (*((const uint64_t*)(a)))
#define AV_WN16(a, b) *((uint16_t*)(a)) = (b) #define AV_WN16(a, b) *((uint16_t*)(a)) = (b)
#define AV_WN32(a, b) *((uint32_t*)(a)) = (b) #define AV_WN32(a, b) *((uint32_t*)(a)) = (b)
...@@ -49,7 +49,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -49,7 +49,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#endif /* !__GNUC__ */ #endif /* !__GNUC__ */
/* endian macros */ /* endian macros */
#define AV_RB8(x) (((uint8_t*)(x))[0]) #define AV_RB8(x) (((const uint8_t*)(x))[0])
#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
#define AV_RL8(x) AV_RB8(x) #define AV_RL8(x) AV_RB8(x)
...@@ -70,29 +70,29 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -70,29 +70,29 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
# define AV_WL16(p, d) AV_WN16(p, d) # define AV_WL16(p, d) AV_WN16(p, d)
# endif # endif
#else /* HAVE_FAST_UNALIGNED */ #else /* HAVE_FAST_UNALIGNED */
#define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | ((const uint8_t*)(x))[1])
#define AV_WB16(p, d) do { \ #define AV_WB16(p, d) do { \
((uint8_t*)(p))[1] = (d); \ ((uint8_t*)(p))[1] = (d); \
((uint8_t*)(p))[0] = (d)>>8; } while(0) ((uint8_t*)(p))[0] = (d)>>8; } while(0)
#define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | \ #define AV_RL16(x) ((((const uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[0]) ((const uint8_t*)(x))[0])
#define AV_WL16(p, d) do { \ #define AV_WL16(p, d) do { \
((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; } while(0) ((uint8_t*)(p))[1] = (d)>>8; } while(0)
#endif #endif
#define AV_RB24(x) ((((uint8_t*)(x))[0] << 16) | \ #define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \
(((uint8_t*)(x))[1] << 8) | \ (((const uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[2]) ((const uint8_t*)(x))[2])
#define AV_WB24(p, d) do { \ #define AV_WB24(p, d) do { \
((uint8_t*)(p))[2] = (d); \ ((uint8_t*)(p))[2] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[1] = (d)>>8; \
((uint8_t*)(p))[0] = (d)>>16; } while(0) ((uint8_t*)(p))[0] = (d)>>16; } while(0)
#define AV_RL24(x) ((((uint8_t*)(x))[2] << 16) | \ #define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \
(((uint8_t*)(x))[1] << 8) | \ (((const uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[0]) ((const uint8_t*)(x))[0])
#define AV_WL24(p, d) do { \ #define AV_WL24(p, d) do { \
((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[1] = (d)>>8; \
...@@ -113,20 +113,20 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -113,20 +113,20 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
# define AV_WL32(p, d) AV_WN32(p, d) # define AV_WL32(p, d) AV_WN32(p, d)
# endif # endif
#else /* HAVE_FAST_UNALIGNED */ #else /* HAVE_FAST_UNALIGNED */
#define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ #define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
(((uint8_t*)(x))[1] << 16) | \ (((const uint8_t*)(x))[1] << 16) | \
(((uint8_t*)(x))[2] << 8) | \ (((const uint8_t*)(x))[2] << 8) | \
((uint8_t*)(x))[3]) ((const uint8_t*)(x))[3])
#define AV_WB32(p, d) do { \ #define AV_WB32(p, d) do { \
((uint8_t*)(p))[3] = (d); \ ((uint8_t*)(p))[3] = (d); \
((uint8_t*)(p))[2] = (d)>>8; \ ((uint8_t*)(p))[2] = (d)>>8; \
((uint8_t*)(p))[1] = (d)>>16; \ ((uint8_t*)(p))[1] = (d)>>16; \
((uint8_t*)(p))[0] = (d)>>24; } while(0) ((uint8_t*)(p))[0] = (d)>>24; } while(0)
#define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \ #define AV_RL32(x) ((((const uint8_t*)(x))[3] << 24) | \
(((uint8_t*)(x))[2] << 16) | \ (((const uint8_t*)(x))[2] << 16) | \
(((uint8_t*)(x))[1] << 8) | \ (((const uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[0]) ((const uint8_t*)(x))[0])
#define AV_WL32(p, d) do { \ #define AV_WL32(p, d) do { \
((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[1] = (d)>>8; \
...@@ -149,14 +149,14 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -149,14 +149,14 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
# define AV_WL64(p, d) AV_WN64(p, d) # define AV_WL64(p, d) AV_WN64(p, d)
# endif # endif
#else /* HAVE_FAST_UNALIGNED */ #else /* HAVE_FAST_UNALIGNED */
#define AV_RB64(x) (((uint64_t)((uint8_t*)(x))[0] << 56) | \ #define AV_RB64(x) (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
((uint64_t)((uint8_t*)(x))[1] << 48) | \ ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
((uint64_t)((uint8_t*)(x))[2] << 40) | \ ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
((uint64_t)((uint8_t*)(x))[3] << 32) | \ ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
((uint64_t)((uint8_t*)(x))[4] << 24) | \ ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
((uint64_t)((uint8_t*)(x))[5] << 16) | \ ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
((uint64_t)((uint8_t*)(x))[6] << 8) | \ ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
(uint64_t)((uint8_t*)(x))[7]) (uint64_t)((const uint8_t*)(x))[7])
#define AV_WB64(p, d) do { \ #define AV_WB64(p, d) do { \
((uint8_t*)(p))[7] = (d); \ ((uint8_t*)(p))[7] = (d); \
((uint8_t*)(p))[6] = (d)>>8; \ ((uint8_t*)(p))[6] = (d)>>8; \
...@@ -167,14 +167,14 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ...@@ -167,14 +167,14 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
((uint8_t*)(p))[1] = (d)>>48; \ ((uint8_t*)(p))[1] = (d)>>48; \
((uint8_t*)(p))[0] = (d)>>56; } while(0) ((uint8_t*)(p))[0] = (d)>>56; } while(0)
#define AV_RL64(x) (((uint64_t)((uint8_t*)(x))[7] << 56) | \ #define AV_RL64(x) (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
((uint64_t)((uint8_t*)(x))[6] << 48) | \ ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
((uint64_t)((uint8_t*)(x))[5] << 40) | \ ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
((uint64_t)((uint8_t*)(x))[4] << 32) | \ ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
((uint64_t)((uint8_t*)(x))[3] << 24) | \ ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
((uint64_t)((uint8_t*)(x))[2] << 16) | \ ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
((uint64_t)((uint8_t*)(x))[1] << 8) | \ ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
(uint64_t)((uint8_t*)(x))[0]) (uint64_t)((const uint8_t*)(x))[0])
#define AV_WL64(p, d) do { \ #define AV_WL64(p, d) do { \
((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[1] = (d)>>8; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment