Skip to content

Commit 2c4665d

Browse files
billyquithSiegeLord
authored andcommitted
Prefix Allegro macros to avoid clashes with user code.
- prefix/namespace macros
1 parent 2a3914a commit 2c4665d

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

addons/image/png.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr,
288288

289289
case 24:
290290
for (i = 0; i < width; i++) {
291-
uint32_t pix = READ3BYTES(ptr);
291+
uint32_t pix = AL_READ3BYTES(ptr);
292292
ptr += 3;
293293
*(dest++) = pix & 0xff;
294294
*(dest++) = (pix >> 8) & 0xff;

include/allegro5/internal/aintern_pixels.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
} \
5858
\
5959
case ALLEGRO_PIXEL_FORMAT_RGB_888: { \
60-
uint32_t _gp_pixel = READ3BYTES(data); \
60+
uint32_t _gp_pixel = AL_READ3BYTES(data); \
6161
_AL_MAP_RGBA(color, \
6262
(_gp_pixel & 0xFF0000) >> 16, \
6363
(_gp_pixel & 0x00FF00) >> 8, \
@@ -141,7 +141,7 @@
141141
} \
142142
\
143143
case ALLEGRO_PIXEL_FORMAT_BGR_888: { \
144-
uint32_t _gp_pixel = READ3BYTES(data); \
144+
uint32_t _gp_pixel = AL_READ3BYTES(data); \
145145
_AL_MAP_RGBA(color, \
146146
(_gp_pixel & 0x000000FF) >> 0, \
147147
(_gp_pixel & 0x0000FF00) >> 8, \
@@ -306,7 +306,7 @@
306306
_pp_pixel = _al_fast_float_to_int(color.r * 255) << 16; \
307307
_pp_pixel |= _al_fast_float_to_int(color.g * 255) << 8; \
308308
_pp_pixel |= _al_fast_float_to_int(color.b * 255); \
309-
WRITE3BYTES(data, _pp_pixel); \
309+
AL_WRITE3BYTES(data, _pp_pixel); \
310310
if (advance) \
311311
data += 3; \
312312
break; \
@@ -373,7 +373,7 @@
373373
_pp_pixel = _al_fast_float_to_int(color.b * 0xff) << 16; \
374374
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \
375375
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff); \
376-
WRITE3BYTES(data, _pp_pixel); \
376+
AL_WRITE3BYTES(data, _pp_pixel); \
377377
if (advance) \
378378
data += 3; \
379379
break; \

include/allegro5/internal/alconfig.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,23 @@
226226
/* endian-independent 3-byte accessor macros */
227227
#ifdef ALLEGRO_LITTLE_ENDIAN
228228

229-
#define READ3BYTES(p) ((*(unsigned char *)(p)) \
230-
| (*((unsigned char *)(p) + 1) << 8) \
231-
| (*((unsigned char *)(p) + 2) << 16))
229+
#define AL_READ3BYTES(p) ((*(unsigned char *)(p)) \
230+
| (*((unsigned char *)(p) + 1) << 8) \
231+
| (*((unsigned char *)(p) + 2) << 16))
232232

233-
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c)), \
234-
(*((unsigned char *)(p) + 1) = (c) >> 8), \
235-
(*((unsigned char *)(p) + 2) = (c) >> 16))
233+
#define AL_WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c)), \
234+
(*((unsigned char *)(p) + 1) = (c) >> 8), \
235+
(*((unsigned char *)(p) + 2) = (c) >> 16))
236236

237237
#elif defined ALLEGRO_BIG_ENDIAN
238238

239-
#define READ3BYTES(p) ((*(unsigned char *)(p) << 16) \
240-
| (*((unsigned char *)(p) + 1) << 8) \
241-
| (*((unsigned char *)(p) + 2)))
239+
#define AL_READ3BYTES(p) ((*(unsigned char *)(p) << 16) \
240+
| (*((unsigned char *)(p) + 1) << 8) \
241+
| (*((unsigned char *)(p) + 2)))
242242

243-
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c) >> 16), \
244-
(*((unsigned char *)(p) + 1) = (c) >> 8), \
245-
(*((unsigned char *)(p) + 2) = (c)))
243+
#define AL_WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c) >> 16), \
244+
(*((unsigned char *)(p) + 1) = (c) >> 8), \
245+
(*((unsigned char *)(p) + 2) = (c)))
246246

247247
#else
248248
#error endianess not defined

src/memdraw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color)
9696
}
9797

9898
case 3: {
99-
int pixel_value = READ3BYTES(line_ptr);
99+
int pixel_value = AL_READ3BYTES(line_ptr);
100100
for (y = y1; y < y1 + h; y++) {
101101
unsigned char *data = (unsigned char *)line_ptr;
102102
if (pixel_value == 0) { /* fast path */

0 commit comments

Comments
 (0)