# minor fixes exposed by ICC 9.0 warnings

This was SVN commit r4701.
This commit is contained in:
janwas
2006-12-17 00:49:09 +00:00
parent ad060405d6
commit e3e0d513b5
14 changed files with 57 additions and 54 deletions
+2 -2
View File
@@ -738,12 +738,12 @@ static const LibError assert_err = INFO::OK;
void debug_skip_next_assert()
{
debug_skip_next_err(INFO::OK);
debug_skip_next_err(assert_err);
}
static bool should_skip_this_assert()
{
return should_skip_this_error(INFO::OK);
return should_skip_this_error(assert_err);
}
+1 -1
View File
@@ -61,7 +61,7 @@ enum State
};
/*/**/typedef void* DescList;
/*typedef void* DescList;
struct SizeClass
{
+4 -1
View File
@@ -510,8 +510,11 @@ extern u16 fp_to_u16(double in);
/**
* this is strcpy, but indicates that the programmer checked usage and
* promises it is safe.
*
* (this macro prevents actually-safe instances of the function from
* showing up in searches)
**/
#define SAFE_STRCPY strcpy
#define SAFE_STRCPY str##cpy
/**
+29 -29
View File
@@ -255,23 +255,23 @@ extern void LibError_set_errno(LibError err);
#if OS_WIN
#define CHECK_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
DEBUG_WARN_ERR(err);\
return err;\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
DEBUG_WARN_ERR(err__);\
return err__;\
}\
)
#else
#define CHECK_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
DEBUG_WARN_ERR(err);\
return (LibError)(err & UINT_MAX);\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
DEBUG_WARN_ERR(err__);\
return (LibError)(err__ & UINT_MAX);\
}\
)
#endif
@@ -280,11 +280,11 @@ STMT(\
// (useful for functions that can legitimately fail, e.g. vfs_exists).
#define RETURN_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
return err;\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
return err__;\
}\
)
@@ -299,12 +299,12 @@ STMT(\
// throw that number.
#define THROW_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
DEBUG_WARN_ERR(err);\
throw err;\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
DEBUG_WARN_ERR(err__);\
throw err__;\
}\
)
@@ -312,11 +312,11 @@ STMT(\
// (useful for void functions that must bail and complain)
#define WARN_ERR_RETURN(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
DEBUG_WARN_ERR(err);\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
DEBUG_WARN_ERR(err__);\
return;\
}\
)
@@ -325,11 +325,11 @@ STMT(\
// (this is similar to debug_assert but also works in release mode)
#define WARN_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
{\
LibError err = (LibError)(err64 & UINT_MAX);\
DEBUG_WARN_ERR(err);\
LibError err__ = (LibError)(err64__ & UINT_MAX);\
DEBUG_WARN_ERR(err__);\
}\
)
@@ -337,8 +337,8 @@ STMT(\
// if expression evaluates to a negative error code, return 0.
#define RETURN0_IF_ERR(expression)\
STMT(\
i64 err64 = (i64)(expression);\
if(err64 < 0)\
i64 err64__ = (i64)(expression);\
if(err64__ < 0)\
return 0;\
)
+3 -3
View File
@@ -293,10 +293,10 @@ LibError trace_read_from_file(const char* trace_filename, Trace* t)
for(size_t i = 0; ; i++)
{
double timestamp; char opcode; char P_path[PATH_MAX]; size_t size; uint flags;
int ret = fscanf(f, fmt, &timestamp, &opcode, P_path, &size, &flags);
if(ret == EOF)
int chars_read = fscanf(f, fmt, &timestamp, &opcode, P_path, &size, &flags);
if(chars_read == EOF)
break;
debug_assert(ret == 5);
debug_assert(chars_read == 5);
TraceOp op = TO_IO; // default in case file is garbled
switch(opcode)
+3 -3
View File
@@ -493,7 +493,7 @@ static LibError populate_dir(TDir* td, const char* P_path, const Mount* m,
// note: we are only able to add archives found in the root directory,
// due to dirent_cb implementation. that's ok - we don't want to check
// every single file to see if it's an archive (slow!).
static LibError mount_dir_tree(TDir* td, const Mount& m)
static LibError mount_dir_tree(TDir* td_start, const Mount& m)
{
LibError err = INFO::OK;
@@ -510,7 +510,7 @@ static LibError mount_dir_tree(TDir* td, const Mount& m)
// kickoff (less efficient than goto, but c_str reference requires
// pop to come at end of loop => this is easiest)
dir_queue.push_back(TDirAndPath(td, m.P_name.c_str()));
dir_queue.push_back(TDirAndPath(td_start, m.P_name.c_str()));
do
{
@@ -531,7 +531,7 @@ static LibError mount_dir_tree(TDir* td, const Mount& m)
while(!dir_queue.empty());
// do not pass parchives because that has been set to 0!
mount_archives(td, &archives, &m);
mount_archives(td_start, &archives, &m);
return INFO::OK;
}
+2 -2
View File
@@ -187,7 +187,7 @@ static LibError Ogl_Shader_validate(const Ogl_Shader* UNUSED(shdr))
static LibError Ogl_Shader_to_string(const Ogl_Shader* UNUSED(shdr), char* buf)
{
snprintf(buf, H_STRING_LEN, "");
snprintf(buf, H_STRING_LEN, "-");
return INFO::OK;
}
@@ -408,7 +408,7 @@ static LibError Ogl_Program_validate(const Ogl_Program* UNUSED(p))
static LibError Ogl_Program_to_string(const Ogl_Program* UNUSED(p), char* buf)
{
snprintf(buf, H_STRING_LEN, "");
snprintf(buf, H_STRING_LEN, "-");
return INFO::OK;
}
+2 -2
View File
@@ -184,9 +184,9 @@ static LibError UniFont_validate(const UniFont* f)
return INFO::OK;
}
static LibError UniFont_to_string(const UniFont* UNUSED(f), char* buf)
static LibError UniFont_to_string(const UniFont* f, char* buf)
{
snprintf(buf, H_STRING_LEN, "");
snprintf(buf, H_STRING_LEN, "Font %s", h_filename(f->ht));
return INFO::OK;
}
+6 -4
View File
@@ -64,6 +64,8 @@
// hopefully, OpenAL doesn't rely on them actually being unloaded.
#if OS_WIN
# define WIN_LOADLIBRARY_HACK 0
#else
# define WIN_LOADLIBRARY_HACK 0
#endif
@@ -1890,15 +1892,15 @@ static LibError vsrc_update(VSrc * vs)
if(!vs->al_src)
return INFO::OK;
FadeRet ret = fade(vs->fade, snd_update_time, vs->gain);
FadeRet fade_ret = fade(vs->fade, snd_update_time, vs->gain);
// auto-free after fadeout.
if(ret == FADE_TO_0_FINISHED)
if(fade_ret == FADE_TO_0_FINISHED)
{
vsrc_free(vs);
return INFO::OK; // don't continue - <vs> has been freed.
}
// fade in progress; latch current gain value.
else if(ret == FADE_CHANGED)
else if(fade_ret == FADE_CHANGED)
vsrc_latch(vs);
int num_queued;
@@ -2390,7 +2392,7 @@ static bool snd_disabled = false;
*
* @return LibError from al_init, or ERR::AGAIN if sound disabled
*/
static inline LibError snd_init()
static LibError snd_init()
{
// (note: each VSrc_reload and therefore snd_open will fail)
if(snd_disabled)
+2 -2
View File
@@ -24,7 +24,7 @@
#include "timer.h"
/*/*
#if 0
// checked by debug_assert_failed; disables asserts if true (see above).
// set/cleared by self_test_run.
@@ -71,4 +71,4 @@ void self_test_run_all()
debug_printf("-- done (elapsed time %.0f ms)\n", dt*1e3);
}
*/
#endif
-2
View File
@@ -343,8 +343,6 @@ static void get_cpu_type()
// note: cpu_type is guaranteed to hold 48+1 chars, since that's the
// length of the CPU brand string => we can safely copy short literals.
// (this macro hides us from 'unsafe string code' searches)
#define SAFE_STRCPY str##cpy
// fall back to manual detect of CPU type because either:
// - CPU doesn't support brand string (we use a flag to indicate this
+1 -1
View File
@@ -52,7 +52,7 @@ static LibError LibError_from_GLE(bool warn_if_failed = true)
case ERROR_INSUFFICIENT_BUFFER:
err = ERR::BUF_SIZE; break;
/*/*
/*
case ERROR_ACCESS_DENIED:
err = ERR::FILE_ACCESS; break;
case ERROR_FILE_NOT_FOUND:
+1 -1
View File
@@ -1311,7 +1311,7 @@ JSBool revealMap( JSContext* cx, JSObject* UNUSED(globalObject), uint argc, jsva
{
newValue = 2;
}
else if(!ToPrimitive( g_ScriptingHost.GetContext(), argv[0], newValue ) || newValue > 2 || newValue < 0)
else if(!ToPrimitive( g_ScriptingHost.GetContext(), argv[0], newValue ) || newValue > 2)
{
JS_ReportError( cx, "Invalid argument (should be 0, 1 or 2)" );
*rval = JSVAL_VOID;
+1 -1
View File
@@ -46,7 +46,7 @@ void CFormationManager::CreateFormation( CEntityList& entities, CStrW& name )
}
void CFormationManager::DestroyFormation( size_t form )
{
if ( form < 0 || form >= m_formations.size())
if ( form >= m_formations.size())
{
debug_warn("CFormationManager::DestroyFormation--invalid entity");
return;