From d5c3ec1a3b87b131fac531b5083878a021ff7e48 Mon Sep 17 00:00:00 2001 From: Nishi Date: Wed, 2 Oct 2024 19:31:23 +0000 Subject: [PATCH] fix windows git-svn-id: file:///raid/svn-personal/tewi/trunk@216 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Platform/win32-service.mk | 2 +- Platform/win32.mk | 2 +- Platform/win64-service.mk | 2 +- Platform/win64.mk | 2 +- Server/server.c | 21 +++++++++------------ VC6Compat/stdint.h | 1 - 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Platform/win32-service.mk b/Platform/win32-service.mk index a27d077..751b6ba 100644 --- a/Platform/win32-service.mk +++ b/Platform/win32-service.mk @@ -9,5 +9,5 @@ CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC -DSERVICE -mw LDFLAGS = -mwindows LIBS = -lws2_32 EXEC = .exe -LIB = .dll +LIBSUF = .dll PREOBJS = tewi.res diff --git a/Platform/win32.mk b/Platform/win32.mk index d40fb64..857d339 100644 --- a/Platform/win32.mk +++ b/Platform/win32.mk @@ -9,5 +9,5 @@ CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC LDFLAGS = LIBS = -lws2_32 EXEC = .exe -LIB = .dll +LIBSUF = .dll PREOBJS = tewi.res diff --git a/Platform/win64-service.mk b/Platform/win64-service.mk index 7e1093d..d52befc 100644 --- a/Platform/win64-service.mk +++ b/Platform/win64-service.mk @@ -9,5 +9,5 @@ CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC -DSERVICE -mw LDFLAGS = -mwindows LIBS = -lws2_32 EXEC = .exe -LIB = .dll +LIBSUF = .dll PREOBJS = tewi.res diff --git a/Platform/win64.mk b/Platform/win64.mk index 187462a..1d74ff9 100644 --- a/Platform/win64.mk +++ b/Platform/win64.mk @@ -9,5 +9,5 @@ CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC LDFLAGS = LIBS = -lws2_32 EXEC = .exe -LIB = .dll +LIBSUF = .dll PREOBJS = tewi.res diff --git a/Server/server.c b/Server/server.c index bc23a02..8111304 100644 --- a/Server/server.c +++ b/Server/server.c @@ -42,6 +42,7 @@ #include #include "strptime.h" +typedef int socklen_t; #else #ifdef USE_POLL #ifdef __PPU__ @@ -448,9 +449,8 @@ struct pass_entry { SOCKADDR addr; }; -#if defined(__MINGW32__) || defined(_MSC_VER) -unsigned int WINAPI tw_server_pass(void* ptr) { -#elif defined(__BORLANDC__) +#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) +#define NO_RETURN_THREAD void tw_server_pass(void* ptr) { #elif defined(__HAIKU__) int32_t tw_server_pass(void* ptr) { @@ -464,6 +464,7 @@ int tw_server_pass(void* ptr) { int port = ((struct pass_entry*)ptr)->port; SOCKADDR addr = ((struct pass_entry*)ptr)->addr; #else +#define NO_RETURN_THREAD void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) { #endif SSL* s = NULL; @@ -618,10 +619,10 @@ int tw_server_pass(void* ptr) { path = cm_strcat(vhost_entry->root == NULL ? "" : vhost_entry->root, req.path); cm_log("Server", "Filesystem path is %s", path); #if defined(_MSC_VER) || defined(__BORLANDC__) - for(i = strlen(path) - 1; i >= 0; i--){ - if(path[i] == '/'){ + for(i = strlen(path) - 1; i >= 0; i--) { + if(path[i] == '/') { path[i] = 0; - }else{ + } else { break; } } @@ -898,15 +899,11 @@ cleanup: #endif close_socket(sock); #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) - _endthread( -#ifndef __BORLANDC__ - 0 -#endif - ); + _endthread(); #elif defined(__HAIKU__) exit_thread(0); #endif -#ifndef __BORLANDC__ +#ifndef NO_RETURN_THREAD return 0; #endif } diff --git a/VC6Compat/stdint.h b/VC6Compat/stdint.h index 2ea98f7..6cfba41 100644 --- a/VC6Compat/stdint.h +++ b/VC6Compat/stdint.h @@ -9,7 +9,6 @@ typedef unsigned int uint32_t; typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; -typedef int socklen_t; #define INT32_MAX 0x7fffffff -- 2.45.2