[AD] const problems and patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I tried to compile latest (03.08.2000) CVS on IRIX. It generates a lot of
warnings about discarding const in include/allegro/alinline.h - there are
inline versions of some functions in C which are in asm on i386. There is
also a lot of const-related warnings all around the code. Attached patch
should make it ok. I lost a track of those const-related patches so there
is maybe some patch flying around with same functionality - in that case,
simply ignore my post.

Have a nice day.

Stepan Roh

P.S.: It seems to me that my very old "Buggy IRIX linker detection patch"
was not applied to CVS. George, you forgot, don't you? :-) It applies
cleanly to the recent CVS. I can send it again, if you lost it.
diff -U 3 --recursive allegro.orig/include/allegro/alinline.h allegro/include/allegro/alinline.h
--- allegro.orig/include/allegro/alinline.h	Tue Aug  1 14:34:25 2000
+++ allegro/include/allegro/alinline.h	Wed Aug 30 22:18:00 2000
@@ -79,8 +79,8 @@
 })
 
 
-typedef AL_METHOD(unsigned long, _BMP_BANK_SWITCHER, (BITMAP *bmp, int line));
-typedef AL_METHOD(void, _BMP_UNBANK_SWITCHER, (BITMAP *bmp));
+typedef AL_METHOD(unsigned long, _BMP_BANK_SWITCHER, (AL_CONST BITMAP *bmp, int line));
+typedef AL_METHOD(void, _BMP_UNBANK_SWITCHER, (AL_CONST BITMAP *bmp));
 
 
 AL_INLINE(unsigned long, bmp_write_line, (BITMAP *bmp, int line),
@@ -90,14 +90,14 @@
 })
 
 
