Fix all warnings in the Build tools for both GCC and Clang.

git-svn-id: https://svn.eduke32.com/eduke32@2472 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2012-03-14 06:24:03 +00:00
parent 26dfddfaf0
commit a9fc470258
7 changed files with 65 additions and 77 deletions

View file

@ -10,6 +10,8 @@
#include <string>
#include <cstdlib>
#include "compat.h"
using namespace std;
void usage()
@ -338,7 +340,7 @@ public:
left = markprelength_;
while (left > 0) {
i = left;
if (i > sizeof(blk)) {
if ((unsigned int)i > sizeof(blk)) {
i = sizeof(blk);
}
infile.read(blk, i);
@ -359,7 +361,7 @@ public:
left = markpostlength_;
while (left > 0) {
i = left;
if (i > sizeof(blk)) {
if ((unsigned int)i > sizeof(blk)) {
i = sizeof(blk);
}
infile.read(blk, i);
@ -390,7 +392,7 @@ public:
* @param imgdatah receives the decoded image height
* @return 0 on success, 1 if the format is invalid
*/
int loadimage_pcx(unsigned char * data, int datalen, char ** imgdata, int& imgdataw, int& imgdatah)
int loadimage_pcx(unsigned char * data, int datalen ATTRIBUTE((unused)), char ** imgdata, int& imgdataw, int& imgdatah)
{
if (data[0] != 10 ||
data[1] != 5 ||
@ -482,7 +484,7 @@ protected:
public:
typedef enum {
NO_ERROR = 0,
ERR_NO_ERROR = 0,
ERR_BAD_OPTION = 1,
ERR_BAD_VALUE = 2,
ERR_TOO_MANY_PARAMS = 3,
@ -490,10 +492,10 @@ public:
ERR_INVALID_IMAGE = 5,
} Result;
static char const * const translateResult(Result r)
static char const * translateResult(Result r)
{
switch (r) {
case NO_ERROR: return "no error";
case ERR_NO_ERROR: return "no error";
case ERR_BAD_OPTION: return "bad option";
case ERR_BAD_VALUE: return "bad value";
case ERR_TOO_MANY_PARAMS: return "too many parameters given";
@ -556,10 +558,10 @@ public:
} else {
return ERR_BAD_OPTION;
}
return NO_ERROR;
return ERR_NO_ERROR;
}
virtual Result setParameter(int number, string value)
virtual Result setParameter(int number ATTRIBUTE((unused)), string value ATTRIBUTE((unused)))
{
return ERR_TOO_MANY_PARAMS;
}
@ -571,7 +573,7 @@ public:
art.init(offset_, ntiles_);
art.write();
return NO_ERROR;
return ERR_NO_ERROR;
}
};
@ -612,7 +614,7 @@ public:
} else {
return ERR_BAD_OPTION;
}
return NO_ERROR;
return ERR_NO_ERROR;
}
virtual Result setParameter(int number, string value)
@ -620,10 +622,10 @@ public:
switch (number) {
case 0:
tilenum_ = atoi(value.c_str());
return NO_ERROR;
return ERR_NO_ERROR;
case 1:
filename_ = value;
return NO_ERROR;
return ERR_NO_ERROR;
default:
return ERR_TOO_MANY_PARAMS;
}
@ -634,7 +636,7 @@ public:
int tilesperfile = 0, nextstart = 0;
int filenum = 0;
char * imgdata = 0;
int imgdatalen = 0, imgdataw = 0, imgdatah = 0;
int imgdataw = 0, imgdatah = 0;
// open the first art file to get the file size used by default
{
@ -683,7 +685,7 @@ public:
art.write();
}
if (done) {
return NO_ERROR;
return ERR_NO_ERROR;
}
}
@ -701,7 +703,7 @@ private:
public:
RmTileOp() : tilenum_(-1) { }
virtual Result setOption(string opt, string value)
virtual Result setOption(string opt ATTRIBUTE((unused)), string value ATTRIBUTE((unused)))
{
return ERR_BAD_OPTION;
}
@ -711,7 +713,7 @@ public:
switch (number) {
case 0:
tilenum_ = atoi(value.c_str());
return NO_ERROR;
return ERR_NO_ERROR;
default:
return ERR_TOO_MANY_PARAMS;
}
@ -734,7 +736,7 @@ public:
if (tilenum_ >= art.getFirstTile() && tilenum_ <= art.getLastTile()) {
art.removeTile(tilenum_);
art.write();
return NO_ERROR;
return ERR_NO_ERROR;
}
}
@ -793,7 +795,7 @@ public:
} else {
return ERR_BAD_OPTION;
}
return NO_ERROR;
return ERR_NO_ERROR;
}
virtual Result setParameter(int number, string value)
@ -801,7 +803,7 @@ public:
switch (number) {
case 0:
tilenum_ = atoi(value.c_str());
return NO_ERROR;
return ERR_NO_ERROR;
default:
return ERR_TOO_MANY_PARAMS;
}
@ -812,7 +814,7 @@ public:
int filenum = 0;
if (settings_ == 0) {
return NO_ERROR;
return ERR_NO_ERROR;
}
// open art files until we find one that encompasses the range we need
@ -842,7 +844,7 @@ public:
art.setAnimType(tilenum_, animtype_);
}
art.write();
return NO_ERROR;
return ERR_NO_ERROR;
}
}
@ -854,7 +856,7 @@ int main(int argc, char ** argv)
{
int showusage = 0;
Operation * oper = 0;
Operation::Result err;
Operation::Result err = Operation::ERR_NO_ERROR;
if (argc < 2) {
showusage = 1;
@ -889,7 +891,7 @@ int main(int argc, char ** argv)
i++;
switch (err = oper->setOption(opt, value)) {
case Operation::NO_ERROR: break;
case Operation::ERR_NO_ERROR: break;
default:
cerr << "error: " << Operation::translateResult(err) << endl;
showusage = 2;
@ -898,7 +900,7 @@ int main(int argc, char ** argv)
} else {
value = string(argv[i]);
switch (oper->setParameter(unnamedParm, value)) {
case Operation::NO_ERROR: break;
case Operation::ERR_NO_ERROR: break;
default:
cerr << "error: " << Operation::translateResult(err) << endl;
showusage = 2;
@ -919,7 +921,7 @@ int main(int argc, char ** argv)
delete oper;
switch (err) {
case Operation::NO_ERROR: return 0;
case Operation::ERR_NO_ERROR: return 0;
default:
cerr << "error: " << Operation::translateResult(err) << endl;
return 1;

View file

@ -21,7 +21,7 @@ typedef struct {
int border, depth;
} texcachepicture;
int main(int argc, char **argv)
int main(void)
{
DIR *dir;
struct dirent *dirent;

View file

@ -51,9 +51,9 @@ int writeicon(FILE *fp, struct icon *ico)
int main(int argc, char **argv)
{
struct icon icon;
int bpl, xsiz, ysiz;
int i,j,k,c;
unsigned char *mask, *maskp, bm, *pp;
int bpl;
int i;
unsigned char *maskp, bm, *pp;
if (argc<2) {
fprintf(stderr, "generateicon <picture file>\n");

View file

@ -100,4 +100,6 @@ int main(int argc, char **argv)
fwrite(palette,768,1,voxfh);
free(tiledata);
return 0;
}

View file

@ -121,7 +121,7 @@ static void usage_and_quit()
int main(int argc, char **argv)
{
char *fn=NULL, *cp;
int32_t fd=-1, i, j, slen;
int32_t fd=-1, i, j;
int32_t doinfo=1;
@ -146,7 +146,6 @@ int main(int argc, char **argv)
for (i=1; i<argc; i++)
{
cp = argv[i];
slen = strlen(cp);
if (cp[0]=='-')
{

View file

@ -90,44 +90,28 @@ void saveart (short tilenum, short xlen, short ylen)
void savenames(void)
{
char buffer[160];
int fil3, i, j;
BFILE * fil3;
int i;
if ((fil3 = Bopen("names.h",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
return;
fil3 = Bfopen("names.h","w");
strcpy(&buffer,"//Be careful when changing this file - it is parsed by Editart and Build.");
buffer[73] = 13, buffer[74] = 10, buffer[75] = 0;
Bwrite(fil3,&buffer[0],75);
if (fil3 != NULL)
{
Bfprintf(fil3,"//Be careful when changing this file - it is parsed by Editart and Build.\n");
strcpy(&buffer,"#define ");
for(i=0;i<numwads;i++)
if (wadata[i][0] != 0)
{
j = 8;
while ((j < 16) && (wadata[i][j-8] != 0))
{ buffer[j] = wadata[i][j-8]; j++; }
buffer[j++] = 32;
for(i=0; i<numwads; i++)
if (wadata[i][0] != 0)
Bfprintf(fil3,"#define %s %d\n", wadata[i], i);
if (i >= 10000) buffer[j++] = ((i/10000)%10)+48;
if (i >= 1000) buffer[j++] = ((i/1000)%10)+48;
if (i >= 100) buffer[j++] = ((i/100)%10)+48;
if (i >= 10) buffer[j++] = ((i/10)%10)+48;
buffer[j++] = (i%10)+48;
buffer[j++] = 13;
buffer[j++] = 10;
Bwrite(fil3,&buffer[0],j);
}
Bclose(fil3);
Bfclose(fil3);
}
}
void showart (char *part)
{
char yoff, ylen;
char yoff;
short xsiz, ysiz;
int i, j, z, zx, zzx, x, y, p, pend, junk, curplc;
int i, z, zx, x, p, pend, curplc;
curplc = -1;
if ((Bstrncasecmp(part,"L_START",7) == 0) || (Bstrncasecmp(part,"S_START",7) == 0) || (Bstrncasecmp(part,"P_START",7) == 0))

View file

@ -139,7 +139,7 @@ static short texturelookup[4096];
static char tagtypemode = 0;
static int tagnum[1024], tagnum2[1024], tagoff[1024], numtags = 0;
static char tagstruct[4096], tagop[4096];
static char tagop[4096];
static short tagfield[4096];
static int tagval[4096], tagopnum = 0;
@ -296,11 +296,11 @@ int readline(void)
void parsescript(void)
{
int i, j, k, l, lasti, breakout, tstart, tend, textnum, frontbackstat;
int i, j, k, l, lasti, breakout, tstart, tend, textnum = 0, frontbackstat;
int spritenumstat, slen;
char ch;
clearbufbyte(FP_OFF(sectspri),MAXSECTS*8*sizeof(short),0xffffffff);
clearbufbyte(&sectspri[0], sizeof(short) * MAXSECTS * 8, 0xffffffff);
if (scriptname[0] == 0)
{
@ -625,7 +625,7 @@ void parsescript(void)
if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57))
tagval[tagopnum] = atol(&tempbuf[k+1]);
else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0)
tagval[tagopnum] = 0x80000000;
tagval[tagopnum] = INT32_MIN;
else
{
for(l=0;l<numdefines;l++)
@ -706,7 +706,7 @@ void parsescript(void)
if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57))
secval[secopnum] = atol(&tempbuf[k+1]);
else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0)
secval[secopnum] = 0x80000000;
secval[secopnum] = INT32_MIN;
else
{
for(l=0;l<numdefines;l++)
@ -913,13 +913,13 @@ int main(int argc, char **argv)
{
char argstring[5][80];
char iwadfil[80], pwadfil[80], doommap[16], buildmap[16], picstr[16];
int w, numwads, numtexts, startnumtexts, danumtexts, numpnames;
int x, y, z, zz, zzz, zzx, zx, cx, cy, gap, p, pp, i, j, k, l, offs;
int dnumpoints, dnumlines, dnumsides, dnumsectors, dnumthings, good;
int minx, maxx, miny, maxy, numsectors, numwalls, wadtype;
int startnumwalls, l1, l2, startpoint2, dapoint2, area;
int w, numtexts, startnumtexts, danumtexts, numpnames;
int x, y, z, zz, zzz, zzx, zx, cx, cy, gap, i, j, k, l, offs;
int dnumpoints = 0, dnumlines = 0, dnumsides, dnumsectors, dnumthings;
int minx, maxx, miny, maxy, numwalls, wadtype;
int startnumwalls, l1, l2, startpoint2;
int fil, ifil, pfil, x1, y1, x2, y2, startwall, endwall;
int mapversion, posx, posy, posz, tempint, cnt, boardwadindex;
int mapversion, posx, posy, posz, boardwadindex;
short ang, cursectnum;
printf("Wad2Map! Copyright 1995 by Ken Silverman\n");
@ -1050,9 +1050,9 @@ int main(int argc, char **argv)
}
}
clearbufbyte(FP_OFF(sector),MAXSECTORS*sizeof(sectortype),0L);
clearbufbyte(FP_OFF(wall),MAXWALLS*sizeof(walltype),0L);
clearbufbyte(FP_OFF(sprite),MAXSPRITES*sizeof(spritetype),0L);
clearbufbyte(&sector[0], sizeof(sectortype) * MAXSECTORS, 0);
clearbufbyte(&wall[0], sizeof(walltype) * MAXWALLS, 0);
clearbufbyte(&sprite[0], sizeof(spritetype) * MAXSPRITES, 0);
for(i=0;i<MAXSECTORS;i++) sector[i].extra = -1;
for(i=0;i<MAXWALLS;i++) wall[i].extra = -1;
for(i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;
@ -1228,7 +1228,8 @@ int main(int argc, char **argv)
startpoint2 = startnumwalls;
for(zz=startnumwalls;zz<numwalls;zz++)
{
dapoint2 = -1; x = wx2[zz]; y = wy2[zz];
x = wx2[zz];
y = wy2[zz];
j = 0;
for(zzz=zz+1;zzz<numwalls;zzz++)
if ((wx[zzz] == x) && (wy[zzz] == y))
@ -1419,7 +1420,7 @@ int main(int argc, char **argv)
for(j=tagoff[i];j<tagoff[i+1];j++)
{
k = (tagfield[j]&127);
zz = tagval[j]; if (zz == 0x80000000) zz = line[z].tag;
zz = tagval[j]; if (zz == INT32_MIN) zz = line[z].tag;
if (k < 32)
{
l = sectorofwall[zx];
@ -1498,7 +1499,7 @@ int main(int argc, char **argv)
for(j=secoff[i];j<secoff[i+1];j++)
{
k = (secfield[j]&127);
zz = secval[j]; if (zz == 0x80000000) zz = sect[l].tag;
zz = secval[j]; if (zz == INT32_MIN) zz = sect[l].tag;
if (k < 32)
{
zzz = sectspri[l][(secfield[j]>>8)&7];