fix typo (?) in extractfuncs tool to fix segfault when run w/o any args.
fix some warnings. Submitted by: Ozkan Sezer
This commit is contained in:
parent
264ca3d89e
commit
faa5144244
2
build.sh
2
build.sh
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
gcc -g -o extractfuncts -DSCREWUP extractfuncs.c l_log.c l_memory.c l_precomp.c l_script.c
|
||||
clang -o extractfuncs -Wall -DSCREWUP extractfuncs.c l_log.c l_memory.c l_precomp.c l_script.c
|
||||
|
|
|
@ -196,7 +196,7 @@ void DumpReplaceFunctions (char *typeName)
|
|||
fclose( f );
|
||||
|
||||
strcpy( path, func_listfile );
|
||||
if ( f = fopen( path, "rb" ) )
|
||||
if ((f = fopen( path, "rb" )) != NULL)
|
||||
{
|
||||
fseek( f, 0, SEEK_END );
|
||||
newlen = ftell( f );
|
||||
|
@ -264,7 +264,7 @@ void DumpReplaceFunctions (char *typeName)
|
|||
fclose( f );
|
||||
|
||||
strcpy( path, func_decsfile );
|
||||
if ( f = fopen( path, "rb" ) )
|
||||
if ((f = fopen( path, "rb" )) != NULL)
|
||||
{
|
||||
fseek( f, 0, SEEK_END );
|
||||
newlen = ftell( f );
|
||||
|
@ -734,7 +734,7 @@ void main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (argc < 1 || (firstParmSet && firstParm < 1))
|
||||
if (argc < 2 || (firstParmSet && firstParm < 1))
|
||||
Usage ();
|
||||
// end Knightmare
|
||||
|
||||
|
@ -756,6 +756,8 @@ void main (int argc, char *argv[])
|
|||
DumpReplaceFunctions (typeName);
|
||||
else
|
||||
DumpReplaceFunctions (NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
|
@ -818,7 +820,7 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (argc < 1 || (firstParmSet && firstParm < 1))
|
||||
if (argc < 2 || (firstParmSet && firstParm < 1))
|
||||
Usage ();
|
||||
// end Knightmare
|
||||
|
||||
|
@ -835,6 +837,8 @@ int main (int argc, char *argv[])
|
|||
DumpReplaceFunctions (typeName);
|
||||
else
|
||||
DumpReplaceFunctions (NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
17
l_precomp.c
17
l_precomp.c
|
@ -49,6 +49,7 @@ you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, R
|
|||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include "l_memory.h"
|
||||
#include "l_script.h"
|
||||
#include "l_precomp.h"
|
||||
|
@ -789,12 +790,12 @@ void PC_AddBuiltinDefines( source_t *source ) {
|
|||
char *string;
|
||||
int builtin;
|
||||
} builtin[] = {
|
||||
"__LINE__", BUILTIN_LINE,
|
||||
"__FILE__", BUILTIN_FILE,
|
||||
"__DATE__", BUILTIN_DATE,
|
||||
"__TIME__", BUILTIN_TIME,
|
||||
// "__STDC__", BUILTIN_STDC,
|
||||
NULL, 0
|
||||
{ "__LINE__", BUILTIN_LINE },
|
||||
{ "__FILE__", BUILTIN_FILE },
|
||||
{ "__DATE__", BUILTIN_DATE },
|
||||
{ "__TIME__", BUILTIN_TIME },
|
||||
// { "__STDC__", BUILTIN_STDC },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
for ( i = 0; builtin[i].string; i++ )
|
||||
|
@ -811,7 +812,7 @@ void PC_AddBuiltinDefines( source_t *source ) {
|
|||
#else
|
||||
define->next = source->defines;
|
||||
source->defines = define;
|
||||
#endif //DEFINEHASHING
|
||||
#endif /* DEFINEHASHING */
|
||||
} //end for
|
||||
} //end of the function PC_AddBuiltinDefines
|
||||
//============================================================================
|
||||
|
@ -823,7 +824,7 @@ void PC_AddBuiltinDefines( source_t *source ) {
|
|||
int PC_ExpandBuiltinDefine( source_t *source, define_t *define,
|
||||
token_t **firsttoken, token_t **lasttoken ) {
|
||||
token_t token;
|
||||
unsigned long t; // time_t t; //to prevent LCC warning
|
||||
time_t t;
|
||||
char *curtime;
|
||||
|
||||
memcpy( &token, &source->token, sizeof( token_t ) );
|
||||
|
|
|
@ -721,13 +721,13 @@ int PS_ReadNumber( script_t *script, token_t *token ) {
|
|||
{
|
||||
c = *script->script_p;
|
||||
//check for a LONG number
|
||||
if ( c == 'l' || c == 'L' &&
|
||||
if ( (c == 'l' || c == 'L') &&
|
||||
!( token->subtype & TT_LONG ) ) {
|
||||
script->script_p++;
|
||||
token->subtype |= TT_LONG;
|
||||
} //end if
|
||||
//check for an UNSIGNED number
|
||||
else if ( c == 'u' || c == 'U' &&
|
||||
else if ( (c == 'u' || c == 'U') &&
|
||||
!( token->subtype & ( TT_UNSIGNED | TT_FLOAT ) ) ) {
|
||||
script->script_p++;
|
||||
token->subtype |= TT_UNSIGNED;
|
||||
|
@ -736,7 +736,7 @@ int PS_ReadNumber( script_t *script, token_t *token ) {
|
|||
token->string[len] = '\0';
|
||||
#ifdef NUMBERVALUE
|
||||
NumberValue( token->string, token->subtype, &token->intvalue, &token->floatvalue );
|
||||
#endif //NUMBERVALUE
|
||||
#endif /* NUMBERVALUE */
|
||||
if ( !( token->subtype & TT_FLOAT ) ) {
|
||||
token->subtype |= TT_INTEGER;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue