forked from fte/fteqw
1
0
Fork 0

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

View File

@ -2726,7 +2726,7 @@ qboolean Sys_CheckUpdated(void)
return false; return false;
else if (!COM_CheckParm("-autoupdate") && !COM_CheckParm("--autoupdate")) else if (!COM_CheckParm("-autoupdate") && !COM_CheckParm("--autoupdate"))
return false; 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). //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 pendingpath[MAX_OSPATH];
char updatedpath[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)); MyRegGetStringValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" UPD_BUILDTYPE EXETYPE, pendingpath, sizeof(pendingpath));
if (*pendingpath) if (*pendingpath)
{ {
@ -3121,9 +3122,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
host_parms.binarydir = bindir; host_parms.binarydir = bindir;
COM_InitArgv (parms.argc, parms.argv); COM_InitArgv (parms.argc, parms.argv);
if (Sys_CheckUpdated())
return true;
c = COM_CheckParm("-plugin"); c = COM_CheckParm("-plugin");
if (c) if (c)
{ {
@ -3135,6 +3133,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
else else
isPlugin = 0; isPlugin = 0;
if (Sys_CheckUpdated())
return true;
if (COM_CheckParm("-register_types")) if (COM_CheckParm("-register_types"))
{ {
Sys_DoFileAssociations(1); Sys_DoFileAssociations(1);

View File

@ -97,7 +97,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_D3D #define AVAIL_D3D
#endif #endif
#ifndef MINIMAL #if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV)
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) #if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
#define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc. #define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc.
#elif defined(__linux__) || defined(__CYGWIN__) #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 kx_prio[] = {GNUTLS_KX_ANON_DH, 0};
const int cert_type_priority[3] = {GNUTLS_CRT_X509, 0}; const int cert_type_priority[3] = {GNUTLS_CRT_X509, 0};
if (!source)
return NULL;
{ {
static qboolean needinit = true; 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()) if (!source || !SSL_Inited())
{ {
VFS_CLOSE(source); if (source)
VFS_CLOSE(source);
return NULL; return NULL;
} }
if (!hostname) if (!hostname)

View File

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h" #include "winquake.h"
#include <conio.h> #include <conio.h>
#if (defined(_DEBUG) || defined(DEBUG)) #if (defined(_DEBUG) || defined(DEBUG)) && !defined(NPFTE)
#define CATCHCRASH #define CATCHCRASH
LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo); 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 http_dl_ctx_s {
// struct dl_download *dlctx; // struct dl_download *dlctx;
#if 1 #ifndef NPFTE
vfsfile_t *sock; vfsfile_t *sock;
#else #else
SOCKET sock; //FIXME: support https. SOCKET sock; //FIXME: support https.
@ -308,7 +308,7 @@ void HTTP_Cleanup(struct dl_download *dl)
struct http_dl_ctx_s *con = dl->ctx; struct http_dl_ctx_s *con = dl->ctx;
dl->ctx = NULL; dl->ctx = NULL;
#if 1 #ifndef NPFTE
if (con->sock) if (con->sock)
VFS_CLOSE(con->sock); VFS_CLOSE(con->sock);
con->sock = NULL; con->sock = NULL;
@ -346,7 +346,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
switch(con->state) switch(con->state)
{ {
case HC_REQUESTING: case HC_REQUESTING:
#if 1 #ifndef NPFTE
ammount = VFS_WRITE(con->sock, con->buffer, con->bufferused); ammount = VFS_WRITE(con->sock, con->buffer, con->bufferused);
if (!ammount) if (!ammount)
return true; return true;
@ -376,7 +376,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530) if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530); ExpandBuffer(con, 1530);
#if 1 #ifndef NPFTE
ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15); ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15);
if (!ammount) if (!ammount)
return true; return true;
@ -583,7 +583,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530) if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530); ExpandBuffer(con, 1530);
#if 1 #ifndef NPFTE
ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1); ammount = VFS_READ(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1);
if (ammount == 0) if (ammount == 0)
return true; //no data yet 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) void HTTPDL_Establish(struct dl_download *dl)
{ {
// unsigned long _true = true; #ifdef NPFTE
// struct sockaddr_qstorage serveraddr; unsigned long _true = true;
// int addressfamily; struct sockaddr_qstorage serveraddr;
// int addresssize; int addressfamily;
int addresssize;
#endif
struct http_dl_ctx_s *con; struct http_dl_ctx_s *con;
qboolean https = false; qboolean https = false;
@ -741,18 +743,27 @@ void HTTPDL_Establish(struct dl_download *dl)
dl->status = DL_RESOLVING; dl->status = DL_RESOLVING;
#if 1 #ifndef NPFTE
if (https) if (https)
{ {
#ifdef HAVE_SSL
//https uses port 443 instead of 80 by default //https uses port 443 instead of 80 by default
con->sock = FS_OpenTCP(server, 443); con->sock = FS_OpenTCP(server, 443);
//and with an extra ssl/tls layer between tcp and http. //and with an extra ssl/tls layer between tcp and http.
con->sock = FS_OpenSSL(server, con->sock, false); con->sock = FS_OpenSSL(server, con->sock, false);
#else
con->sock = NULL;
#endif
} }
else else
{ {
con->sock = FS_OpenTCP(server, 80); con->sock = FS_OpenTCP(server, 80);
} }
if (!con->sock)
{
dl->status = DL_FAILED;
return;
}
#else #else
if (!NET_StringToSockaddr(server, 80, &serveraddr, &addressfamily, &addresssize)) 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] >= 'A' && linebuf[charidx-1] <= 'Z') || (linebuf[charidx-1] >= 'A' && linebuf[charidx-1] <= 'Z') ||
(linebuf[charidx-1] >= '0' && linebuf[charidx-1] <= '9') || (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] == '[' || linebuf[charidx-1] == ']' ||
linebuf[charidx-1] >= 128 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); SendMessage(tooltip_editor->editpane, SCI_CALLTIPSHOW, (WPARAM)tooltip_position, (LPARAM)tip);
} }
free(lParam); free((char*)lParam);
} }
break; break;