Fix some warnings

This commit is contained in:
Fernando Carmona Varo 2019-05-29 19:37:05 +02:00
parent d7bc8b73d7
commit 303e2cb32e
12 changed files with 59 additions and 54 deletions

4
deps/libmad/bit.c vendored
View File

@ -207,13 +207,15 @@ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
switch (len / 8) {
case 3: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
// fall through
case 2: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
// fall through
case 1: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
len %= 8;
// fall through
case 0: break;
}

View File

@ -459,6 +459,7 @@ static Bits Operator__TemplateVolume(Operator *self, OperatorState yes) {
return vol;
}
//In sustain phase, but not sustaining, do regular release
// fall through
case RELEASE:
vol += Operator__RateForward( self, self->releaseAdd );;
if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {

View File

@ -173,7 +173,7 @@ static boolean ReadMultipleBytes (void *dest, size_t len, midimem_t *mf)
static boolean ReadVariableLength(unsigned int *result, midimem_t *mf)
{
int i;
unsigned char b;
unsigned char b = 0;
*result = 0;
@ -248,7 +248,7 @@ static boolean ReadChannelEvent(midi_event_t *event,
unsigned char event_type, boolean two_param,
midimem_t *mf)
{
unsigned char b;
unsigned char b = 0;
// Set basics:
@ -314,7 +314,7 @@ static boolean ReadSysExEvent(midi_event_t *event, int event_type,
static boolean ReadMetaEvent(midi_event_t *event, midimem_t *mf)
{
unsigned char b;
unsigned char b = 0;
event->event_type = MIDI_EVENT_META;
@ -353,7 +353,7 @@ static boolean ReadMetaEvent(midi_event_t *event, midimem_t *mf)
static boolean ReadEvent(midi_event_t *event, unsigned int *last_event_type,
midimem_t *mf)
{
unsigned char event_type;
unsigned char event_type = 0;
if (!ReadVariableLength(&event->delta_time, mf))
{

View File

@ -1329,11 +1329,12 @@ static void I_OPL_UnRegisterSong(const void *handle)
}
// Determine whether memory block is a .mid file
/*
static boolean IsMid(unsigned char *mem, int len)
{
return len > 4 && !memcmp(mem, "MThd", 4);
}
*/
// now only takes files in MIDI format
static const void *I_OPL_RegisterSong(const void *data, unsigned len)
@ -1357,7 +1358,7 @@ static const void *I_OPL_RegisterSong(const void *data, unsigned len)
// time numbers we have to traverse the tracks and everything
if (mf.len < 100)
{
lprintf (LO_WARN, "I_OPL_RegisterSong: Very short MIDI (%i bytes)\n", mf.len);
lprintf (LO_WARN, "I_OPL_RegisterSong: Very short MIDI (%lu bytes)\n", mf.len);
return NULL;
}

View File

@ -2844,7 +2844,7 @@ static void P_SpawnScrollers(void)
Add_Scroller(sc_floor, -dx, dy, control, s, accel);
if (special != 253)
break;
// fall through
case 252: // carry objects on floor
dx = FixedMul(dx,CARRYFACTOR);
dy = FixedMul(dy,CARRYFACTOR);

View File

@ -333,7 +333,8 @@ static void R_InitColormaps(void)
colormaps[i] = (const lighttable_t *)W_CacheLumpNum(i+firstcolormaplump);
if(numcolormaps == 0) {
colormaps[1] = (const lighttable_t *) {1};
const lighttable_t defaultmap[1] = {1};
colormaps[1] = defaultmap;
numcolormaps = 2;
}
}

View File

@ -860,7 +860,7 @@ void ST_Drawer(boolean statusbaron, boolean refresh, boolean fullmenu)
//
static void ST_loadGraphics(boolean doload)
{
int i, facenum;
unsigned short i, facenum;
char namebuf[9];
// cph - macro that either acquires a pointer and lock for a lump, or
// unlocks it. var is referenced exactly once in either case, so ++ in arg works

View File

@ -133,8 +133,8 @@ static const crdef_t crdefs[] = {
};
const uint8_t gammatable[5][256] = {
{
const uint8_t gammatable[5*256] = {
// Gamma Correction OFF
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,
@ -150,9 +150,8 @@ const uint8_t gammatable[5][256] = {
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
},
{
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
// Gamma level 1
2,4,5,7,8,10,11,12,14,15,16,18,19,20,21,23,
24,25,26,27,29,30,31,32,33,34,36,37,38,39,40,41,
42,44,45,46,47,48,49,50,51,52,54,55,56,57,58,59,
@ -168,9 +167,8 @@ const uint8_t gammatable[5][256] = {
199,200,201,202,203,204,205,205,206,207,208,209,210,211,212,213,
214,214,215,216,217,218,219,220,221,222,222,223,224,225,226,227,
228,229,230,230,231,232,233,234,235,236,237,237,238,239,240,241,
242,243,244,245,245,246,247,248,249,250,251,252,252,253,254,255
},
{
242,243,244,245,245,246,247,248,249,250,251,252,252,253,254,255,
// Gamma level 2
4,7,9,11,13,15,17,19,21,22,24,26,27,29,30,32,
33,35,36,38,39,40,42,43,45,46,47,48,50,51,52,54,
55,56,57,59,60,61,62,63,65,66,67,68,69,70,72,73,
@ -186,9 +184,8 @@ const uint8_t gammatable[5][256] = {
206,207,208,209,210,210,211,212,213,213,214,215,216,217,217,218,
219,220,221,221,222,223,224,224,225,226,227,228,228,229,230,231,
231,232,233,234,235,235,236,237,238,238,239,240,241,241,242,243,
244,244,245,246,247,247,248,249,250,251,251,252,253,254,254,255
},
{
244,244,245,246,247,247,248,249,250,251,251,252,253,254,254,255,
// Gamma level 3
8,12,16,19,22,24,27,29,31,34,36,38,40,41,43,45,
47,49,50,52,53,55,57,58,60,61,63,64,65,67,68,70,
71,72,74,75,76,77,79,80,81,82,84,85,86,87,88,90,
@ -204,9 +201,8 @@ const uint8_t gammatable[5][256] = {
214,214,215,216,216,217,218,219,219,220,221,221,222,223,223,224,
225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,
235,236,237,237,238,238,239,240,240,241,242,242,243,244,244,245,
246,246,247,247,248,249,249,250,251,251,252,253,253,254,254,255
},
{
246,246,247,247,248,249,249,250,251,251,252,253,253,254,254,255,
// Gamma level 4
16,23,28,32,36,39,42,45,48,50,53,55,57,60,62,64,
66,68,69,71,73,75,76,78,80,81,83,84,86,87,89,90,
92,93,94,96,97,98,100,101,102,103,105,106,107,108,109,110,
@ -223,7 +219,6 @@ const uint8_t gammatable[5][256] = {
230,231,232,232,233,233,234,234,235,235,236,236,237,237,238,239,
239,240,240,241,241,242,242,243,243,244,244,245,245,246,246,247,
247,248,248,249,249,250,250,251,251,252,252,253,254,254,255,255
}
};
@ -792,6 +787,6 @@ void V_DrawBox(fline_t* fl, int color)
by = by * SCREENHEIGHT / 200;
for (x = ax; x < bx; x++)
for (y = ay; y < by; y++)
V_PlotPixel(0, x,y, (uint8_t)color);
for (y = ay; y < by; y++)
V_PlotPixel(0, x,y, (uint8_t)color);
}

View File

@ -165,7 +165,8 @@ typedef struct
fpoint_t a, b;
} fline_t;
extern void V_DrawLine(fline_t* fl, int color);
void V_DrawLine(fline_t* fl, int color);
void V_DrawBox(fline_t* fl, int color);
void V_AllocScreen(screeninfo_t *scrn);
void V_AllocScreens();

View File

@ -246,7 +246,8 @@ static int IsMarker(const char *marker, const char *name)
// killough 4/17/98: add namespace tags
static void W_CoalesceMarkedResource(const char *start_marker,
const char *end_marker, int li_namespace)
const char *end_marker,
lumpinfo_namespace_t li_namespace)
{
lumpinfo_t *marked = malloc(sizeof(*marked) * numlumps);
size_t i, num_marked = 0, num_unmarked = 0;
@ -339,7 +340,7 @@ unsigned W_LumpNameHash(const char *s)
// W_FindNumFromName, an iterative version of W_CheckNumForName
// returns list of lump numbers for a given name (latest first)
//
int (W_FindNumFromName)(const char *name, int li_namespace, int i)
int (W_FindNumFromName)(const char *name, lumpinfo_namespace_t li_namespace, int i)
{
// Hash function maps the name to one of possibly numlump chains.
// It has been tuned so that the average chain length never exceeds 2.

View File

@ -71,6 +71,16 @@ typedef enum {
source_net // CPhipps
} wad_source_t;
// killough 4/17/98: namespace tags, to prevent conflicts between resources
typedef enum {
ns_global=0,
ns_sprites,
ns_flats,
ns_colormaps,
ns_hires,
ns_prboom
} lumpinfo_namespace_t;
// CPhipps - changed wad init
// We _must_ have the wadfiles[] the same as those actually loaded, so there
// is no point having these separate entities. This belongs here.
@ -106,15 +116,8 @@ typedef struct
// killough 1/31/98: hash table fields, used for ultra-fast hash table lookup
int index, next;
// killough 4/17/98: namespace tags, to prevent conflicts between resources
enum {
ns_global=0,
ns_sprites,
ns_flats,
ns_colormaps,
ns_hires,
ns_prboom
} li_namespace; // haleyjd 05/21/02: renamed from "namespace"
// haleyjd 05/21/02: renamed from "namespace"
lumpinfo_namespace_t li_namespace;
wadfile_info_t *wadfile;
int position;
@ -128,7 +131,7 @@ extern int numlumps;
// one argument, pass ns_global as the default namespace
#define W_FindNumFromName(name, lump) (W_FindNumFromName)(name, ns_global, lump)
int (W_FindNumFromName)(const char *name, int ns, int lump);
int (W_FindNumFromName)(const char *name, lumpinfo_namespace_t ns, int lump);
int W_ListNumFromName(const char *name, int lump);
#define W_CheckNumForName(name) (W_CheckNumForName)(name, ns_global)
static INLINE int (W_CheckNumForName)(const char *name, int ns)

View File

@ -135,10 +135,10 @@ typedef struct
animenum_t type;
// period in tics between animations
int period;
int period;
// number of animation frames
int nanims;
int nanims;
// location of animation
point_t loc;
@ -167,7 +167,7 @@ typedef struct
int lastdrawn;
// next frame number to animate
int ctr;
int ctr;
// used by RANDOM and LEVEL when animating
int state;
@ -259,7 +259,7 @@ static anim_t epsd2animinfo[] =
{ ANIM_ALWAYS, TICRATE/4, 3, { 40, 0 }, 0, 0, {{ 0, 0, 0, 0, 0}}, 0, 0, 0, 0 }
};
static int NUMANIMS[NUMEPISODES] =
static unsigned int NUMANIMS[NUMEPISODES] =
{
sizeof(epsd0animinfo)/sizeof(anim_t),
sizeof(epsd1animinfo)/sizeof(anim_t),
@ -565,8 +565,8 @@ WI_drawOnLnode // draw stuff at a location by episode/map#
//
void WI_initAnimatedBack(void)
{
int i;
anim_t* a;
unsigned i;
anim_t* a;
if (gamemode == commercial) // no animation for DOOM2
return;
@ -602,8 +602,8 @@ void WI_initAnimatedBack(void)
//
void WI_updateAnimatedBack(void)
{
int i;
anim_t* a;
unsigned i;
anim_t* a;
if (gamemode == commercial)
return;
@ -659,7 +659,7 @@ void WI_updateAnimatedBack(void)
//
void WI_drawAnimatedBack(void)
{
int i;
unsigned i;
anim_t* a;
if (gamemode==commercial) //jff 4/25/98 Someone forgot commercial an enum
@ -1880,10 +1880,10 @@ void WI_Ticker(void)
void WI_loadData(void)
{
int i;
int j;
char name[9]; // limited to 8 characters
anim_t* a;
unsigned i;
unsigned j;
char name[9]; // limited to 8 characters
anim_t* a;
if (gamemode != commercial)
{
@ -1892,7 +1892,7 @@ void WI_loadData(void)
for (j=0;j<NUMANIMS[wbs->epsd];j++)
{
a = &anims[wbs->epsd][j];
for (i=0;i<a->nanims;i++)
for (i=0;i<((unsigned)a->nanims);i++)
{
// MONDO HACK!
if (wbs->epsd != 1 || j != 8)