-AL_INLINE(unsigned long, bmp_read_line, (BITMAP *bmp, int line),
+AL_INLINE(unsigned long, bmp_read_line, (AL_CONST BITMAP *bmp, int line),
 {
    _BMP_BANK_SWITCHER switcher = (_BMP_BANK_SWITCHER)bmp->read_bank;
    return switcher(bmp, line);
 })
 
 
-AL_INLINE(void, bmp_unwrite_line, (BITMAP *bmp),
+AL_INLINE(void, bmp_unwrite_line, (AL_CONST BITMAP *bmp),
 {
    _BMP_UNBANK_SWITCHER switcher = (_BMP_UNBANK_SWITCHER)bmp->vtable->unwrite_bank;
    switcher(bmp);
diff -U 3 --recursive allegro.orig/src/c/ccsprite.c allegro/src/c/ccsprite.c
--- allegro.orig/src/c/ccsprite.c	Sun May 14 22:17:19 2000
+++ allegro/src/c/ccsprite.c	Wed Aug 30 22:26:04 2000
@@ -23,7 +23,7 @@
 /* get_compiled_sprite:
  *  Creates a compiled sprite based on the specified bitmap.
  */
-COMPILED_SPRITE *get_compiled_sprite(BITMAP *bitmap, int planar)
+COMPILED_SPRITE *get_compiled_sprite(AL_CONST BITMAP *bitmap, int planar)
 {
    return get_rle_sprite(bitmap);
 }
@@ -44,7 +44,7 @@
  *  Draws a compiled sprite onto the specified bitmap at the specified
  *  position.
  */
-void draw_compiled_sprite(BITMAP *dst, COMPILED_SPRITE *src, int x, int y)
+void draw_compiled_sprite(BITMAP *dst, AL_CONST COMPILED_SPRITE *src, int x, int y)
 {
    return draw_rle_sprite(dst, src, x, y);
 }
diff -U 3 --recursive allegro.orig/src/c/cgfx.h allegro/src/c/cgfx.h
--- allegro.orig/src/c/cgfx.h	Sun May 14 22:17:19 2000
+++ allegro/src/c/cgfx.h	Wed Aug 30 22:28:42 2000
@@ -75,7 +75,7 @@
 /* _linear_getpixel:
  *  Reads a pixel from a linear bitmap.
  */
-int FUNC_LINEAR_GETPIXEL(BITMAP *src, int sx, int sy)
+int FUNC_LINEAR_GETPIXEL(AL_CONST BITMAP *src, int sx, int sy)
 {
    if ((sx < 0) || (sx >= src->w) || (sy < 0) || (sy >= src->h))
       return -1;
diff -U 3 --recursive allegro.orig/src/c/cmisc.c allegro/src/c/cmisc.c
--- allegro.orig/src/c/cmisc.c	Sun May 14 22:17:19 2000
+++ allegro/src/c/cmisc.c	Wed Aug 30 22:33:40 2000
@@ -51,7 +51,7 @@
 /* apply_matrix_f:
  *  Floating point vector by matrix multiplication routine.
  */
-void apply_matrix_f(MATRIX_f *m, float x, float y, float z,
+void apply_matrix_f(AL_CONST MATRIX_f *m, float x, float y, float z,
 		    float *xout, float *yout, float *zout)
 {
 #define CALC_ROW(n) (x * m->v[(n)][0] + y * m->v[(n)][1] + z * m->v[(n)][2] + m->t[(n)])
diff -U 3 --recursive allegro.orig/src/c/cspr.h allegro/src/c/cspr.h
--- allegro.orig/src/c/cspr.h	Thu Aug 10 14:11:50 2000
+++ allegro/src/c/cspr.h	Wed Aug 30 22:38:15 2000
@@ -22,7 +22,7 @@
  *  Draws a sprite onto a linear bitmap at the specified x, y position,
  *  using a masked drawing mode where zero pixels are not output.
  */
-void FUNC_LINEAR_DRAW_SPRITE(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_SPRITE(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -98,7 +98,7 @@
  *  Draws a 256 coor sprite onto a linear bitmap at the specified x, y
  *  position, using a masked drawing mode where zero pixels are not output.
  */
-void FUNC_LINEAR_DRAW_256_SPRITE(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_256_SPRITE(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -176,7 +176,7 @@
 /* _linear_draw_sprite_v_flip:
  *  Draws a sprite to a linear bitmap, flipping vertically.
  */
-void FUNC_LINEAR_DRAW_SPRITE_V_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_SPRITE_V_FLIP(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -251,7 +251,7 @@
 /* _linear_draw_sprite_h_flip:
  *  Draws a sprite to a linear bitmap, flipping horizontally.
  */
-void FUNC_LINEAR_DRAW_SPRITE_H_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_SPRITE_H_FLIP(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -326,7 +326,7 @@
 /* _linear_draw_sprite_vh_flip:
  *  Draws a sprite to a linear bitmap, flipping both vertically and horizontally.
  */
-void FUNC_LINEAR_DRAW_SPRITE_VH_FLIP(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_SPRITE_VH_FLIP(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -403,7 +403,7 @@
 /* _linear_draw_trans_sprite:
  *  Draws a translucent sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_TRANS_SPRITE(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_TRANS_SPRITE(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -497,7 +497,7 @@
 /* _linear_draw_trans_rgba_sprite:
  *  Draws a translucent RGBA sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE(BITMAP *dst, BITMAP *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -561,7 +561,7 @@
 /* _linear_draw_lit_sprite:
  *  Draws a lit sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_LIT_SPRITE(BITMAP *dst, BITMAP *src, int dx, int dy, int color)
+void FUNC_LINEAR_DRAW_LIT_SPRITE(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy, int color)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -642,7 +642,7 @@
  *  For proportional font output onto a linear bitmap: uses the sprite as
  *  a mask, replacing all set pixels with the specified color.
  */
-void FUNC_LINEAR_DRAW_CHARACTER(BITMAP *dst, BITMAP *src, int dx, int dy, int color)
+void FUNC_LINEAR_DRAW_CHARACTER(BITMAP *dst, AL_CONST BITMAP *src, int dx, int dy, int color)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -722,7 +722,7 @@
 /* _linear_draw_rle_sprite:
  *  Draws an RLE sprite onto a linear bitmap at the specified position.
  */
-void FUNC_LINEAR_DRAW_RLE_SPRITE(BITMAP *dst, RLE_SPRITE *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_RLE_SPRITE(BITMAP *dst, AL_CONST RLE_SPRITE *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -907,7 +907,7 @@
 /* _linear_draw_trans_rle_sprite:
  *  Draws a translucent RLE sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE(BITMAP *dst, RLE_SPRITE *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE(BITMAP *dst, AL_CONST RLE_SPRITE *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -1107,7 +1107,7 @@
 /* _linear_draw_trans_rgba_rle_sprite:
  *  Draws a translucent RGBA RLE sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE(BITMAP *dst, RLE_SPRITE *src, int dx, int dy)
+void FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE(BITMAP *dst, AL_CONST RLE_SPRITE *src, int dx, int dy)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
@@ -1300,7 +1300,7 @@
 /* _linear_draw_lit_rle_sprite:
  *  Draws a tinted RLE sprite onto a linear bitmap.
  */
-void FUNC_LINEAR_DRAW_LIT_RLE_SPRITE(BITMAP *dst, RLE_SPRITE *src, int dx, int dy, int color)
+void FUNC_LINEAR_DRAW_LIT_RLE_SPRITE(BITMAP *dst, AL_CONST RLE_SPRITE *src, int dx, int dy, int color)
 {
    int x, y, w, h;
    int dxbeg, dybeg;
diff -U 3 --recursive allegro.orig/src/c/cstretch.c allegro/src/c/cstretch.c
--- allegro.orig/src/c/cstretch.c	Thu Jun 29 15:18:44 2000
+++ allegro/src/c/cstretch.c	Wed Aug 30 22:43:11 2000
@@ -227,7 +227,7 @@
 /*
  * Stretch blit work-horse.
  */
-static void _al_stretch_blit(BITMAP *src, BITMAP *dst,
+static void _al_stretch_blit(AL_CONST BITMAP *src, BITMAP *dst,
 			     int sx, int sy, int sw, int sh,
 			     int dx, int dy, int dw, int dh,
 			     int masked)
@@ -417,7 +417,7 @@
 /* stretch_blit:
  *  Opaque bitmap scaling function.
  */
-void stretch_blit(BITMAP *src, BITMAP *dst, int sx, int sy, int sw, int sh,
+void stretch_blit(AL_CONST BITMAP *src, BITMAP *dst, int sx, int sy, int sw, int sh,
 		  int dx, int dy, int dw, int dh)
 {
    _al_stretch_blit(src, dst, sx, sy, sw, sh, dx, dy, dw, dh, 0);
@@ -428,7 +428,7 @@
 /* stretch_sprite:
  *  Masked version of stretch_blit().
  */
-void stretch_sprite(BITMAP *dst, BITMAP *src, int x, int y, int w, int h)
+void stretch_sprite(BITMAP *dst, AL_CONST BITMAP *src, int x, int y, int w, int h)
 {
    _al_stretch_blit(src, dst, 0, 0, src->w, src->h, x, y, w, h, 1);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/