mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
Remove some array length limitations with package lists.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5875 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
148de2e082
commit
b4092ab903
4 changed files with 30 additions and 31 deletions
|
@ -1882,6 +1882,8 @@ void CL_ClearState (qboolean gamestart)
|
|||
}
|
||||
|
||||
Z_Free(cl.windowtitle);
|
||||
Z_Free(cl.serverpacknames);
|
||||
Z_Free(cl.serverpackhashes);
|
||||
|
||||
InfoBuf_Clear(&cl.serverinfo, true);
|
||||
|
||||
|
@ -2278,13 +2280,13 @@ void CL_PakDownloads(int mode)
|
|||
*/
|
||||
char local[256];
|
||||
char *pname;
|
||||
char *s = cl.serverpakcrcs;
|
||||
char *s = cl.serverpackhashes;
|
||||
int i;
|
||||
|
||||
if (!cl.serverpakschanged || !mode)
|
||||
return;
|
||||
|
||||
Cmd_TokenizeString(cl.serverpaknames, false, false);
|
||||
Cmd_TokenizeString(cl.serverpacknames, false, false);
|
||||
for (i = 0; i < Cmd_Argc(); i++)
|
||||
{
|
||||
s = COM_Parse(s);
|
||||
|
@ -2318,13 +2320,13 @@ void CL_CheckServerPacks(void)
|
|||
pure = cl_pure.ival;
|
||||
pure = bound(0, pure, 2);
|
||||
|
||||
if (!*cl.serverpakcrcs || cls.demoplayback)
|
||||
if (!cl.serverpackhashes || cls.demoplayback)
|
||||
pure = 0;
|
||||
|
||||
if (pure != oldpure || cl.serverpakschanged)
|
||||
{
|
||||
CL_PakDownloads((pure && !cl_download_packages.ival)?1:cl_download_packages.ival);
|
||||
FS_PureMode(pure, cl.serverpaknames, cl.serverpakcrcs, NULL, NULL, cls.challenge);
|
||||
FS_PureMode(pure, cl.serverpacknames, cl.serverpackhashes, NULL, NULL, cls.challenge);
|
||||
|
||||
if (pure)
|
||||
{
|
||||
|
@ -4197,7 +4199,7 @@ static void CL_Curl_f(void)
|
|||
char localname[MAX_QPATH];
|
||||
int usage = 0;
|
||||
qboolean alreadyhave = false;
|
||||
extern char cl_dp_packagenames[4096];
|
||||
extern char *cl_dp_packagenames;
|
||||
unsigned int dlflags = DLLF_VERBOSE;
|
||||
if (argc < 2)
|
||||
{
|
||||
|
@ -4250,7 +4252,8 @@ static void CL_Curl_f(void)
|
|||
}
|
||||
else if (!strcmp(arg, "--clear_autodownload"))
|
||||
{
|
||||
*cl_dp_packagenames = 0;
|
||||
Z_Free(cl_dp_packagenames);
|
||||
cl_dp_packagenames = NULL;
|
||||
return;
|
||||
}
|
||||
else if (!strcmp(arg, "--finish_autodownload"))
|
||||
|
@ -4283,9 +4286,8 @@ static void CL_Curl_f(void)
|
|||
if (!CL_CheckOrEnqueDownloadFile(arg, localname, dlflags))
|
||||
Con_Printf("Downloading %s to %s\n", arg, localname);
|
||||
|
||||
if (*cl_dp_packagenames)
|
||||
Q_strncatz(cl_dp_packagenames, " ", sizeof(cl_dp_packagenames));
|
||||
Q_strncatz(cl_dp_packagenames, va("%s/%s", gamedir, localterse), sizeof(cl_dp_packagenames));
|
||||
if (cl_dp_packagenames)
|
||||
Z_StrCat(&cl_dp_packagenames, va("%s%s/%s", cl_dp_packagenames?" ":"", gamedir, localterse));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ static void DLC_Poll(qdownload_t *dl);
|
|||
static void CL_ProcessUserInfo (int slot, player_info_t *player);
|
||||
|
||||
#ifdef NQPROT
|
||||
char cl_dp_packagenames[4096];
|
||||
char *cl_dp_packagenames;
|
||||
static char cl_dp_csqc_progsname[128];
|
||||
static int cl_dp_csqc_progssize;
|
||||
static int cl_dp_csqc_progscrc;
|
||||
|
@ -2253,7 +2253,7 @@ static void CL_ParseChunkedDownload(qdownload_t *dl)
|
|||
if (!strncmp(svname, "package/", 8))
|
||||
{
|
||||
int i, c;
|
||||
Cmd_TokenizeString(cl.serverpaknames, false, false);
|
||||
Cmd_TokenizeString(cl.serverpacknames, false, false);
|
||||
c = Cmd_Argc();
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
|
@ -2265,10 +2265,10 @@ static void CL_ParseChunkedDownload(qdownload_t *dl)
|
|||
else
|
||||
{
|
||||
char localname[MAX_OSPATH];
|
||||
char *crc;
|
||||
Cmd_TokenizeString(cl.serverpakcrcs, false, false);
|
||||
crc = Cmd_Argv(i);
|
||||
if (FS_GenCachedPakName(svname+8, crc, localname, sizeof(localname)))
|
||||
char *hash;
|
||||
Cmd_TokenizeString(cl.serverpackhashes, false, false);
|
||||
hash = Cmd_Argv(i);
|
||||
if (FS_GenCachedPakName(svname+8, hash, localname, sizeof(localname)))
|
||||
{
|
||||
if (CL_CheckOrEnqueDownloadFile(svname+8, localname, DLLF_NONGAME))
|
||||
if (!CL_CheckDLFile(dl->localname))
|
||||
|
@ -3679,7 +3679,8 @@ static void CLQ2_ParseServerData (void)
|
|||
void CL_ParseEstablished(void)
|
||||
{
|
||||
#ifdef NQPROT
|
||||
*cl_dp_packagenames = 0;
|
||||
Z_Free(cl_dp_packagenames);
|
||||
cl_dp_packagenames = NULL;
|
||||
cl_dp_serverextension_download = false;
|
||||
*cl_dp_csqc_progsname = 0;
|
||||
cl_dp_csqc_progscrc = 0;
|
||||
|
@ -3985,19 +3986,15 @@ static void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caut
|
|||
InfoBuf_SetStarKey(&cl.serverinfo, "*csprogsname", va("%s", cl_dp_csqc_progsname));
|
||||
}
|
||||
|
||||
if (*cl_dp_packagenames)
|
||||
if (cl_dp_packagenames)
|
||||
{
|
||||
char *in = cl_dp_packagenames;
|
||||
while (*in)
|
||||
if (cl.serverpacknames)
|
||||
Z_StrCat(&cl.serverpacknames, " ");
|
||||
Z_StrCat(&cl.serverpacknames, in);
|
||||
while ((in = COM_Parse(in)))
|
||||
{
|
||||
in = COM_Parse(in);
|
||||
|
||||
if (*cl.serverpaknames)
|
||||
Q_strncatz(cl.serverpaknames, " ", sizeof(cl.serverpaknames));
|
||||
Q_strncatz(cl.serverpaknames, com_token, sizeof(cl.serverpaknames));
|
||||
if (*cl.serverpakcrcs)
|
||||
Q_strncatz(cl.serverpakcrcs, " ", sizeof(cl.serverpakcrcs));
|
||||
Q_strncatz(cl.serverpakcrcs, "-", sizeof(cl.serverpakcrcs)); //we don't have any crc info. we'll instead need this info as part of the filename.
|
||||
Z_StrCat(&cl.serverpackhashes, cl.serverpackhashes?" -":"-"); //no hash info.
|
||||
cl.serverpakschanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -6593,12 +6590,12 @@ static void CL_ParseStuffCmd(char *msg, int destsplit) //this protects stuffcmds
|
|||
|
||||
else if (!strncmp(stufftext, "//paknames ", 11)) //so that the client knows what to download...
|
||||
{ //there's a couple of prefixes involved etc
|
||||
Q_strncatz(cl.serverpaknames, stufftext+11, sizeof(cl.serverpaknames));
|
||||
Z_StrCat(&cl.serverpacknames, stufftext+(cl.serverpackhashes?11:10));
|
||||
cl.serverpakschanged = true;
|
||||
}
|
||||
else if (!strncmp(stufftext, "//paks ", 7)) //gives the client a list of hashes to match against
|
||||
{ //the client can re-order for cl_pure support, or download dupes to avoid version mismatches
|
||||
Q_strncatz(cl.serverpakcrcs, stufftext+7, sizeof(cl.serverpakcrcs));
|
||||
Z_StrCat(&cl.serverpackhashes, stufftext+(cl.serverpackhashes?7:6));
|
||||
cl.serverpakschanged = true;
|
||||
CL_CheckServerPacks();
|
||||
}
|
||||
|
|
|
@ -797,8 +797,8 @@ typedef struct
|
|||
|
||||
qboolean haveserverinfo; //nq servers will usually be false. don't override stuff if we already know better.
|
||||
infobuf_t serverinfo;
|
||||
char serverpaknames[1024];
|
||||
char serverpakcrcs[1024];
|
||||
char *serverpacknames;
|
||||
char *serverpackhashes;
|
||||
qboolean serverpakschanged;
|
||||
|
||||
int parsecount; // server message counter
|
||||
|
|
|
@ -923,7 +923,7 @@ int SQL_NewServer(void *owner, const char *driver, const char **paramstr)
|
|||
|
||||
int SQL_NewQuery(sqlserver_t *server, qboolean (*callback)(queryrequest_t *req, int firstrow, int numrows, int numcols, qboolean eof), const char *str, queryrequest_t **reqout)
|
||||
{
|
||||
int qsize = Q_strlen(str);
|
||||
int qsize = Q_strlen(str)+1;
|
||||
queryrequest_t *qreq;
|
||||
int querynum;
|
||||
|
||||
|
|
Loading…
Reference in a new issue