fix npfte.

fix autoupdate+debugging conflict bug

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4816 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-01-02 05:57:14 +00:00
parent f8e247f1c4
commit 68bc3e753a
8 changed files with 42 additions and 25 deletions

View file

@ -125,14 +125,14 @@ void VARGS Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
Q_vsnprintfz(dest, size, fmt, argptr);
va_end (argptr);
}
char *COM_TrimString(char *str)
char *COM_TrimString(char *str, char *buffer, int buffersize)
{
int i;
static char buffer[256];
while (*str <= ' ' && *str>'\0')
str++;
for (i = 0; i < 255; i++)
for (i = 0; i < buffersize-1; i++)
{
if (*str <= ' ')
break;
@ -228,7 +228,7 @@ int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...
#include <ws2tcpip.h>
#endif
#endif
qboolean NET_StringToSockaddr (const char *s, int defaultport, struct sockaddr_qstorage *sadr, int *addrfamily, int *addrsize)
qboolean NET_StringToSockaddr2 (const char *s, int defaultport, struct sockaddr_qstorage *sadr, int *addrfamily, int *addrsize, size_t addrcount)
{
struct addrinfo *addrinfo = NULL;
struct addrinfo *pos;
@ -243,6 +243,8 @@ qboolean NET_StringToSockaddr (const char *s, int defaultport, struct sockaddr_q
void *lib = LoadLibrary("ws2_32.dll");
if (!lib)
return false;
if (addrcount != 1)
return false;
pgetaddrinfo = (void*)GetProcAddress(lib, "getaddrinfo");
pfreeaddrinfo = (void*)GetProcAddress(lib, "freeaddrinfo");
if (!pgetaddrinfo || !pfreeaddrinfo)
@ -348,8 +350,8 @@ char *COM_ParseOut (const char *data, char *out, int outlen)
int c;
int len;
if (out == com_token)
COM_AssertMainThread("COM_ParseOut: com_token");
// if (out == com_token)
// COM_AssertMainThread("COM_ParseOut: com_token");
len = 0;
out[0] = 0;

View file

@ -2726,7 +2726,7 @@ qboolean Sys_CheckUpdated(void)
return false;
else if (!COM_CheckParm("-autoupdate") && !COM_CheckParm("--autoupdate"))
return false;
else if (COM_CheckParm("-plugin"))
else if (isPlugin == 1)
{
//download, but don't invoke. the caller is expected to start us up properly (once installed).
}
@ -2737,6 +2737,7 @@ qboolean Sys_CheckUpdated(void)
char pendingpath[MAX_OSPATH];
char updatedpath[MAX_OSPATH];
//FIXME: store versions instead of names
MyRegGetStringValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" UPD_BUILDTYPE EXETYPE, pendingpath, sizeof(pendingpath));
if (*pendingpath)
{
@ -3121,9 +3122,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
host_parms.binarydir = bindir;
COM_InitArgv (parms.argc, parms.argv);
if (Sys_CheckUpdated())
return true;
c = COM_CheckParm("-plugin");
if (c)
{
@ -3135,6 +3133,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
else
isPlugin = 0;
if (Sys_CheckUpdated())
return true;
if (COM_CheckParm("-register_types"))
{
Sys_DoFileAssociations(1);

View file

@ -97,7 +97,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_D3D
#endif
#ifndef MINIMAL
#if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV)
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
#define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc.
#elif defined(__linux__) || defined(__CYGWIN__)

View file

@ -444,6 +444,8 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server)
const int kx_prio[] = {GNUTLS_KX_ANON_DH, 0};
const int cert_type_priority[3] = {GNUTLS_CRT_X509, 0};
if (!source)
return NULL;
{
static qboolean needinit = true;

View file

@ -790,7 +790,8 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server)
if (!source || !SSL_Inited())
{
VFS_CLOSE(source);
if (source)
VFS_CLOSE(source);
return NULL;
}
if (!hostname)

View file

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h"
#include <conio.h>
#if (defined(_DEBUG) || defined(DEBUG))
#if (defined(_DEBUG) || defined(DEBUG)) && !defined(NPFTE)
#define CATCHCRASH
LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo);

View file

@ -279,7 +279,7 @@ It doesn't use persistant connections.
struct http_dl_ctx_s {
// struct dl_download *dlctx;
#if 1
#ifndef NPFTE
vfsfile_t *sock;
#else
SOCKET sock; //FIXME: support https.
@ -308,7 +308,7 @@ void HTTP_Cleanup(struct dl_download *dl)
struct http_dl_ctx_s *con = dl->ctx;
dl->ctx = NULL;
#if 1
#ifndef NPFTE
if (con->sock)
VFS_CLOSE(con->sock);
con->sock = NULL;
@ -346,7 +346,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
switch(con->state)
{
case HC_REQUESTING:
#if 1
#ifndef NPFTE
ammount = VFS_WRITE(con->sock, con->buffer, con->bufferused);
if (!ammount)
return true;
@ -376,7 +376,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530);
#if 1
#ifndef NPFTE
ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15);
if (!ammount)
return true;
@ -583,7 +583,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530);
#if 1
#ifndef NPFTE
ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1);
if (ammount == 0)
return true; //no data yet
@ -699,10 +699,12 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
void HTTPDL_Establish(struct dl_download *dl)
{
// unsigned long _true = true;
// struct sockaddr_qstorage serveraddr;
// int addressfamily;
// int addresssize;
#ifdef NPFTE
unsigned long _true = true;
struct sockaddr_qstorage serveraddr;
int addressfamily;
int addresssize;
#endif
struct http_dl_ctx_s *con;
qboolean https = false;
@ -741,18 +743,27 @@ void HTTPDL_Establish(struct dl_download *dl)
dl->status = DL_RESOLVING;
#if 1
#ifndef NPFTE
if (https)
{
#ifdef HAVE_SSL
//https uses port 443 instead of 80 by default
con->sock = FS_OpenTCP(server, 443);
//and with an extra ssl/tls layer between tcp and http.
con->sock = FS_OpenSSL(server, con->sock, false);
#else
con->sock = NULL;
#endif
}
else
{
con->sock = FS_OpenTCP(server, 80);
}
if (!con->sock)
{
dl->status = DL_FAILED;
return;
}
#else
if (!NET_StringToSockaddr(server, 80, &serveraddr, &addressfamily, &addresssize))
{

View file

@ -982,7 +982,7 @@ char *WordUnderCursor(editor_t *editor, char *word, int wordsize, char *term, in
(linebuf[charidx-1] >= 'a' && linebuf[charidx-1] <= 'z') ||
(linebuf[charidx-1] >= 'A' && linebuf[charidx-1] <= 'Z') ||
(linebuf[charidx-1] >= '0' && linebuf[charidx-1] <= '9') ||
linebuf[charidx-1] == '_' || linebuf[charidx-1] == ':' || || linebuf[charidx-1] == '.' ||
linebuf[charidx-1] == '_' || linebuf[charidx-1] == ':' || linebuf[charidx-1] == '.' ||
linebuf[charidx-1] == '[' || linebuf[charidx-1] == ']' ||
linebuf[charidx-1] >= 128
))
@ -2423,7 +2423,7 @@ static LRESULT CALLBACK EngineWndProc(HWND hWnd,UINT message,
SendMessage(tooltip_editor->editpane, SCI_CALLTIPSHOW, (WPARAM)tooltip_position, (LPARAM)tip);
}
free(lParam);
free((char*)lParam);
}
break;