1
0
Fork 0
forked from fte/fteqw

misc fixes

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5100 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-05-10 04:32:49 +00:00
parent 1f729f4afd
commit 493d66b832
6 changed files with 32 additions and 12 deletions

View file

@ -3406,7 +3406,7 @@ double Media_TweekCaptureFrameTime(double oldtime, double time)
} }
#ifdef VKQUAKE #ifdef VKQUAKE
static void Media_CapturedFrame (void *data, int bytestride, size_t width, size_t height, enum uploadfmt fmt) static void Media_CapturedFrame (void *data, qintptr_t bytestride, size_t width, size_t height, enum uploadfmt fmt)
{ {
if (currentcapture_funcs) if (currentcapture_funcs)
currentcapture_funcs->capture_video(currentcapture_ctx, offscreen_captureframe, data, bytestride, width, height, fmt); currentcapture_funcs->capture_video(currentcapture_ctx, offscreen_captureframe, data, bytestride, width, height, fmt);

View file

@ -392,11 +392,11 @@ int Q_strncasecmp (const char *s1, const char *s2, int n)
int Q_strcasecmp (const char *s1, const char *s2) int Q_strcasecmp (const char *s1, const char *s2)
{ {
return Q_strncasecmp (s1, s2, INT_MAX); return Q_strncasecmp (s1, s2, 0x7fffffff);
} }
int QDECL Q_stricmp (const char *s1, const char *s2) int QDECL Q_stricmp (const char *s1, const char *s2)
{ {
return Q_strncasecmp (s1, s2, INT_MAX); return Q_strncasecmp (s1, s2, 0x7fffffff);
} }
int Q_strstopcasecmp(const char *s1start, const char *s1end, const char *s2) int Q_strstopcasecmp(const char *s1start, const char *s1end, const char *s2)
{ //safer version of strncasecmp, where s1 is the one with the length, and must exactly match s2 (which is null terminated and probably an immediate. { //safer version of strncasecmp, where s1 is the one with the length, and must exactly match s2 (which is null terminated and probably an immediate.

View file

@ -3871,7 +3871,6 @@ qboolean FTENET_TCP_ParseHTTPRequest(ftenet_tcpconnect_connection_t *con, ftenet
} }
else else
{ {
qboolean fail = false;
char acceptkey[20*2]; char acceptkey[20*2];
unsigned char sha1digest[20]; unsigned char sha1digest[20];
char *blurgh; char *blurgh;
@ -3918,6 +3917,8 @@ qboolean FTENET_TCP_ParseHTTPRequest(ftenet_tcpconnect_connection_t *con, ftenet
if (!net_enable_webrtcbroker.ival) if (!net_enable_webrtcbroker.ival)
return false; return false;
break; break;
default:
return false;
} }
if (*arg[WCATTR_URL] == '/') if (*arg[WCATTR_URL] == '/')
@ -4010,6 +4011,7 @@ qboolean FTENET_TCP_ParseHTTPRequest(ftenet_tcpconnect_connection_t *con, ftenet
} }
} }
#ifdef HAVE_SSL
static int QDECL TLSPromoteRead (struct vfsfile_s *file, void *buffer, int bytestoread) static int QDECL TLSPromoteRead (struct vfsfile_s *file, void *buffer, int bytestoread)
{ {
if (bytestoread > net_message.cursize) if (bytestoread > net_message.cursize)
@ -4019,6 +4021,7 @@ static int QDECL TLSPromoteRead (struct vfsfile_s *file, void *buffer, int bytes
return bytestoread; return bytestoread;
} }
#endif #endif
#endif
void FTENET_TCPConnect_PrintStatus(ftenet_generic_connection_t *gcon) void FTENET_TCPConnect_PrintStatus(ftenet_generic_connection_t *gcon)
{ {
ftenet_tcpconnect_connection_t *con = (ftenet_tcpconnect_connection_t*)gcon; ftenet_tcpconnect_connection_t *con = (ftenet_tcpconnect_connection_t*)gcon;

View file

@ -53,7 +53,9 @@ typedef struct FTPclient_s{
unsigned long blocking; unsigned long blocking;
#ifdef MULTITHREAD
void *transferthread; void *transferthread;
#endif
struct FTPclient_s *next; struct FTPclient_s *next;
} FTPclient_t; } FTPclient_t;
@ -529,6 +531,7 @@ qboolean FTP_ReadToAbsFilename(FTPclient_t *cl, const char *msg, char *out, size
return true; return true;
} }
#ifdef MULTITHREAD
int FTP_TransferThread(void *vcl) int FTP_TransferThread(void *vcl)
{ {
char resource[8192]; char resource[8192];
@ -536,7 +539,7 @@ int FTP_TransferThread(void *vcl)
u_long _false = false; u_long _false = false;
ioctlsocket (cl->datasock, FIONBIO, &_false); ioctlsocket (cl->datasock, FIONBIO, &_false);
if (cl->datadir == 1) if ((cl->datadir&~64) == 1)
{ {
while(1) while(1)
{ {
@ -554,7 +557,7 @@ int FTP_TransferThread(void *vcl)
break; break;
} }
} }
else if (cl->datadir == 2) else if ((cl->datadir&~64) == 2)
{ {
while(1) while(1)
{ {
@ -565,10 +568,11 @@ int FTP_TransferThread(void *vcl)
break; break;
} }
} }
cl->transferthread = NULL; cl->datadir &= ~64;
return 0; return 0;
} }
#endif
iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
{ {
@ -581,15 +585,22 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
char resource[8192]; char resource[8192];
int _true = true; int _true = true;
if (cl->transferthread) #ifdef MULTITHREAD
if (cl->datadir & 64)
{ {
if (*cl->messagebuffer) if (*cl->messagebuffer)
{ { //fixme: gah!
if (send (cl->controlsock, cl->messagebuffer, strlen(cl->messagebuffer), 0) != -1) if (send (cl->controlsock, cl->messagebuffer, strlen(cl->messagebuffer), 0) != -1)
*cl->messagebuffer = '\0'; //YAY! It went! *cl->messagebuffer = '\0'; //YAY! It went!
} }
return false; return false;
} }
if (cl->transferthread)
{
Sys_WaitOnThread(cl->transferthread);
cl->transferthread = NULL;
}
#endif
if (cl->datadir == 1) if (cl->datadir == 1)
{ {
@ -1322,8 +1333,13 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
} }
} }
#ifdef MULTITHREAD
if (cl->datadir && !cl->transferthread) if (cl->datadir && !cl->transferthread)
{
cl->datadir|=64;
cl->transferthread = Sys_CreateThread("FTP RECV", FTP_TransferThread, cl, 0, 65536); cl->transferthread = Sys_CreateThread("FTP RECV", FTP_TransferThread, cl, 0, 65536);
}
#endif
return false; return false;
} }

