From: Nishi Date: Mon, 23 Sep 2024 11:31:18 +0000 (+0000) Subject: adding __cplusplus thing X-Git-Url: https://git.chaotic.ninja/gitweb/nishi/?a=commitdiff_plain;h=8788f86a8e135ac9b70dfaec3f7e842c91bd8e04;p=tewi.git adding __cplusplus thing git-svn-id: file:///raid/svn-personal/tewi/trunk@140 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Server/server.c b/Server/server.c index 2337ed5..9dc3bc7 100644 --- a/Server/server.c +++ b/Server/server.c @@ -502,7 +502,7 @@ int32_t tw_server_pass(void* ptr) { cmtime = mktime(&tm); cmtime -= (btm->tm_hour * 60 + btm->tm_min) * 60; #else - cmtime = timegm(&tm); + cmtime = timegm(&tm); #endif } } diff --git a/Server/strptime.h b/Server/strptime.h index 891e6f4..bc168bf 100644 --- a/Server/strptime.h +++ b/Server/strptime.h @@ -1,10 +1,18 @@ #ifndef STRPTIME_H #define STRPTIME_H +#ifdef __cplusplus +extern "C" { +#endif + #include #ifdef _WIN32 char* strptime(const char *buf, const char *fmt, struct tm *tm); #endif +#ifdef __cplusplus +} +#endif + #endif // STRPTIME_H diff --git a/Server/tw_config.h b/Server/tw_config.h index e405419..7d47620 100644 --- a/Server/tw_config.h +++ b/Server/tw_config.h @@ -3,6 +3,10 @@ #ifndef __TW_CONFIG_H__ #define __TW_CONFIG_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "tw_http.h" #include @@ -91,4 +95,8 @@ int tw_config_read(const char* path); struct tw_config_entry* tw_vhost_match(const char* name, int port); bool tw_permission_allowed(const char* path, SOCKADDR addr, struct tw_http_request req, struct tw_config_entry* vhost); +#ifdef __cplusplus +} +#endif + #endif diff --git a/Server/tw_http.h b/Server/tw_http.h index 1a249b3..ce102e7 100644 --- a/Server/tw_http.h +++ b/Server/tw_http.h @@ -3,6 +3,10 @@ #ifndef __TW_HTTP_H__ #define __TW_HTTP_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include #include "../config.h" @@ -34,4 +38,8 @@ int tw_http_parse(void* ssl, int sock, struct tw_http_request* req); #endif #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/Server/tw_module.h b/Server/tw_module.h index 17c81bb..de82bf9 100644 --- a/Server/tw_module.h +++ b/Server/tw_module.h @@ -3,6 +3,10 @@ #ifndef __TW_MODULE_H__ #define __TW_MODULE_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "tw_config.h" #include "tw_http.h" @@ -33,9 +37,15 @@ typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools); typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res); typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc); +#ifdef SOURCE void* tw_module_load(const char* path); void* tw_module_symbol(void* mod, const char* sym); void tw_init_tools(struct tw_tool* tools); int tw_module_init(void* mod); +#endif + +#ifdef __cplusplus +} +#endif #endif diff --git a/Server/tw_server.h b/Server/tw_server.h index bf75fd2..0e87a0e 100644 --- a/Server/tw_server.h +++ b/Server/tw_server.h @@ -3,6 +3,10 @@ #ifndef __TW_SERVER_H__ #define __TW_SERVER_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "../config.h" #include @@ -22,4 +26,8 @@ size_t tw_read(void* ssl, int s, void* data, size_t len); size_t tw_write(void* ssl, int s, void* data, size_t len); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/Server/tw_ssl.h b/Server/tw_ssl.h index 9176ef2..59ca476 100644 --- a/Server/tw_ssl.h +++ b/Server/tw_ssl.h @@ -3,9 +3,17 @@ #ifndef __TW_SSL_H__ #define __TW_SSL_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include #include SSL_CTX* tw_create_ssl_ctx(__UINTPTR_TYPE__ port); +#ifdef __cplusplus +} +#endif + #endif diff --git a/Server/tw_version.h b/Server/tw_version.h index 303ff04..bc5a6e8 100644 --- a/Server/tw_version.h +++ b/Server/tw_version.h @@ -3,9 +3,17 @@ #ifndef __TW_VERSION_H__ #define __TW_VERSION_H__ +#ifdef __cplusplus +extern "C" { +#endif + #define TW_VERSION "1.05A\0" const char* tw_get_version(void); const char* tw_get_platform(void); +#ifdef __cplusplus +} +#endif + #endif