From 92223c2c854507596b132574517dc8d8238eb763 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 19 Dec 2010 22:47:10 +0000 Subject: [PATCH] Atrributify various function declarations. Right now the attributes used are noreturn, nonnull and format, the latter allowing us to catch silly printf errors. Again, these range from relatively benign to disastrous. git-svn-id: https://svn.eduke32.com/eduke32@1740 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/baselayer.h | 8 +- polymer/eduke32/build/include/build.h | 34 +++--- polymer/eduke32/build/include/editor.h | 10 +- polymer/eduke32/build/include/m32script.h | 2 +- polymer/eduke32/build/src/baselayer.c | 2 +- polymer/eduke32/build/src/build.c | 43 ++++--- polymer/eduke32/source/astub.c | 140 ++++++++++------------ polymer/eduke32/source/config.c | 23 ++-- polymer/eduke32/source/game.c | 2 +- polymer/eduke32/source/game.h | 2 +- polymer/eduke32/source/gamedef.c | 30 ++--- polymer/eduke32/source/gameexec.c | 2 +- polymer/eduke32/source/jmact/control.c | 4 +- polymer/eduke32/source/m32def.c | 8 +- polymer/eduke32/source/m32exec.c | 2 +- polymer/eduke32/source/net.c | 5 +- polymer/eduke32/source/sounds.c | 2 +- 17 files changed, 149 insertions(+), 170 deletions(-) diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 1c8e325a0..ee3d8a9ad 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -97,8 +97,8 @@ int32_t initsystem(void); void uninitsystem(void); extern int32_t flushlogwindow; -void initprintf(const char *, ...); -void debugprintf(const char *,...); +void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2))); +void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2))); int32_t handleevents(void); extern void (*after_handleevents_hook)(void); @@ -162,8 +162,8 @@ extern double vid_gamma, vid_contrast, vid_brightness; int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit -int32_t wm_msgbox(char *name, char *fmt, ...); -int32_t wm_ynbox(char *name, char *fmt, ...); +int32_t wm_msgbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); +int32_t wm_ynbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); void wm_setapptitle(char *name); // baselayer.c diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index f2e35ec66..d8a064af1 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -459,7 +459,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2); void setaspect(int32_t daxrange, int32_t daaspect); void flushperms(void); -void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col); +void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2))); void plotpixel(int32_t x, int32_t y, char col); char getpixel(int32_t x, int32_t y); @@ -475,26 +475,26 @@ void clearallviews(int32_t dacol); void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); -int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize); -void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize); +int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) ATTRIBUTE((nonnull(5))); +void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) ATTRIBUTE((nonnull(5))); extern int32_t clipmoveboxtracenum; -int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype); +int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist); int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist); -int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype); -void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype); -int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype); -int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch); +int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); +void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); +int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); +int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch) ATTRIBUTE((nonnull(6,7,8))); int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2); -void updatesector(int32_t x, int32_t y, int16_t *sectnum); -void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap); -void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum); +void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); +void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3))); +void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4))); int32_t inside(int32_t x, int32_t y, int16_t sectnum); void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day); void setfirstwall(int16_t sectnum, int16_t newfirstwall); -void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus); +void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); int32_t krand(void); int32_t ksqrt(int32_t num); // int32_t getangle(int32_t xvect, int32_t yvect); @@ -517,12 +517,12 @@ static inline int32_t getangle(int32_t xvect, int32_t yvect) return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047; } -void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2); +void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7))); int32_t lastwall(int16_t point); int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction); int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day); int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day); -void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz); +void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(4,5))); void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); int32_t sectorofwall(int16_t theline); @@ -563,9 +563,9 @@ static inline int32_t deletesprite(int16_t spritenum) int32_t changespritesect(int16_t spritenum, int16_t newsectnum); int32_t changespritestat(int16_t spritenum, int16_t newstatnum); -int32_t setsprite(int16_t spritenum, const vec3_t *new); +int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); -int32_t screencapture(char *filename, char inverseit); +int32_t screencapture(char *filename, char inverseit) ATTRIBUTE((nonnull(1))); int32_t getclosestcol(int32_t r, int32_t g, int32_t b); @@ -586,7 +586,7 @@ void qsetmode640480(void); void qsetmodeany(int32_t,int32_t); void clear2dscreen(void); void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride); -void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride); +void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1))); int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 63c083e71..f91003b9e 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -76,9 +76,9 @@ extern int32_t m32_swcnt; extern int16_t *m32_wallsprite; extern int8_t sideview_reversehrot; extern inline int32_t scalescreeny(int32_t sy); -extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); +extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull)); //extern void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome); -extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz); +extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull)); extern inline int32_t getscreenvdisp(int32_t bz, int32_t zoome); extern void setup_sideview_sincos(void); extern void m32_setkeyfilter(int32_t on); @@ -123,14 +123,14 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t)); #define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL) void printmessage256(int32_t x, int32_t y, const char *name); -void message(const char *fmt, ...); +void message(const char *fmt, ...) ATTRIBUTE((format(printf,1,2))); // currently only for 3d mode const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen); // like snprintf, but pads the output buffer with 'fill' at the end -int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...); -void _printmessage16(const char *fmt, ...); +//int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...); +void _printmessage16(const char *fmt, ...) ATTRIBUTE((format(printf,1,2))); extern int32_t lastpm16time; #define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__) diff --git a/polymer/eduke32/build/include/m32script.h b/polymer/eduke32/build/include/m32script.h index 654318267..37d02a49d 100644 --- a/polymer/eduke32/build/include/m32script.h +++ b/polymer/eduke32/build/include/m32script.h @@ -234,7 +234,7 @@ extern int32_t halfxdim16, midydim16; // gamevar bytecode format: -// FEDC|BA09|8765|4321|FEDC|BA09|8765|4321 +// FEDC|BA98|7654|3210|FEDC|BA98|7654|3120 // | .. .... .... gamevar ID // | . constant bit (checked first) / get-payload-var bit for array or struct // | . negate bit diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index b40ad94a6..763fef116 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -246,7 +246,7 @@ int32_t osdcmd_glinfo(const osdfuncparm_t *parm) ); s = Bstrdup(glinfo.extensions); - if (!s) initprintf(glinfo.extensions); + if (!s) initprintf("%s", glinfo.extensions); else { i = 0; t = u = s; diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index dc72080f1..2bdf4312b 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -254,6 +254,7 @@ static inline void bclamp(int32_t *x, int32_t mi, int32_t ma) if (*x= 2 && totalclock >= 120*6) { if (pointhighlight >= 16384) @@ -7005,8 +7002,7 @@ static void Keys2d(void) sprite[cursprite].xrepeat = getnumber16(tempbuf, sprite[cursprite].xrepeat, 255, 0); Bsprintf(tempbuf, "Sprite %d yrepeat: ", cursprite); sprite[cursprite].yrepeat = getnumber16(tempbuf, sprite[cursprite].yrepeat, 255, 0); - Bsprintf(tempbuf, "Sprite %d updated", i); - printmessage16(tempbuf); + printmessage16("Sprite %d updated", i); } } @@ -7074,13 +7070,11 @@ static void Keys2d(void) } } if (autogrid) - Bsprintf(tempbuf,"Grid size: 9 (autosize)"); + printmessage16("Grid size: 9 (autosize)"); else if (!grid) - Bsprintf(tempbuf,"Grid off"); + printmessage16("Grid off"); else - Bsprintf(tempbuf,"Grid size: %d (%d units)", grid, 2048>>grid); - - printmessage16(tempbuf); + printmessage16("Grid size: %d (%d units)", grid, 2048>>grid); } if (autogrid) { @@ -7103,8 +7097,7 @@ static void Keys2d(void) sprite[i].z = getnumber16(tempbuf, sprite[i].z, 8388608, 1); Bsprintf(tempbuf, "Sprite %d angle: ", i); sprite[i].ang = getnumber16(tempbuf, sprite[i].ang, 2047, 0); - Bsprintf(tempbuf, "Sprite %d updated", i); - printmessage16(tempbuf); + printmessage16("Sprite %d updated", i); } else if (pointhighlight >= 0 /*<= 16383*/) @@ -7118,8 +7111,7 @@ static void Keys2d(void) Bsprintf(tempbuf, "Wall %d y: ", i); k = getnumber16(tempbuf, k, editorgridextent, 1); dragpoint(i, j, k); - Bsprintf(tempbuf, "Wall %d updated", i); - printmessage16(tempbuf); + printmessage16("Wall %d updated", i); } } @@ -7127,8 +7119,7 @@ static void Keys2d(void) if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(3)) // ' 3 { onnames = (onnames+1)%8; - Bsprintf(tempbuf, "Mode %d %s", onnames, SpriteMode[onnames]); - printmessage16(tempbuf); + printmessage16("Mode %d %s", onnames, SpriteMode[onnames]); // clearmidstatbar16(); // for(i=0;i= 16384) { swapshort(&sprite[cursprite].lotag, &sprite[cursprite].hitag); - Bsprintf(tempbuf, "Sprite %d tags swapped", cursprite); - printmessage16(tempbuf); + printmessage16("Sprite %d tags swapped", cursprite); } else if (linehighlight >= 0) { swapshort(&wall[linehighlight].lotag, &wall[linehighlight].hitag); - Bsprintf(tempbuf, "Wall %d tags swapped", linehighlight); - printmessage16(tempbuf); + printmessage16("Wall %d tags swapped", linehighlight); } } @@ -7157,8 +7146,7 @@ static void Keys2d(void) { pos.x = getnumber16("X-coordinate: ", pos.x, editorgridextent, 1); pos.y = getnumber16("Y-coordinate: ", pos.y, editorgridextent, 1); - Bsprintf(tempbuf, "Current pos now (%d, %d)", pos.x, pos.y); - printmessage16(tempbuf); + printmessage16("Current pos now (%d, %d)", pos.x, pos.y); } }// end key2d @@ -7295,7 +7283,7 @@ static void G_ShowParameterHelp(void) #endif "\n-?, -help, --help\tDisplay this help message and exit" ; - wm_msgbox("Mapster32"VERSION BUILDDATE,s); + wm_msgbox("Mapster32"VERSION BUILDDATE,"%s",s); } static void AddGamePath(const char *buffer) @@ -9803,7 +9791,7 @@ static void Keys2d3d(void) if (getmessageleng > 0) { if (qsetmode != 200) - printmessage16(getmessage); + printmessage16("%s", getmessage); if (totalclock > getmessagetimeoff) getmessageleng = 0; } @@ -10056,7 +10044,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Flags: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingstat = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].ceilingstat,65536L,0); } break; @@ -10065,10 +10053,10 @@ static void EditSectorData(int16_t sectnum) if (editval) { Bsprintf(edittext,"Sector %d Ceiling X Pan: ",sectnum); - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingxpanning = (char)getnumber16(edittext,(int32_t)sector[sectnum].ceilingxpanning,256L,0); Bsprintf(edittext,"Sector %d Ceiling Y Pan: ",sectnum); - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingypanning = (char)getnumber16(edittext,(int32_t)sector[sectnum].ceilingypanning,256L,0); } break; @@ -10077,7 +10065,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Shade: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingshade = (char)getnumber16(edittext,(int32_t)sector[sectnum].ceilingshade,128L,1); } break; @@ -10087,7 +10075,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Z-coordinate: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingz = getnumber16(edittext,sector[sectnum].ceilingz,8388608,1); //2147483647L,-2147483648L } break; @@ -10097,7 +10085,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Tile Number: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingpicnum = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].ceilingpicnum,MAXTILES,0); } break; @@ -10107,7 +10095,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Heinum: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingheinum = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].ceilingheinum,65536L,1); } break; @@ -10117,7 +10105,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Ceiling Palookup Number: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].ceilingpal = (char)getnumber16(edittext,(int32_t)sector[sectnum].ceilingpal,MAXPALOOKUPS,0); } break; @@ -10132,7 +10120,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Floor Flags: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorstat = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].floorstat,65536L,0); } break; @@ -10142,10 +10130,10 @@ static void EditSectorData(int16_t sectnum) if (editval) { Bsprintf(edittext,"Sector %d Floor X Pan: ",sectnum); - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorxpanning = (char)getnumber16(edittext,(int32_t)sector[sectnum].floorxpanning,256L,0); Bsprintf(edittext,"Sector %d Floor Y Pan: ",sectnum); - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorypanning = (char)getnumber16(edittext,(int32_t)sector[sectnum].floorypanning,256L,0); } break; @@ -10155,7 +10143,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Floor Shade: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorshade = (char)getnumber16(edittext,(int32_t)sector[sectnum].floorshade,128L,1L); } break; @@ -10165,7 +10153,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Floor Z-coordinate: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorz = getnumber16(edittext,sector[sectnum].floorz,8388608L,1); //2147483647L,-2147483648L } break; @@ -10175,7 +10163,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Floor Tile Number: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorpicnum = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].floorpicnum,MAXTILES,0); } break; @@ -10184,7 +10172,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Flooring Heinum: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorheinum = (int16_t)getnumber16(edittext,(int32_t)sector[sectnum].floorheinum,65536L,1); } break; @@ -10193,7 +10181,7 @@ static void EditSectorData(int16_t sectnum) Bsprintf(edittext,"Sector %d Floor Palookup Number: ",sectnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sector[sectnum].floorpal = (char)getnumber16(edittext,(int32_t)sector[sectnum].floorpal,MAXPALOOKUPS,0); } break; @@ -10259,7 +10247,7 @@ static void EditWallData(int16_t wallnum) Bsprintf(edittext,"Wall %d Flags: ",wallnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].cstat = (int16_t)getnumber16(edittext,(int32_t)wall[wallnum].cstat,65536L,0); } break; @@ -10268,7 +10256,7 @@ static void EditWallData(int16_t wallnum) Bsprintf(edittext,"Wall %d Shade: ",wallnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].shade = (char)getnumber16(edittext,(int32_t)wall[wallnum].shade,128,1); } break; @@ -10277,7 +10265,7 @@ static void EditWallData(int16_t wallnum) Bsprintf(edittext,"Wall %d Pal: ",wallnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].pal = (char)getnumber16(edittext,(int32_t)wall[wallnum].pal,MAXPALOOKUPS,0); } break; @@ -10286,10 +10274,10 @@ static void EditWallData(int16_t wallnum) if (editval) { Bsprintf(edittext,"Wall %d X Repeat: ",wallnum); - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].xrepeat = (char)getnumber16(edittext,(int32_t)wall[wallnum].xrepeat,256L,0); Bsprintf(edittext,"Wall %d Y Repeat: ",wallnum); - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].yrepeat = (char)getnumber16(edittext,(int32_t)wall[wallnum].yrepeat,256L,0); } break; @@ -10298,10 +10286,10 @@ static void EditWallData(int16_t wallnum) if (editval) { Bsprintf(edittext,"Wall %d X Pan: ",wallnum); - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].xpanning = (char)getnumber16(edittext,(int32_t)wall[wallnum].xpanning,256L,0); Bsprintf(edittext,"Wall %d Y Pan: ",wallnum); - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].ypanning = (char)getnumber16(edittext,(int32_t)wall[wallnum].ypanning,256L,0); } break; @@ -10310,7 +10298,7 @@ static void EditWallData(int16_t wallnum) Bsprintf(edittext,"Wall %d Tile number: ",wallnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].picnum = (int16_t)getnumber16(edittext,(int32_t)wall[wallnum].picnum,MAXTILES,0); } break; @@ -10320,7 +10308,7 @@ static void EditWallData(int16_t wallnum) Bsprintf(edittext,"Wall %d OverTile number: ",wallnum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); wall[wallnum].overpicnum = (int16_t)getnumber16(edittext,(int32_t)wall[wallnum].overpicnum,MAXTILES,0); } break; @@ -10454,7 +10442,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d X-coordinate: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); } } @@ -10465,7 +10453,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Y-coordinate: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); } } @@ -10476,7 +10464,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Z-coordinate: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L } } @@ -10487,7 +10475,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Sectnum: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); i = getnumber16(edittext,sprite[spritenum].sectnum,numsectors-1,0); if (i != sprite[spritenum].sectnum) changespritesect(spritenum,i); @@ -10500,7 +10488,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Statnum: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0); if (i != sprite[spritenum].statnum) changespritestat(spritenum,i); @@ -10520,7 +10508,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Flags: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].cstat = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].cstat,65536L,0); } } @@ -10531,7 +10519,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Shade: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].shade = (char)getnumber16(edittext,(int32_t)sprite[spritenum].shade,128,1); } } @@ -10542,7 +10530,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Pal: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].pal = (char)getnumber16(edittext,(int32_t)sprite[spritenum].pal,MAXPALOOKUPS,0); } } @@ -10553,10 +10541,10 @@ static void EditSpriteData(int16_t spritenum) if (editval) { Bsprintf(edittext,"Sprite %d X Repeat: ",spritenum); - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].xrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xrepeat,256L,0); Bsprintf(edittext,"Sprite %d Y Repeat: ",spritenum); - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].yrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yrepeat,256L,0); } } @@ -10567,10 +10555,10 @@ static void EditSpriteData(int16_t spritenum) if (editval) { Bsprintf(edittext,"Sprite %d X Offset: ",spritenum); - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].xoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xoffset,128L,1); Bsprintf(edittext,"Sprite %d Y Offset: ",spritenum); - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].yoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yoffset,128L,1); } } @@ -10581,7 +10569,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Tile number: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].picnum = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].picnum,MAXTILES,0); } } @@ -10599,7 +10587,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Angle: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].ang = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].ang,2048L,0); } } @@ -10610,7 +10598,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d X-Velocity: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].xvel = getnumber16(edittext,(int32_t)sprite[spritenum].xvel,65536,1); } } @@ -10621,7 +10609,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Y-Velocity: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].yvel = getnumber16(edittext,(int32_t)sprite[spritenum].yvel,65536,1); } } @@ -10632,7 +10620,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Z-Velocity: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].zvel = getnumber16(edittext,(int32_t)sprite[spritenum].zvel,65536,1); } } @@ -10643,7 +10631,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Owner: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].owner = getnumber16(edittext,(int32_t)sprite[spritenum].owner,MAXSPRITES,1); } } @@ -10654,7 +10642,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Clipdist: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].clipdist = (char)getnumber16(edittext,(int32_t)sprite[spritenum].clipdist,256,0); } } @@ -10665,7 +10653,7 @@ static void EditSpriteData(int16_t spritenum) Bsprintf(edittext,"Sprite %d Extra: ",spritenum); if (editval) { - printmessage16(edittext); + printmessage16("%s", edittext); sprite[spritenum].extra = getnumber16(edittext,(int32_t)sprite[spritenum].extra,BTAG_MAX,1); } } @@ -10815,7 +10803,7 @@ static void GenericSpriteSearch() { Bsprintf(edittext, "%s: ", labels[row][col]); enddrawing(); - printmessage16(edittext); + printmessage16("%s", edittext); i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0, maxval[row][col], sign[row][col]); if (col == 2 && row == 0) i = (i+2048)&2047; // angle @@ -11025,8 +11013,7 @@ static void FuncMenu(void) if (tilesizx[sprite[i].picnum] <= 0) sprite[i].picnum = 0,j++; } - Bsprintf(tempbuf,"Replaced %d invalid tiles",j); - printmessage16(tempbuf); + printmessage16("Replaced %d invalid tiles",j); } } break; @@ -11043,8 +11030,7 @@ static void FuncMenu(void) for (j=0; j_settings.cfg OSD_WriteCvars(fp); fclose(fp); if (!Bstrcmp(setupfilename, SETUPFILENAME)) - Bsprintf(tempbuf, "Wrote settings.cfg\n"); - else Bsprintf(tempbuf,"Wrote %s_settings.cfg\n",ptr); - OSD_Printf(tempbuf); + OSD_Printf("Wrote settings.cfg\n"); + else OSD_Printf("Wrote %s_settings.cfg\n",ptr); + Bfree(ptr); return; } if (!Bstrcmp(setupfilename, SETUPFILENAME)) - Bsprintf(tempbuf, "Error writing settings.cfg: %s\n", strerror(errno)); - else Bsprintf(tempbuf,"Error writing %s_settings.cfg: %s\n",ptr,strerror(errno)); + OSD_Printf("Error writing settings.cfg: %s\n", strerror(errno)); + else OSD_Printf("Error writing %s_settings.cfg: %s\n",ptr,strerror(errno)); - OSD_Printf(tempbuf); Bfree(ptr); } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3d17352f5..77e87af55 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1992,7 +1992,7 @@ void G_GameExit(const char *t) { char titlebuf[256]; Bsprintf(titlebuf,HEAD2 " %s",s_buildDate); - wm_msgbox(titlebuf, (char *)t); + wm_msgbox(titlebuf, "%s", (char *)t); } } diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index b2096a162..178fc87a4 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -264,7 +264,7 @@ void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t ori void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p); void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation); void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e); -void G_GameExit(const char *t); +void G_GameExit(const char *t) ATTRIBUTE((noreturn)); void G_GameQuit(void); void G_GetCrosshairColor(void); void G_HandleLocalKeys(void); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 002d30538..a467c6bbc 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1156,7 +1156,7 @@ static int32_t C_SetScriptSize(int32_t size) { C_ReportError(-1); initprintf("%s:%d: out of memory: Aborted (%ud)\n",g_szScriptFileName,g_lineNumber,(unsigned)(g_scriptPtr-script)); - initprintf(tempbuf); + initprintf("%s", tempbuf); g_numCompilerErrors++; return 1; } @@ -1174,7 +1174,7 @@ static int32_t C_SetScriptSize(int32_t size) bitptr = newbitptr; if (script != newscript) { - initprintf("Relocating compiled code from to 0x%x to 0x%x\n", script, newscript); + initprintf("Relocating compiled code from to 0x%lx to 0x%lx\n", (unsigned long)script, (unsigned long)newscript); script = newscript; } @@ -1619,7 +1619,7 @@ static void C_GetNextVarType(int32_t type) if (!type && !g_labelsOnly && (isdigit(*textptr) || ((*textptr == '-') && (isdigit(*(textptr+1)))))) { if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); + initprintf("%s:%d: debug: accepted constant %ld in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=MAXGAMEVARS; if (tolower(textptr[1])=='x') @@ -1640,7 +1640,7 @@ static void C_GetNextVarType(int32_t type) if (!type) { if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: flagging gamevar as negative.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); + initprintf("%s:%d: debug: flagging gamevar as negative.\n",g_szScriptFileName,g_lineNumber); //,atol(textptr)); f = (MAXGAMEVARS<<1); } else @@ -1949,7 +1949,7 @@ static int32_t C_GetNextValue(int32_t type) while (i > 0); if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: accepted constant %d.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); + initprintf("%s:%d: debug: accepted constant %ld.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); if (tolower(textptr[1])=='x') @@ -2607,7 +2607,7 @@ static int32_t C_ParseCommand(void) kclose(fp); g_numCompilerErrors++; initprintf("%s:%d: error: could not allocate %d bytes to include `%s'.\n", - g_lineNumber,g_szScriptFileName,j,tempbuf); + g_szScriptFileName,g_lineNumber,j,tempbuf); return 0; } @@ -5676,7 +5676,7 @@ repeatcase: if (i >= (signed)sizeof(CheatStrings[k])-1) { initprintf("%s:%d: warning: truncating cheat string to %d characters.\n", - g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1); + g_szScriptFileName,g_lineNumber,MAXCHEATLEN); //,sizeof(CheatStrings[k])-1); g_numCompilerWarnings++; C_NextLine(); break; @@ -5691,7 +5691,7 @@ repeatcase: k = *(g_scriptPtr-1); if (k >= MAXSOUNDS) { - initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",g_szScriptFileName,g_lineNumber,MAXSOUNDS); + initprintf("%s:%d: error: exceeded sound limit of %d.\n",g_szScriptFileName,g_lineNumber,MAXSOUNDS); g_numCompilerErrors++; } g_scriptPtr--; @@ -6327,9 +6327,9 @@ void C_Compile(const char *filenam) C_SetScriptSize(g_scriptPtr-script+8); initprintf("Script compiled in %dms, %ld*%db, version %s\n", getticks() - startcompiletime, - (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); + (unsigned long)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); - initprintf("%ld/%ld labels, %d/%d variables\n", g_numLabels, + initprintf("%d/%d labels, %d/%d variables\n", g_numLabels, min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), MAXSPRITES * sizeof(spritetype)/(1<<6)), g_gameVarCount, MAXGAMEVARS); @@ -6344,10 +6344,10 @@ void C_Compile(const char *filenam) if (actorscrptr[i]) l++; - if (j) initprintf("%ld quotes, ", j); + if (j) initprintf("%d quotes, ", j); if (g_numQuoteRedefinitions) initprintf("%d strings, ", g_numQuoteRedefinitions); - if (k) initprintf("%ld events, ", k); - if (l) initprintf("%ld actors", l); + if (k) initprintf("%d events, ", k); + if (l) initprintf("%d actors", l); initprintf("\n"); @@ -6522,10 +6522,10 @@ void C_ReportError(int32_t iError) initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); break; case WARNING_BADGAMEVAR: - initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + initprintf("%s:%d: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); break; case WARNING_DUPLICATECASE: - initprintf("%s:%ld: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); break; case WARNING_DUPLICATEDEFINITION: initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index dfc8f3ead..3c09cc614 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -699,7 +699,7 @@ skip_check: int32_t q = *insptr++, i = *insptr++; if ((ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL)) { - OSD_Printf(CON_ERROR "%s %d null quote\n",g_errorLineNum,keyw[g_tw],q,i); + OSD_Printf(CON_ERROR "%d %d null quote\n",g_errorLineNum,keyw[g_tw],q,i); break; } Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]); diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index 8d3b692bc..378cdeff4 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -210,14 +210,14 @@ void CONTROL_PrintKeyMap(void) for (i=0; i