1
0
Fork 0
forked from fte/fteqw

fix some compile errors+warnings.

fix sqlite3 to use the correct .so in linux (or at least debian).
remove dupes from qc filesystem searches.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5020 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2016-09-09 18:46:08 +00:00
parent 7ed590b3cc
commit 669b9c0d02
11 changed files with 47 additions and 23 deletions

View file

@ -1025,10 +1025,12 @@ void INS_Commands (void) //used to Cbuf_AddText joystick button events in window
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, unsigned int *qdevid))
{
#if SDL_MAJOR_VERSION >= 2
unsigned int i;
for (i = 0; i < MAX_JOYSTICKS; i++)
if (sdljoy[i].controller || sdljoy[i].joystick)
callback(ctx, "joy", sdljoy[i].devname, &sdljoy[i].qdevid);
#endif
}

View file

@ -20,7 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//well, linux or cygwin (windows with posix emulation layer), anyway...
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>

View file

@ -722,4 +722,7 @@ int Sys_GetAutoUpdateSetting(void)
void Sys_SetAutoUpdateSetting(int newval)
{
}
void Sys_SetUpdatedBinary(const char *fname)
{
}
#endif

View file

@ -1437,6 +1437,11 @@ const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen)
s = pattern;
seg = o = outbuf;
if (!pattern)
{
Con_Printf("Error: Empty filename\n");
return NULL;
}
for(;;)
{
if (o == end)
@ -1474,6 +1479,11 @@ const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen)
//it should just make more stuff invalid
while (*seg == ' ')
seg++;
if (!seg[0])
{
Con_Printf("Error: No filename (%s)\n", pattern);
return NULL;
}
if (seg[0] == '.')
{
if (o == seg+1)

View file

@ -2392,6 +2392,13 @@ int QDECL search_enumerate(const char *name, qofs_t fsize, time_t mtime, void *p
{
prvmsearch_t *s = parm;
size_t i;
for (i = 0; i < s->entries; i++)
{
if (!Q_strcasecmp(name, s->entry[i].name))
return true; //already in the list, apparently. try to avoid dupes.
}
s->entry = BZ_Realloc(s->entry, ((s->entries+64)&~63) * sizeof(*s->entry));
s->entry[s->entries].name = BZ_Malloc(strlen(name)+1);
strcpy(s->entry[s->entries].name, name);

View file

@ -1109,13 +1109,21 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
}
if (!buf)
continue;
if (filesize < 4)
{
BZ_Free(buf);
continue;
}
//
// fill it in
//
Mod_DoCRC(mod, (char*)buf, filesize);
magic = LittleLong(*(unsigned *)buf);
if (filesize < 4)
magic = 0;
else
magic = LittleLong(*(unsigned *)buf);
for(i = 0; i < sizeof(modelloaders) / sizeof(modelloaders[0]); i++)
{
if (modelloaders[i].load && modelloaders[i].magic == magic && !modelloaders[i].ident)
@ -1147,7 +1155,7 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
}
else
{
Con_Printf(CON_WARNING "Unrecognised model format 0x%x (%c%c%c%c)\n", LittleLong(*(unsigned *)buf), ((char*)buf)[0], ((char*)buf)[1], ((char*)buf)[2], ((char*)buf)[3]);
Con_Printf(CON_WARNING "Unrecognised model format 0x%x (%c%c%c%c)\n", magic, ((char*)buf)[0], ((char*)buf)[1], ((char*)buf)[2], ((char*)buf)[3]);
BZ_Free(buf);
continue;
}

View file

@ -11686,7 +11686,10 @@ QCC_function_t *QCC_PR_GenerateQCFunction (QCC_def_t *def, QCC_type_t *type, pbo
}
}
else if (dowrap)
{
QCC_PR_ParseError(ERR_INTERNAL, "cannot wrap bodyless function %s", def->name);
return NULL;
}
else
func = &functions[numfunctions++];
func->filen = s_filen;
@ -11828,7 +11831,6 @@ QCC_function_t *QCC_PR_ParseImmediateStatements (QCC_def_t *def, QCC_type_t *typ
{ //if we're wrapping, then we moved the old function entry to the end and reused it for our function.
//so we need to define some local that refers to the prior def.
QCC_sref_t priorim = QCC_MakeIntConst(numfunctions-1);
prior;
prior = QCC_PR_DummyDef(f->type, "prior", f, 0, priorim.sym, 0, true, GDF_CONST); //create a union into it
prior->initialized = true;
prior->filen = functions[numfunctions-1].filen;
@ -14095,7 +14097,7 @@ void QCC_PR_ParseDefs (char *classname)
//if weak, only use the first non-weak version of the function
if (autoprototype || dostrip || (def->initialized && doweak) || (!def->initialized && doweak && dowrap))
{ //ignore the code and stuff
if ((dostrip || doweak && dowrap) && !def->initialized)
if ((dostrip || (doweak && dowrap)) && !def->initialized)
def->initialized = 3;
if (dostrip)
def->referenced = true;

View file

@ -181,22 +181,6 @@ pbool QCC_PR_UnInclude(void)
return true;
}
/*
==============
PR_PrintNextLine
==============
*/
static void QCC_PR_PrintNextLine (void)
{
char *t;
printf ("%3i:",pr_source_line);
for (t=pr_line_start ; *t && *t != '\n' ; t++)
printf ("%c",*t);
printf ("\n");
}
static void QCC_Canonicalize(char *fullname, size_t fullnamesize, char *newfile, char *base)
{
int doubledots;

View file

@ -10929,7 +10929,7 @@ void PR_DumpPlatform_f(void)
#else
//eg: pr_dumpplatform -FFTE -TCS -O csplat
const char *keywords[] =
/*const char *keywords[] =
{
"ignore" //0
"qwqc", //qw
@ -10947,7 +10947,7 @@ void PR_DumpPlatform_f(void)
"mncsqwqc", //mn|cs|qw
"mncsnqqc", //mn|cs|nq
"" //mn|cs|nq|qw
};
};*/
int idx;
int i, j;

View file

@ -1035,7 +1035,11 @@ qboolean SQL_Available(void)
#endif
#ifdef USE_SQLITE
//our sqlite implementation is sandboxed. we block database attachments, and restrict the master database name.
#ifdef _WIN32
sqlitehandle = Sys_LoadLibrary("sqlite3", sqlitefuncs);
#else
sqlitehandle = Sys_LoadLibrary("libsqlite3.so.0", sqlitefuncs); //at least on debian.
#endif
if (sqlitehandle)
{
sqlavailable |= 1u<<SQLDRV_SQLITE;

View file

@ -18,8 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef __i386__
#ifndef _GNU_SOURCE
#define _GNU_SOURCE //we need this in order to fix up broken backtraces. make sure its defined only where needed so we still some posixy conformance test on one plat.
#endif
#endif
#include <signal.h>
#include <sys/types.h>