Merge remote-tracking branch 'github/master'

Conflicts:
	.gitignore
	config.py
	libs/synapse/synapse.cpp
	plugins/imagehl/lbmlib.cpp
	plugins/surface_heretic2/surfacedialog.cpp
	plugins/surface_ufoai/surfacedialog.cpp
	radiant/brushscript.cpp
	radiant/main.cpp
	radiant/preferences.cpp
	tools/quake3/common/cmdlib.c
	tools/quake3/common/cmdlib.h
	tools/quake3/q3map2/path_init.c
	windows_compile_guide/index.html
This commit is contained in:
Rudolf Polzer 2012-03-27 12:11:37 +02:00
commit b7e36c120e
9 changed files with 66 additions and 41 deletions

View File

@ -708,7 +708,7 @@ void DBrush::SaveToFile( FILE *pFile ){
( *pp )->texInfo.m_texdef.scale[0], ( *pp )->texInfo.m_texdef.scale[0],
( *pp )->texInfo.m_texdef.rotate );
fprintf( pFile, buffer );
fprintf( pFile, "%s", buffer );
}
fprintf( pFile, "}\n" );

View File

@ -393,7 +393,6 @@ void idSplineList::setSelectedPoint( idVec3 *p ) {
const idVec3 *idSplineList::getPosition( long t ) {
static idVec3 interpolatedPos;
static long lastTime = -1;
int count = splineTime.Num();
if ( count == 0 ) {
@ -644,7 +643,6 @@ bool idCameraDef::waitEvent( int index ) {
void idCameraDef::buildCamera() {
int i;
int lastSwitch = 0;
idList<float> waits;
idList<int> targets;
@ -653,7 +651,6 @@ void idCameraDef::buildCamera() {
// 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: {
@ -864,7 +861,8 @@ void idCameraDef::parse( const char *( *text ) ) {
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;
}
@ -1363,7 +1361,6 @@ void idSplinePosition::write( fileHandle_t file, const char *p ) {
}
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 );

View File

@ -487,9 +487,6 @@ void TestStringClass
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 == ?

View File

@ -244,7 +244,10 @@ char *ExpandArg( const char *path ){
char *ExpandPath( const char *path ){
static char full[1024];
if ( !*qdir || path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
if ( !qdir ) {
Error( "ExpandPath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
strcpy( full, path );
return full;
}
@ -254,7 +257,7 @@ char *ExpandPath( const char *path ){
char *ExpandGamePath( const char *path ){
static char full[1024];
if ( !*gamedir ) {
if ( !gamedir[0] ) {
Error( "ExpandGamePath called without gamedir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {

View File

@ -56,7 +56,7 @@
#ifdef PATH_MAX
#define MAX_OS_PATH PATH_MAX
#else
#define MAX_OS_PATH 1024
#define MAX_OS_PATH 4096
#endif
#define MEM_BLOCKSIZE 4096

View File

@ -43,6 +43,7 @@
#include "libxml/tree.h"
// utf8 conversion
#include <glib.h>
#include <glib/gconvert.h>
#include <glib/gmem.h>

View File

@ -48,6 +48,38 @@ vec_t Random( void ){
}
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()

View File

@ -66,26 +66,21 @@ char *LokiGetHomeDir( void ){
#ifndef Q_UNIX
return NULL;
#else
static char buf[ 4096 ];
struct passwd pw, *pwp;
char *home;
uid_t id;
struct passwd *pwd;
static char homeBuf[MAX_OS_PATH];
/* 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;
}
/* look up home dir in password database */
if(!home)
{
if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) {
return pw.pw_dir;
}
endpwent();
}
snprintf( homeBuf, sizeof( homeBuf ), "%s/.", home );
@ -130,21 +125,16 @@ void LokiInitPaths( char *argv0 ){
qboolean found;
path = getenv( "PATH" );
/* do some path divining */
strcpy( temp, argv0 );
if ( strrchr( 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 = last0;
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 )
@ -160,17 +150,17 @@ void LokiInitPaths( char *argv0 ){
/* 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 ) {

View File

@ -85,6 +85,8 @@
#include "md4.h"
#include <stdlib.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* -------------------------------------------------------------------------------
@ -1512,6 +1514,9 @@ surfaceInfo_t;
/* 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 );