-
-# /
+/install/q3map2
+/install/radiant.bin
+/.sconsign.dblite
+/site.sconf
+/build
+*.pyc
+*.so
env.Append( CXXFLAGS = [ '-g' ] )
env.Append( CPPDEFINES = [ '_DEBUG' ] )
else:
- # '-O' causes q3map2 errors on Ubuntu 10.10 32 bit.
- env.Append( CFLAGS = [ ] )
- env.Append( CXXFLAGS = [ ] )
+ env.Append( CFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
+ env.Append( CXXFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
def CheckoutOrUpdate( self, svnurl, path ):
if ( os.path.exists( path ) ):
( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0],
( *pp )->texInfo.m_fRotate );
- fprintf( pFile, buffer );
+ fprintf( pFile, "%s", buffer );
}
fprintf( pFile, "}\n" );
const idVec3 *idSplineList::getPosition( long t ) {
static idVec3 interpolatedPos;
- static long lastTime = -1;
int count = splineTime.Num();
if ( count == 0 ) {
void idCameraDef::buildCamera() {
int i;
- int lastSwitch = 0;
idList<float> waits;
idList<int> targets;
// we have a base time layout for the path and the target path
// now we need to layer on any wait or speed changes
for ( i = 0; i < events.Num(); i++ ) {
- idCameraEvent *ev = events[i];
events[i]->setTriggered( false );
switch ( events[i]->getType() ) {
case idCameraEvent::EVENT_TARGET: {
bool idCameraDef::load( const char *filename ) {
char *buf;
const char *buf_p;
- int length = FS_ReadFile( filename, (void **)&buf );
+
+ FS_ReadFile( filename, (void **)&buf );
if ( !buf ) {
return false;
}
}
void idCameraDef::addTarget( const char *name, idCameraPosition::positionType type ) {
- const char *text = ( name == NULL ) ? va( "target0%d", numTargets() + 1 ) : name;
idCameraPosition *pos = newFromType( type );
if ( pos ) {
pos->setName( name );
i = a.length(); // i == 0
i = c.length(); // i == 4
- const char *s1 = a.c_str(); // s1 == "\0"
- const char *s2 = c.c_str(); // s2 == "test\0"
-
t = new idStr(); // t->len == 0, t->data == "\0"
delete t; // t == ?
va_start( args, text );
vsnprintf( buf, BUFFER_SIZE, text, args );
buf[BUFFER_SIZE - 1] = 0;
- printf( buf );
+ printf( "%s", buf );
va_end( args );
}
}
dspriteframetype_t *pframetype;
int version;
int numframes;
- int size;
- spriteframetype_t frametype;
dspriteframe_t *spriteframe;
*pic = NULL;
*pic = bmpRGBA;
#ifdef DEBUG
- frametype = spriteframetype_t( LittleLong( pframetype->type ) );
+ spriteframetype_t frametype = spriteframetype_t( LittleLong( pframetype->type ) );
if ( frametype == SPR_SINGLE ) {
Sys_Printf( "Single Frame\n" );
}
void IsFaceConflicting(){
texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list;
- char buf[12];
char texture_name[128];
if ( texdef_face_list_empty() ) {
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
- GList *tmp_item;
int num_of_list_items = 0;
blank[0] = 0;
g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) {
- texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
// Axial Button
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef;
- texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
if ( !texdef_face_list_empty() && g_bListenChanged ) {
void IsFaceConflicting(){
texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list;
- char buf[12];
char texture_name[128];
if ( texdef_face_list_empty() ) {
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
- GList *tmp_item;
int num_of_list_items = 0;
blank[0] = 0;
g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) {
- texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
// Axial Button
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef;
- texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
if ( !texdef_face_list_empty() && g_bListenChanged ) {
const char *fields[5] = { "", "", "", "", "" };
float values[5];
- for ( int n = 0; n < g_nVariableCount; n++ )
+ for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
{
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
bGo = true;
- if ( n < 5 ) {
- switch ( n )
- {
- case 0: fields[1] = g_Variables[n].m_strInput.GetBuffer(); break;
- case 1: fields[2] = g_Variables[n].m_strInput.GetBuffer(); break;
- case 2: fields[3] = g_Variables[n].m_strInput.GetBuffer(); break;
- case 3: fields[4] = g_Variables[n].m_strInput.GetBuffer(); break;
- case 4: fields[5] = g_Variables[n].m_strInput.GetBuffer(); break;
- }
- }
+ fields[n] = g_Variables[n].m_strInput.GetBuffer();
}
}
- if ( bGo ) {
- if ( DoBSInputDlg( fields, values ) == IDOK ) {
- for ( int n = 0; n < g_nVariableCount; n++ )
- {
- if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
- if ( n < 5 ) {
- switch ( n )
- {
- case 0: g_Variables[n].m_fValue = values[1]; break;
- case 1: g_Variables[n].m_fValue = values[2]; break;
- case 2: g_Variables[n].m_fValue = values[3]; break;
- case 3: g_Variables[n].m_fValue = values[4]; break;
- case 4: g_Variables[n].m_fValue = values[5]; break;
- }
- }
- }
- }
+ if ( !bGo ) {
+ return;
+ }
+
+ if ( DoBSInputDlg( fields, values ) != IDOK ) {
+ g_bKeepGoing = false;
+ return;
+ }
+
+ for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
+ {
+ if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
+ g_Variables[n].m_fValue = values[n];
}
- else{ g_bKeepGoing = false; }
}
}
Error( "Can't write to %s", batpath );
}
fprintf( hFile, "#!/bin/sh \n\n" );
- fprintf( hFile, strSys.GetBuffer() );
+ fprintf( hFile, "%s", strSys.GetBuffer() );
fclose( hFile );
chmod( batpath, 0744 );
#endif
if ( !hFile ) {
Error( "Can't write to %s", batpath );
}
- fprintf( hFile, strSys.GetBuffer() );
+ fprintf( hFile, "%s", strSys.GetBuffer() );
fclose( hFile );
#endif
char *ExpandPath( const char *path ){
static char full[1024];
- if ( !qdir ) {
+ if ( !qdir[0] ) {
Error( "ExpandPath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
char *ExpandGamePath( const char *path ){
static char full[1024];
- if ( !qdir ) {
+ if ( !qdir[0] ) {
Error( "ExpandGamePath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
#endif
-#define MAX_OS_PATH 1024
+#define MAX_OS_PATH 4096
#define MEM_BLOCKSIZE 4096
// the dec offsetof macro doesnt work very well...
static qboolean bGotXML = qfalse;
char level[2];
- printf( buf );
+ printf( "%s", buf );
// the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe?
if ( flag == SYS_NOXML ) {
int i, x, y, z, x1, y1, z1;
light_t *light, *light2, **owner;
bspLeaf_t *leaf;
- vec3_t origin, dir, mins, maxs, nullVector = { 0, 0, 0 };
+ vec3_t origin, dir, mins, maxs;
float radius, intensity;
light_t *buckets[ 256 ];
}
+char *Q_strncpyz( char *dst, const char *src, size_t len ) {
+ if ( len == 0 ) {
+ abort();
+ }
+
+ strncpy( dst, src, len );
+ dst[ len - 1 ] = '\0';
+ return dst;
+}
+
+
+char *Q_strcat( char *dst, size_t dlen, const char *src ) {
+ size_t n = strlen( dst );
+
+ if ( n > dlen ) {
+ abort(); /* buffer overflow */
+ }
+
+ return Q_strncpyz( dst + n, src, dlen - n );
+}
+
+
+char *Q_strncat( char *dst, size_t dlen, const char *src, size_t slen ) {
+ size_t n = strlen( dst );
+
+ if ( n > dlen ) {
+ abort(); /* buffer overflow */
+ }
+
+ return Q_strncpyz( dst + n, src, MIN( slen, dlen - n ) );
+}
+
/*
ExitQ3Map()
#ifndef Q_UNIX
return NULL;
#else
+ static char buf[ 4096 ];
+ struct passwd pw, *pwp;
char *home;
- uid_t id;
- struct passwd *pwd;
/* get the home environment variable */
home = getenv( "HOME" );
- if ( home == NULL ) {
- /* do some more digging */
- id = getuid();
- setpwent();
- while ( ( pwd = getpwent() ) != NULL )
- {
- if ( pwd->pw_uid == id ) {
- home = pwd->pw_dir;
- break;
- }
- }
- endpwent();
+ if ( home ) {
+ return Q_strncpyz( buf, home, sizeof( buf ) );
+ }
+
+ /* look up home dir in password database */
+ if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) {
+ return pw.pw_dir;
}
- /* return it */
- return home;
+ return NULL;
#endif
}
home = ".";
}
+ path = getenv( "PATH" );
+
/* do some path divining */
- strcpy( temp, argv0 );
+ Q_strncpyz( temp, argv0, sizeof( temp ) );
if ( strrchr( temp, '/' ) ) {
argv0 = strrchr( argv0, '/' ) + 1;
}
- else
- {
- /* get path environment variable */
- path = getenv( "PATH" );
-
- /* minor setup */
- last[ 0 ] = path[ 0 ];
- last[ 1 ] = '\0';
+ else if ( path ) {
found = qfalse;
+ last = path;
/* go through each : segment of path */
while ( last[ 0 ] != '\0' && found == qfalse )
/* found home dir candidate */
if ( *path == '~' ) {
- strcpy( temp, home );
+ Q_strncpyz( temp, home, sizeof( temp ) );
path++;
}
/* concatenate */
if ( last > ( path + 1 ) ) {
- strncat( temp, path, ( last - path ) );
- strcat( temp, "/" );
+ Q_strncat( temp, sizeof( temp ), path, ( last - path ) );
+ Q_strcat( temp, sizeof( temp ), "/" );
}
- strcat( temp, "./" );
- strcat( temp, argv0 );
+ Q_strcat( temp, sizeof( temp ), "./" );
+ Q_strcat( temp, sizeof( temp ), argv0 );
/* verify the path */
if ( access( temp, X_OK ) == 0 ) {
#include <stdlib.h>
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* -------------------------------------------------------------------------------
/* main.c */
vec_t Random( void );
+char *Q_strncpyz( char *dst, const char *src, size_t len );
+char *Q_strcat( char *dst, size_t dlen, const char *src );
+char *Q_strncat( char *dst, size_t dlen, const char *src, size_t slen );
int BSPInfo( int count, char **fileNames );
int ScaleBSPMain( int argc, char **argv );
int ConvertMain( int argc, char **argv );