Skip to content

Commit

Permalink
Fixed a number of compiler warnings.
Browse files Browse the repository at this point in the history
Mostly about type conversions, discarding const.
  • Loading branch information
skyjake committed Mar 8, 2011
1 parent e9074ea commit d233d90
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/api/doomsday.h
Expand Up @@ -446,7 +446,7 @@ extern "C" {
int useMipmap, boolean clamped,
int otherFlags);
DGLuint GL_NewTextureWithParams3(int format, int width,
int height, void* pixels,
int height, const void* pixels,
int flags, int minFilter,
int magFilter, int anisoFilter,
int wrapS, int wrapT);
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/include/gl_defer.h
Expand Up @@ -71,15 +71,15 @@ int GL_GetDeferredCount(void);
void GL_InitTextureContent(texturecontent_t* content);
DGLuint GL_NewTexture(texturecontent_t* content, boolean* result);
DGLuint GL_NewTextureWithParams(dgltexformat_t format, int width,
int height, void* pixels,
int height, const void* pixels,
int flags);
DGLuint GL_NewTextureWithParams2(dgltexformat_t format, int width,
int height, void* pixels,
int height, const void* pixels,
int flags, int minFilter,
int magFilter, int anisoFilter,
int wrapS, int wrapT);
DGLuint GL_NewTextureWithParams3(dgltexformat_t format, int width,
int height, void* pixels,
int height, const void* pixels,
int flags, int minFilter,
int magFilter, int anisoFilter,
int wrapS, int wrapT);
Expand Down
15 changes: 9 additions & 6 deletions doomsday/engine/portable/src/cl_mobj.c
Expand Up @@ -829,11 +829,10 @@ boolean Cl_RevealMobj(clmobj_t *cmo)
// Don't reveal just yet. We lack a vital piece of information.
return false;
}
/*
#ifdef _DEBUG
Con_Printf("Cl_RMD2: Mo %i Hidden status lifted.\n", cmo->mo.thinker.id);
Con_Message("Cl_RevealMobj: clmobj %i Hidden status lifted.\n", cmo->mo.thinker.id);
#endif
*/

cmo->flags &= ~CLMF_HIDDEN;

// Start a sound that has been queued for playing at the time
Expand All @@ -846,9 +845,9 @@ Con_Printf("Cl_RMD2: Mo %i Hidden status lifted.\n", cmo->mo.thinker.id);
}

#ifdef _DEBUG
VERBOSE2( Con_Printf("Cl_RevealMobj: Revealing id %i, state %p (%i)\n",
cmo->mo.thinker.id, cmo->mo.state,
cmo->mo.state - states) );
VERBOSE2( Con_Printf("Cl_RevealMobj: Revealing id %i, state %p (%i)\n",
cmo->mo.thinker.id, cmo->mo.state,
(int)(cmo->mo.state - states)) );
#endif

return true;
Expand Down Expand Up @@ -890,6 +889,10 @@ void Cl_ReadMobjDelta2(boolean skip)
cmo = Cl_FindMobj(id);
if(!cmo)
{
#ifdef _DEBUG
Con_Message("Cl_ReadMobjDelta: Creating new clmobj %i (hidden).\n", id);
#endif

// This is a new ID, allocate a new mobj.
cmo = Cl_CreateMobj(id);
cmo->mo.ddFlags |= DDMF_NOGRAVITY; // safer this way
Expand Down
3 changes: 1 addition & 2 deletions doomsday/engine/portable/src/cl_oldworld.c
Expand Up @@ -265,8 +265,7 @@ int Cl_ReadSideDelta(void)
line->flags &= ~0xff;
line->flags |= updatedFlags;
#if _DEBUG
Con_Printf("lineflag %i: %02x\n", GET_LINE_IDX(line),
updatedFlags);
Con_Printf("lineflag %i: %02x\n", (int)(GET_LINE_IDX(line)), updatedFlags);
#endif
}
}
Expand Down
10 changes: 4 additions & 6 deletions doomsday/engine/portable/src/dgl_texture.c
Expand Up @@ -407,7 +407,7 @@ void GL_GetColorPaletteRGB(DGLuint id, DGLubyte rgb[3], ushort idx)
Con_Message("GL_GetColorPaletteRGB: Warning, color idx %u "
"out of range in palette %u.\n", idx, id))

idx = MINMAX_OF(0, idx, pal->num-1) * 3;
idx = MIN_OF(idx, pal->num-1) * 3;
rgb[CR] = pal->data[idx];
rgb[CG] = pal->data[idx + 1];
rgb[CB] = pal->data[idx + 2];
Expand All @@ -428,7 +428,7 @@ boolean GL_PalettizeImage(byte* out, int outformat, DGLuint palid,

for(i = 0; i < numPixels; ++i, in += inSize, out += outSize)
{
ushort idx = MINMAX_OF(0, (*in), pal->num) * 3;
ushort idx = MIN_OF((*in), pal->num) * 3;

if(gammaCorrect)
{
Expand Down Expand Up @@ -522,8 +522,7 @@ void GL_DeSaturatePalettedImage(byte* buffer, DGLuint palid, int width,
max = 0;
for(i = 0; i < numpels; ++i)
{
const DGLubyte* rgb = &pal->data[
MINMAX_OF(0, buffer[i], pal->num) * 3];
const DGLubyte* rgb = &pal->data[MIN_OF(buffer[i], pal->num) * 3];
int temp;

temp = (2 * (int)rgb[CR] + 4 * (int)rgb[CG] + 3 * (int)rgb[CB]) / 9;
Expand All @@ -533,8 +532,7 @@ void GL_DeSaturatePalettedImage(byte* buffer, DGLuint palid, int width,

for(i = 0; i < numpels; ++i)
{
const DGLubyte* rgb = &pal->data[
MINMAX_OF(0, buffer[i], pal->num) * 3];
const DGLubyte* rgb = &pal->data[MIN_OF(buffer[i], pal->num) * 3];
int temp;

// Calculate a weighted average.
Expand Down
14 changes: 7 additions & 7 deletions doomsday/engine/portable/src/gl_defer.c
Expand Up @@ -359,9 +359,9 @@ DGLuint GL_NewTexture(texturecontent_t* content, boolean* result)
// Let's do this right away. No need to take a copy.
GL_UploadTextureContent(content);
#ifdef _DEBUG
Con_Message("GL_NewTexture: Uploading (%i:%ix%i) while not busy! "
VERBOSE2(Con_Message("GL_NewTexture: Uploading (%i:%ix%i) while not busy! "
"Should be precached in busy mode?\n", content->name,
content->width, content->height);
content->width, content->height));
#endif
deferred = false; // We haven't deferred.
}
Expand Down Expand Up @@ -389,21 +389,21 @@ Con_Message("GL_NewTexture: Uploading (%i:%ix%i) while not busy! "
}

DGLuint GL_NewTextureWithParams(dgltexformat_t format, int width,
int height, void* pixels, int flags)
int height, const void* pixels, int flags)
{
texturecontent_t c;

GL_InitTextureContent(&c);
c.format = format;
c.width = width;
c.height = height;
c.buffer = pixels;
c.buffer = (void*)pixels;
c.flags = flags;
return GL_NewTexture(&c, NULL);
}

DGLuint GL_NewTextureWithParams2(dgltexformat_t format, int width,
int height, void* pixels, int flags,
int height, const void* pixels, int flags,
int minFilter, int magFilter,
int anisoFilter, int wrapS, int wrapT)
{
Expand All @@ -413,7 +413,7 @@ DGLuint GL_NewTextureWithParams2(dgltexformat_t format, int width,
c.format = format;
c.width = width;
c.height = height;
c.buffer = pixels;
c.buffer = (void*)pixels;
c.flags = flags;
c.magFilter = magFilter;
c.minFilter = minFilter;
Expand All @@ -428,7 +428,7 @@ DGLuint GL_NewTextureWithParams2(dgltexformat_t format, int width,
* of the paramaters use the DGL counterparts.
*/
DGLuint GL_NewTextureWithParams3(dgltexformat_t format, int width,
int height, void* pixels, int flags,
int height, const void* pixels, int flags,
int minFilter, int magFilter,
int anisoFilter, int wrapS, int wrapT)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/m_args.c
Expand Up @@ -293,7 +293,7 @@ const char** ArgvPtr(int i)
{
if(i < 0 || i >= numArgs)
Con_Error("ArgvPtr: There is no arg %i.\n", i);
return &args[i];
return (const char**) &args[i];
}

const char* ArgNext(void)
Expand Down
5 changes: 2 additions & 3 deletions doomsday/engine/portable/src/net_buf.c
Expand Up @@ -307,8 +307,7 @@ void N_SendPacket(int flags)
// Ordered and confirmed messages are send over a TCP connection.
N_SendDataBufferReliably(data, size, dest);
#if _DEBUG
VERBOSE2(
Con_Message("N_SendPacket: Sending %ul bytes reliably to %i.\n", size, dest));
VERBOSE2(Con_Message("N_SendPacket: Sending %li bytes reliably to %i.\n", size, dest));
#endif
}
else
Expand Down Expand Up @@ -455,7 +454,7 @@ void N_PrintHuffmanStats(void)
}
else
{
Con_Printf("Huffman efficiency: %.3f%% (data: %ul bytes, sent: %ul "
Con_Printf("Huffman efficiency: %.3f%% (data: %li bytes, sent: %li "
"bytes)\n", 100 - (100.0f * numSentBytes) / numOutBytes,
numOutBytes, numSentBytes);
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/p_sight.c
Expand Up @@ -227,7 +227,7 @@ static boolean crossSSec(uint ssecIdx, losdata_t* los)

{
// Check lines.
const seg_t** segPtr = ssec->segs;
const seg_t** segPtr = (const seg_t**) ssec->segs;

while(*segPtr)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/rend_fakeradio.c
Expand Up @@ -1018,7 +1018,7 @@ static void setSideShadowParams(rendershadowseg_params_t* p,

static void quadTexCoords(rtexcoord_t* tc, const rvertex_t* rverts,
float wallLength, float texWidth, float texHeight,
const float texOrigin[2][3], const float texOffset[2],
/*const*/ float texOrigin[2][3], const float texOffset[2],
boolean horizontal)
{
if(horizontal)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/sys_master.c
Expand Up @@ -277,7 +277,7 @@ static int C_DECL N_MasterSendRequest(void *parm)
if(!curl_easy_perform(session))
{
#ifdef _DEBUG
printf(Str_Text(&response));
printf("%s", Str_Text(&response));
#endif

// Let's parse the message.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/p_xgline.c
Expand Up @@ -424,7 +424,7 @@ void XG_Dev(const char* format, ...)
va_start(args, format);
dd_vsnprintf(buffer, sizeof(buffer), format, args);
strcat(buffer, "\n");
Con_Message(buffer);
Con_Message("%s", buffer);
va_end(args);
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jdoom/src/m_cheat.c
Expand Up @@ -489,7 +489,7 @@ static void printDebugInfo(player_t* plr)
P_SetMessage(plr, textBuffer, false);

// Also print some information to the console.
Con_Message(textBuffer);
Con_Message("%s", textBuffer);
sub = plr->plr->mo->subsector;
Con_Message("\nSubsector %i:\n", P_ToIndex(sub));
Con_Message(" FloorZ:%g Material:%s\n",
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jheretic/src/m_cheat.c
Expand Up @@ -382,7 +382,7 @@ static void printDebugInfo(int player)
P_SetMessage(plr, textBuffer, false);

// Also print some information to the console.
Con_Message(textBuffer);
Con_Message("%s", textBuffer);
sub = plr->plr->mo->subsector;
Con_Message("\nSubsector %i:\n", P_ToIndex(sub));
Con_Message(" FloorZ:%g Material:%s\n",
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jhexen/src/m_cheat.c
Expand Up @@ -454,7 +454,7 @@ static void printDebugInfo(int player)
P_SetMessage(plr, textBuffer, false);

// Also print some information to the console.
Con_Message(textBuffer);
Con_Message("%s", textBuffer);
sub = plr->plr->mo->subsector;
Con_Message("\nSubsector %i:\n", P_ToIndex(sub));
Con_Message(" FloorZ:%g Material:%s\n",
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/wadmapconverter/src/load.c
Expand Up @@ -174,7 +174,7 @@ static const materialref_t* getMaterial(const char* regName,

const materialref_t* GetMaterial(const char* name, boolean isFlat)
{
return getMaterial(name, isFlat? &map->flats : &map->textures,
return getMaterial(name, (materialref_t* const**)(isFlat? &map->flats : &map->textures),
isFlat? map->numFlats : map->numTextures);
}

Expand Down

0 comments on commit d233d90

Please sign in to comment.