View file

@ -670,7 +670,7 @@ int IWebAuthorize(const char *name, const char *password)
rankinfo_t info; rankinfo_t info;
if (!id) if (!id)
{ {
if (!sv_readlevel.value && !*name || !stricmp(name, "anonymous")) if (!sv_readlevel.value && (!*name || !stricmp(name, "anonymous")))
return IWEBACC_READ; //read only anywhere return IWEBACC_READ; //read only anywhere
return 0; return 0;
} }

View file

@ -2355,6 +2355,7 @@ void SV_UserCmdMVDList_HTML (vfsfile_t *pipe)
VFS_PRINTF(pipe, VFS_PRINTF(pipe,
"<html>" "<html>"
"<head>" "<head>"
"<title>%s - %s</title>"
"<meta charset='UTF-8'>" "<meta charset='UTF-8'>"
"<style>" "<style>"
".mydiv { width: 20%%; height: 100%%; padding: 0px; margin: 0px; border: 0px solclass #aaaaaa; float:left; }" ".mydiv { width: 20%%; height: 100%%; padding: 0px; margin: 0px; border: 0px solclass #aaaaaa; float:left; }"
@ -2363,14 +2364,14 @@ void SV_UserCmdMVDList_HTML (vfsfile_t *pipe)
"<script>" "<script>"
"function playdemo(demo)" "function playdemo(demo)"
"{" "{"
"demo = '%s/demos/'+demo;" "demo = window.location.origin+'/demos/'+demo;"
"thegame.postMessage({cmd:'playdemo',url:demo}, '*');" "thegame.postMessage({cmd:'playdemo',url:demo}, '*');"
"}" "}"
"</script>" "</script>"
"</head>" "</head>"
"<body>" "<body>"
"<div class='mydiv'>\n" "<div class='mydiv'>\n"
, hostname); , fs_manifest->formalname, hostname.string);
VFS_PRINTF(pipe, "available demos:<br/>\n"); VFS_PRINTF(pipe, "available demos:<br/>\n");
dir = Sys_listdir(sv_demoDir.string, ".mvd", SORT_BY_DATE); dir = Sys_listdir(sv_demoDir.string, ".mvd", SORT_BY_DATE);