Browse Source

Revert format and update .clang-format file

bel2125 6 years ago
parent
commit
f166b4f143

+ 3 - 2
.clang-format

@@ -30,7 +30,8 @@ SpaceBeforeParens: ControlStatements
 SpaceInEmptyParentheses: false
 SpacesInSquareBrackets: false
 
-IndentPPDirectives: AfterHash
-IncludeBlocks: Regroup
+IndentPPDirectives: None
+IncludeBlocks: Preserve
+
 
 DisableFormat: false

+ 33 - 33
examples/embedded_c/embedded_c.c

@@ -6,31 +6,31 @@
 
 /* Simple example program on how to use CivetWeb embedded into a C program. */
 #ifdef _WIN32
-#	include <windows.h>
+#include <windows.h>
 #else
-#	include <unistd.h>
+#include <unistd.h>
 #endif
 
-#include "civetweb.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 
+#include "civetweb.h"
+
 
 #define DOCUMENT_ROOT "."
 #ifdef NO_SSL
-#	ifdef USE_IPV6
-#		define PORT "[::]:8888,8884"
-#	else
-#		define PORT "8888,8884"
-#	endif
+#ifdef USE_IPV6
+#define PORT "[::]:8888,8884"
+#else
+#define PORT "8888,8884"
+#endif
+#else
+#ifdef USE_IPV6
+#define PORT "[::]:8888r,[::]:8843s,8884"
 #else
-#	ifdef USE_IPV6
-#		define PORT "[::]:8888r,[::]:8843s,8884"
-#	else
-#		define PORT "8888r,8843s,8884"
-#	endif
+#define PORT "8888r,8843s,8884"
+#endif
 #endif
 #define EXAMPLE_URI "/example"
 #define EXIT_URI "/exit"
@@ -648,7 +648,7 @@ WebSocketStartHandler(struct mg_connection *conn, void *cbdata)
  * it can be easily tested to connect more than MAX_WS_CLIENTS clients.
  * A real server should use a much higher number, or better use a dynamic list
  * of currently connected websocket clients. */
-#	define MAX_WS_CLIENTS (5)
+#define MAX_WS_CLIENTS (5)
 
 struct t_ws_client {
 	struct mg_connection *conn;
@@ -656,14 +656,14 @@ struct t_ws_client {
 } static ws_clients[MAX_WS_CLIENTS];
 
 
-#	define ASSERT(x)                                                          \
-		{                                                                      \
-			if (!(x)) {                                                        \
-				fprintf(stderr,                                                \
-				        "Assertion failed in line %u\n",                       \
-				        (unsigned)__LINE__);                                   \
-			}                                                                  \
-		}
+#define ASSERT(x)                                                              \
+	{                                                                          \
+		if (!(x)) {                                                            \
+			fprintf(stderr,                                                    \
+			        "Assertion failed in line %u\n",                           \
+			        (unsigned)__LINE__);                                       \
+		}                                                                      \
+	}
 
 
 int
@@ -793,11 +793,11 @@ InformWebsockets(struct mg_context *ctx)
 
 
 #ifdef USE_SSL_DH
-#	include "openssl/dh.h"
-#	include "openssl/ec.h"
-#	include "openssl/ecdsa.h"
-#	include "openssl/evp.h"
-#	include "openssl/ssl.h"
+#include "openssl/dh.h"
+#include "openssl/ec.h"
+#include "openssl/ecdsa.h"
+#include "openssl/evp.h"
+#include "openssl/ssl.h"
 
 DH *
 get_dh2236()
@@ -853,7 +853,7 @@ init_ssl(void *ssl_context, void *user_data)
 	/* Add application specific SSL initialization */
 	struct ssl_ctx_st *ctx = (struct ssl_ctx_st *)ssl_context;
 
-#	ifdef USE_SSL_DH
+#ifdef USE_SSL_DH
 	/* example from https://github.com/civetweb/civetweb/issues/347 */
 	DH *dh = get_dh2236();
 	if (!dh)
@@ -870,7 +870,7 @@ init_ssl(void *ssl_context, void *user_data)
 	EC_KEY_free(ecdh);
 
 	printf("ECDH ciphers initialized\n");
-#	endif
+#endif
 	return 0;
 }
 #endif
@@ -906,11 +906,11 @@ main(int argc, char *argv[])
 	    "ssl_protocol_version",
 	    "3",
 	    "ssl_cipher_list",
-#	ifdef USE_SSL_DH
+#ifdef USE_SSL_DH
 	    "ECDHE-RSA-AES256-GCM-SHA384:DES-CBC3-SHA:AES128-SHA:AES128-GCM-SHA256",
-#	else
+#else
 	    "DES-CBC3-SHA:AES128-SHA:AES128-GCM-SHA256",
-#	endif
+#endif
 #endif
 	    "enable_auth_domain_check",
 	    "no",

+ 9 - 9
examples/rest/rest.c

@@ -5,25 +5,25 @@
 
 /* Simple demo of a REST callback. */
 #ifdef _WIN32
-#	include <windows.h>
+#include <windows.h>
 #else
-#	include <unistd.h>
+#include <unistd.h>
 #endif
 
-#include "cJSON.h"
-#include "civetweb.h"
-
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 
+#include "cJSON.h"
+#include "civetweb.h"
+
 
 #ifdef NO_SSL
-#	define PORT "8089"
-#	define HOST_INFO "http://localhost:8089"
+#define PORT "8089"
+#define HOST_INFO "http://localhost:8089"
 #else
-#	define PORT "8089r,8843s"
-#	define HOST_INFO "https://localhost:8843"
+#define PORT "8089r,8843s"
+#define HOST_INFO "https://localhost:8843"
 #endif
 
 #define EXAMPLE_URI "/example"

+ 5 - 6
include/CivetServer.h

@@ -8,12 +8,11 @@
 #define _CIVETWEB_SERVER_H_
 #ifdef __cplusplus
 
-#	include "civetweb.h"
-
-#	include <map>
-#	include <stdexcept>
-#	include <string>
-#	include <vector>
+#include "civetweb.h"
+#include <map>
+#include <stdexcept>
+#include <string>
+#include <vector>
 
 // forward declaration
 class CivetServer;

+ 24 - 24
include/civetweb.h

@@ -29,19 +29,19 @@
 #define CIVETWEB_VERSION_PATCH (0)
 
 #ifndef CIVETWEB_API
-#	if defined(_WIN32)
-#		if defined(CIVETWEB_DLL_EXPORTS)
-#			define CIVETWEB_API __declspec(dllexport)
-#		elif defined(CIVETWEB_DLL_IMPORTS)
-#			define CIVETWEB_API __declspec(dllimport)
-#		else
-#			define CIVETWEB_API
-#		endif
-#	elif __GNUC__ >= 4
-#		define CIVETWEB_API __attribute__((visibility("default")))
-#	else
-#		define CIVETWEB_API
-#	endif
+#if defined(_WIN32)
+#if defined(CIVETWEB_DLL_EXPORTS)
+#define CIVETWEB_API __declspec(dllexport)
+#elif defined(CIVETWEB_DLL_IMPORTS)
+#define CIVETWEB_API __declspec(dllimport)
+#else
+#define CIVETWEB_API
+#endif
+#elif __GNUC__ >= 4
+#define CIVETWEB_API __attribute__((visibility("default")))
+#else
+#define CIVETWEB_API
+#endif
 #endif
 
 #include <stddef.h>
@@ -809,8 +809,8 @@ CIVETWEB_API void mg_unlock_connection(struct mg_connection *conn);
 
 
 #if defined(MG_LEGACY_INTERFACE) /* 2014-06-21 */
-#	define mg_lock mg_lock_connection
-#	define mg_unlock mg_unlock_connection
+#define mg_lock mg_lock_connection
+#define mg_unlock mg_unlock_connection
 #endif
 
 
@@ -845,20 +845,20 @@ enum {
 /* Macros for enabling compiler-specific checks for printf-like arguments. */
 #undef PRINTF_FORMAT_STRING
 #if defined(_MSC_VER) && _MSC_VER >= 1400
-#	include <sal.h>
-#	if defined(_MSC_VER) && _MSC_VER > 1400
-#		define PRINTF_FORMAT_STRING(s) _Printf_format_string_ s
-#	else
-#		define PRINTF_FORMAT_STRING(s) __format_string s
-#	endif
+#include <sal.h>
+#if defined(_MSC_VER) && _MSC_VER > 1400
+#define PRINTF_FORMAT_STRING(s) _Printf_format_string_ s
+#else
+#define PRINTF_FORMAT_STRING(s) __format_string s
+#endif
 #else
-#	define PRINTF_FORMAT_STRING(s) s
+#define PRINTF_FORMAT_STRING(s) s
 #endif
 
 #ifdef __GNUC__
-#	define PRINTF_ARGS(x, y) __attribute__((format(printf, x, y)))
+#define PRINTF_ARGS(x, y) __attribute__((format(printf, x, y)))
 #else
-#	define PRINTF_ARGS(x, y)
+#define PRINTF_ARGS(x, y)
 #endif
 
 

+ 2 - 2
src/CivetServer.cpp

@@ -12,12 +12,12 @@
 #include <string.h>
 
 #ifndef UNUSED_PARAMETER
-#	define UNUSED_PARAMETER(x) (void)(x)
+#define UNUSED_PARAMETER(x) (void)(x)
 #endif
 
 #ifndef MAX_PARAM_BODY_LENGTH
 // Set a default limit for parameters in a form body: 2 MB
-#	define MAX_PARAM_BODY_LENGTH (1024 * 1024 * 2)
+#define MAX_PARAM_BODY_LENGTH (1024 * 1024 * 2)
 #endif
 
 bool

File diff suppressed because it is too large
+ 344 - 354
src/civetweb.c


+ 2 - 1
src/civetweb_private_lua.h

@@ -3,8 +3,9 @@
  * mod_lua.inl */
 
 #if !defined(CIVETWEB_PRIVATE_LUA_H)
-#	define CIVETWEB_PRIVATE_LUA_H
+#define CIVETWEB_PRIVATE_LUA_H
 
 int run_lua(const char *file_name);
 
+
 #endif

+ 114 - 117
src/main.c

@@ -22,21 +22,19 @@
 
 #if defined(_WIN32)
 
-#	if !defined(_CRT_SECURE_NO_WARNINGS)
-#		define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in      \
-		                                    VS2005 */
-#	endif
-#	if !defined(_CRT_SECURE_NO_DEPRECATE)
-#		define _CRT_SECURE_NO_DEPRECATE
-#	endif
-#	if defined(WIN32_LEAN_AND_MEAN)
-#		undef WIN32_LEAN_AND_MEAN /* Required for some functions (tray icons, \
-		                               ...) */
-#	endif
+#if !defined(_CRT_SECURE_NO_WARNINGS)
+#define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005 */
+#endif
+#if !defined(_CRT_SECURE_NO_DEPRECATE)
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+#if defined(WIN32_LEAN_AND_MEAN)
+#undef WIN32_LEAN_AND_MEAN /* Required for some functions (tray icons, ...) */
+#endif
 
 #else
 
-#	define _XOPEN_SOURCE 600 /* For PATH_MAX on linux */
+#define _XOPEN_SOURCE 600 /* For PATH_MAX on linux */
 /* This should also be sufficient for "realpath", according to
  * http://man7.org/linux/man-pages/man3/realpath.3.html, but in
  * reality it does not seem to work. */
@@ -47,35 +45,33 @@
 #endif
 
 #if !defined(IGNORE_UNUSED_RESULT)
-#	define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1))
+#define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1))
 #endif
 
 #if defined(__cplusplus) && (__cplusplus >= 201103L)
-#	define NO_RETURN [[noreturn]]
+#define NO_RETURN [[noreturn]]
 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
-#	define NO_RETURN _Noreturn
+#define NO_RETURN _Noreturn
 #elif defined(__GNUC__)
-#	define NO_RETURN __attribute((noreturn))
+#define NO_RETURN __attribute((noreturn))
 #else
-#	define NO_RETURN
+#define NO_RETURN
 #endif
 
 /* Use same defines as in civetweb.c before including system headers. */
 #if !defined(_LARGEFILE_SOURCE)
-#	define _LARGEFILE_SOURCE /* For fseeko(), ftello() */
+#define _LARGEFILE_SOURCE /* For fseeko(), ftello() */
 #endif
 #if !defined(_FILE_OFFSET_BITS)
-#	define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */
+#define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */
 #endif
 #if !defined(__STDC_FORMAT_MACROS)
-#	define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */
+#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */
 #endif
 #if !defined(__STDC_LIMIT_MACROS)
-#	define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */
+#define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */
 #endif
 
-#include "civetweb.h"
-
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
@@ -88,78 +84,79 @@
 #include <string.h>
 #include <sys/stat.h>
 
+#include "civetweb.h"
+
 #undef printf
 #define printf                                                                 \
 	DO_NOT_USE_THIS_FUNCTION__USE_fprintf /* Required for unit testing */
 
 #if defined(_WIN32) && !defined(__SYMBIAN32__) /* WINDOWS include block */
-#	if !defined(_WIN32_WINNT)
-#		define _WIN32_WINNT                                                   \
-			0x0501 /* for tdm-gcc so we can use getconsolewindow */
-#	endif
-#	undef UNICODE
-#	include <io.h>
-#	include <shlobj.h>
-#	include <windows.h>
-#	include <winsvc.h>
-
-#	define getcwd(a, b) (_getcwd(a, b))
-#	if !defined(__MINGW32__)
+#if !defined(_WIN32_WINNT)
+#define _WIN32_WINNT 0x0501 /* for tdm-gcc so we can use getconsolewindow */
+#endif
+#undef UNICODE
+#include <io.h>
+#include <shlobj.h>
+#include <windows.h>
+#include <winsvc.h>
+
+#define getcwd(a, b) (_getcwd(a, b))
+#if !defined(__MINGW32__)
 extern char *_getcwd(char *buf, size_t size);
-#	endif
+#endif
 
-#	if !defined(PATH_MAX)
-#		define PATH_MAX MAX_PATH
-#	endif
+#if !defined(PATH_MAX)
+#define PATH_MAX MAX_PATH
+#endif
 
-#	if !defined(S_ISDIR)
-#		define S_ISDIR(x) ((x)&_S_IFDIR)
-#	endif
+#if !defined(S_ISDIR)
+#define S_ISDIR(x) ((x)&_S_IFDIR)
+#endif
 
-#	define DIRSEP '\\'
-#	define snprintf _snprintf
-#	define vsnprintf _vsnprintf
-#	define sleep(x) (Sleep((x)*1000))
-#	define WINCDECL __cdecl
-#	define abs_path(rel, abs, abs_size) (_fullpath((abs), (rel), (abs_size)))
+#define DIRSEP '\\'
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define sleep(x) (Sleep((x)*1000))
+#define WINCDECL __cdecl
+#define abs_path(rel, abs, abs_size) (_fullpath((abs), (rel), (abs_size)))
 
 #else /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include   \
          block */
 
-#	include <sys/utsname.h>
-#	include <sys/wait.h>
-#	include <unistd.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <unistd.h>
 
-#	define DIRSEP '/'
-#	define WINCDECL
-#	define abs_path(rel, abs, abs_size) (realpath((rel), (abs)))
+#define DIRSEP '/'
+#define WINCDECL
+#define abs_path(rel, abs, abs_size) (realpath((rel), (abs)))
 
 #endif /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include  \
           block */
 
 #if !defined(DEBUG_ASSERT)
-#	if defined(DEBUG)
+#if defined(DEBUG)
 
-#		if defined(_MSC_VER)
+#if defined(_MSC_VER)
 /* DEBUG_ASSERT has some const conditions */
-#			pragma warning(disable : 4127)
-#		endif
-
-#		define DEBUG_ASSERT(cond)                                             \
-			do {                                                               \
-				if (!(cond)) {                                                 \
-					fprintf(stderr, "ASSERTION FAILED: %s", #cond);            \
-					exit(2); /* Exit with error */                             \
-				}                                                              \
-			} while (0)
-
-#	else
-#		define DEBUG_ASSERT(cond)
-#	endif /* DEBUG */
+#pragma warning(disable : 4127)
+#endif
+
+#define DEBUG_ASSERT(cond)                                                     \
+	do {                                                                       \
+		if (!(cond)) {                                                         \
+			fprintf(stderr, "ASSERTION FAILED: %s", #cond);                    \
+			exit(2); /* Exit with error */                                     \
+		}                                                                      \
+	} while (0)
+
+#else
+#define DEBUG_ASSERT(cond)
+#endif /* DEBUG */
 #endif
 
 #if !defined(PATH_MAX)
-#	define PATH_MAX (1024)
+#define PATH_MAX (1024)
 #endif
 
 #define MAX_OPTIONS (50)
@@ -195,16 +192,16 @@ static struct tuser_data
     g_user_data; /* Passed to mg_start() by start_civetweb() */
 
 #if !defined(CONFIG_FILE)
-#	define CONFIG_FILE "civetweb.conf"
+#define CONFIG_FILE "civetweb.conf"
 #endif /* !CONFIG_FILE */
 
 #if !defined(PASSWORDS_FILE_NAME)
-#	define PASSWORDS_FILE_NAME ".htpasswd"
+#define PASSWORDS_FILE_NAME ".htpasswd"
 #endif
 
 /* backup config file */
 #if !defined(CONFIG_FILE2) && defined(__linux__)
-#	define CONFIG_FILE2 "/usr/local/etc/civetweb.conf"
+#define CONFIG_FILE2 "/usr/local/etc/civetweb.conf"
 #endif
 
 enum {
@@ -360,7 +357,7 @@ get_url_to_first_open_port(const struct mg_context *ctx)
 }
 
 
-#	if defined(ENABLE_CREATE_CONFIG_FILE)
+#if defined(ENABLE_CREATE_CONFIG_FILE)
 static void
 create_config_file(const struct mg_context *ctx, const char *path)
 {
@@ -385,7 +382,7 @@ create_config_file(const struct mg_context *ctx, const char *path)
 		fclose(fp);
 	}
 }
-#	endif
+#endif
 #endif
 
 
@@ -1008,14 +1005,14 @@ set_absolute_path(char *options[],
 
 #if defined(USE_LUA)
 
-#	include "civetweb_private_lua.h"
+#include "civetweb_private_lua.h"
 
 #endif
 
 
 #if defined(USE_DUKTAPE)
 
-#	include "duktape.h"
+#include "duktape.h"
 
 static int
 run_duktape(const char *file_name)
@@ -1044,7 +1041,7 @@ finished:
 
 #if defined(__MINGW32__) || defined(__MINGW64__)
 /* For __MINGW32/64_MAJOR/MINOR_VERSION define */
-#	include <_mingw.h>
+#include <_mingw.h>
 #endif
 
 
@@ -1281,9 +1278,9 @@ start_civetweb(int argc, char *argv[])
 		if (argc != 3) {
 			show_usage_and_exit(argv[0]);
 		}
-#	if defined(WIN32)
+#if defined(WIN32)
 		(void)MakeConsole();
-#	endif
+#endif
 		exit(run_lua(argv[2]));
 #else
 		show_server_name();
@@ -1299,9 +1296,9 @@ start_civetweb(int argc, char *argv[])
 		if (argc != 3) {
 			show_usage_and_exit(argv[0]);
 		}
-#	if defined(WIN32)
+#if defined(WIN32)
 		(void)MakeConsole();
-#	endif
+#endif
 		exit(run_duktape(argv[2]));
 #else
 		show_server_name();
@@ -1545,11 +1542,11 @@ struct dlg_header_param {
 static struct dlg_header_param
 GetDlgHeader(const short width)
 {
-#	if defined(_MSC_VER)
+#if defined(_MSC_VER)
 /* disable MSVC warning C4204 (non-constant used to initialize structure) */
-#		pragma warning(push)
-#		pragma warning(disable : 4204)
-#	endif /* if defined(_MSC_VER) */
+#pragma warning(push)
+#pragma warning(disable : 4204)
+#endif /* if defined(_MSC_VER) */
 	struct dlg_header_param dialog_header = {{WS_CAPTION | WS_POPUP | WS_SYSMENU
 	                                              | WS_VISIBLE | DS_SETFONT
 	                                              | WS_DLGFRAME,
@@ -1564,9 +1561,9 @@ GetDlgHeader(const short width)
 	                                         L"",
 	                                         8,
 	                                         L"Tahoma"};
-#	if defined(_MSC_VER)
-#		pragma warning(pop)
-#	endif /* if defined(_MSC_VER) */
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* if defined(_MSC_VER) */
 	return dialog_header;
 }
 
@@ -1861,9 +1858,9 @@ get_password(const char *user,
              char *passwd,
              unsigned passwd_len)
 {
-#	define HEIGHT (15)
-#	define WIDTH (280)
-#	define LABEL_WIDTH (90)
+#define HEIGHT (15)
+#define WIDTH (280)
+#define LABEL_WIDTH (90)
 
 	unsigned char mem[4096], *p;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
@@ -2010,9 +2007,9 @@ get_password(const char *user,
 
 	return ok;
 
-#	undef HEIGHT
-#	undef WIDTH
-#	undef LABEL_WIDTH
+#undef HEIGHT
+#undef WIDTH
+#undef LABEL_WIDTH
 }
 
 
@@ -2136,9 +2133,9 @@ add_control(unsigned char **mem,
 static void
 show_settings_dialog()
 {
-#	define HEIGHT (15)
-#	define WIDTH (460)
-#	define LABEL_WIDTH (90)
+#define HEIGHT (15)
+#define WIDTH (460)
+#define LABEL_WIDTH (90)
 
 	unsigned char mem[16 * 1024], *p;
 	const struct mg_option *options;
@@ -2300,18 +2297,18 @@ show_settings_dialog()
 	s_dlg_proc_param.hWnd = NULL;
 	s_dlg_proc_param.guard = 0;
 
-#	undef HEIGHT
-#	undef WIDTH
-#	undef LABEL_WIDTH
+#undef HEIGHT
+#undef WIDTH
+#undef LABEL_WIDTH
 }
 
 
 static void
 change_password_file()
 {
-#	define HEIGHT (15)
-#	define WIDTH (320)
-#	define LABEL_WIDTH (90)
+#define HEIGHT (15)
+#define WIDTH (320)
+#define LABEL_WIDTH (90)
 
 	OPENFILENAME of;
 	char path[PATH_MAX] = PASSWORDS_FILE_NAME;
@@ -2501,9 +2498,9 @@ change_password_file()
 	s_dlg_proc_param.hWnd = NULL;
 	s_dlg_proc_param.guard = 0;
 
-#	undef HEIGHT
-#	undef WIDTH
-#	undef LABEL_WIDTH
+#undef HEIGHT
+#undef WIDTH
+#undef LABEL_WIDTH
 }
 
 
@@ -2537,9 +2534,9 @@ sysinfo_reload(struct dlg_proc_param *prm)
 int
 show_system_info()
 {
-#	define HEIGHT (15)
-#	define WIDTH (320)
-#	define LABEL_WIDTH (50)
+#define HEIGHT (15)
+#define WIDTH (320)
+#define LABEL_WIDTH (50)
 
 	unsigned char mem[4096], *p;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
@@ -2628,9 +2625,9 @@ show_system_info()
 
 	return ok;
 
-#	undef HEIGHT
-#	undef WIDTH
-#	undef LABEL_WIDTH
+#undef HEIGHT
+#undef WIDTH
+#undef LABEL_WIDTH
 }
 
 
@@ -2876,9 +2873,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
 	HWND hWnd;
 	MSG msg;
 
-#	if defined(DEBUG)
+#if defined(DEBUG)
 	(void)MakeConsole();
-#	endif
+#endif
 
 	(void)hInst;
 	(void)hPrev;
@@ -2950,7 +2947,7 @@ main(int argc, char *argv[])
 
 
 #elif defined(USE_COCOA)
-#	import <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 
 @interface Civetweb : NSObject <NSApplicationDelegate>
 - (void)openBrowser;

+ 12 - 12
src/md5.inl

@@ -35,7 +35,7 @@
  */
 
 #if !defined(md5_INCLUDED)
-#	define md5_INCLUDED
+#define md5_INCLUDED
 
 /*
  * This package supports both compile-time and run-time determination of CPU
@@ -57,9 +57,9 @@ typedef struct md5_state_s {
 	md5_byte_t buf[64];  /* accumulate block */
 } md5_state_t;
 
-#	if defined(__cplusplus)
+#if defined(__cplusplus)
 extern "C" {
-#	endif
+#endif
 
 /* Initialize the algorithm. */
 MD5_STATIC void md5_init(md5_state_t *pms);
@@ -71,9 +71,9 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes);
 /* Finish the message and return the digest. */
 MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
 
-#	if defined(__cplusplus)
+#if defined(__cplusplus)
 } /* end extern "C" */
-#	endif
+#endif
 
 #endif /* md5_INCLUDED */
 
@@ -131,14 +131,14 @@ MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
  */
 
 #if !defined(MD5_STATIC)
-#	include <string.h>
+#include <string.h>
 #endif
 
 #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
 #if defined(ARCH_IS_BIG_ENDIAN)
-#	define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
+#define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
 #else
-#	define BYTE_ORDER (0)
+#define BYTE_ORDER (0)
 #endif
 
 #define T_MASK ((md5_word_t)~0)
@@ -265,11 +265,11 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
 			const md5_byte_t *xp = data;
 			int i;
 
-#	if BYTE_ORDER == 0
+#if BYTE_ORDER == 0
 			X = xbuf; /* (dynamic only) */
-#	else
-#		define xbuf X /* (static only) */
-#	endif
+#else
+#define xbuf X /* (static only) */
+#endif
 			for (i = 0; i < 16; ++i, xp += 4)
 				xbuf[i] = (md5_word_t)(xp[0]) + (md5_word_t)(xp[1] << 8)
 				          + (md5_word_t)(xp[2] << 16)

+ 5 - 5
src/mod_lua.inl

@@ -38,11 +38,11 @@ munmap(void *addr, int64_t length)
 	UnmapViewOfFile(addr);
 }
 
-#	define MAP_FAILED (NULL)
-#	define MAP_PRIVATE (0)
-#	define PROT_READ (0)
+#define MAP_FAILED (NULL)
+#define MAP_PRIVATE (0)
+#define PROT_READ (0)
 #else
-#	include <sys/mman.h>
+#include <sys/mman.h>
 #endif
 
 static const char *LUASOCKET = "luasocket";
@@ -55,7 +55,7 @@ static const char *LUABACKGROUNDPARAMS = "mg";
  * This takes a lot of stack (~10 kB per recursion),
  * so do not use a too high limit. */
 #if !defined(LSP_INCLUDE_MAX_DEPTH)
-#	define LSP_INCLUDE_MAX_DEPTH (10)
+#define LSP_INCLUDE_MAX_DEPTH (10)
 #endif
 
 

+ 2 - 2
src/mod_zlib.inl

@@ -1,13 +1,13 @@
 /* Experimental implementation for on-the-fly compression */
 #if !defined(USE_ZLIB)
-#	error "This file must only be included, if USE_ZLIB is set"
+#error "This file must only be included, if USE_ZLIB is set"
 #endif
 
 #include "zconf.h"
 #include "zlib.h"
 
 #if !defined(MEM_LEVEL)
-#	define MEM_LEVEL (8)
+#define MEM_LEVEL (8)
 #endif
 
 static void *

+ 24 - 24
src/third_party/civetweb_lua.h

@@ -32,46 +32,46 @@
 #include "lualib.h"
 
 #ifndef LUA_VERSION_NUM
-#	error "Unknown Lua version"
+#error "Unknown Lua version"
 
 #elif LUA_VERSION_NUM == 501
 /* Lua 5.1 detected */
-#	define LUA_OK 0
-#	define LUA_ERRGCMM 999 /* not supported */
-#	define mg_lua_load(a, b, c, d, e) lua_load(a, b, c, d)
-#	define lua_rawlen lua_objlen
-#	define lua_newstate(a, b)                                                 \
-		luaL_newstate() /* Must use luaL_newstate() for 64 bit target */
-#	define lua_pushinteger lua_pushnumber
-#	define luaL_newlib(L, t)                                                  \
-		{                                                                      \
-			luaL_Reg const *r = t;                                             \
-			while (r->name) {                                                  \
-				lua_register(L, r->name, r->func);                             \
-				r++;                                                           \
-			}                                                                  \
-		}
-#	define luaL_setfuncs(L, r, u) lua_register(L, r->name, r->func)
+#define LUA_OK 0
+#define LUA_ERRGCMM 999 /* not supported */
+#define mg_lua_load(a, b, c, d, e) lua_load(a, b, c, d)
+#define lua_rawlen lua_objlen
+#define lua_newstate(a, b)                                                     \
+	luaL_newstate() /* Must use luaL_newstate() for 64 bit target */
+#define lua_pushinteger lua_pushnumber
+#define luaL_newlib(L, t)                                                      \
+	{                                                                          \
+		luaL_Reg const *r = t;                                                 \
+		while (r->name) {                                                      \
+			lua_register(L, r->name, r->func);                                 \
+			r++;                                                               \
+		}                                                                      \
+	}
+#define luaL_setfuncs(L, r, u) lua_register(L, r->name, r->func)
 
 #elif LUA_VERSION_NUM == 502
 /* Lua 5.2 detected */
-#	define mg_lua_load lua_load
+#define mg_lua_load lua_load
 
 #elif LUA_VERSION_NUM == 503
 /* Lua 5.3 detected */
-#	define mg_lua_load lua_load
+#define mg_lua_load lua_load
 
 #elif LUA_VERSION_NUM == 504
 /* Lua 5.4 detected */
-#	define mg_lua_load lua_load
+#define mg_lua_load lua_load
 
 #endif
 
 #ifdef LUA_VERSION_MAKEFILE
-#	if LUA_VERSION_MAKEFILE != LUA_VERSION_NUM
-#		error                                                                  \
-		    "Mismatch between Lua version specified in Makefile and Lua version in lua.h"
-#	endif
+#if LUA_VERSION_MAKEFILE != LUA_VERSION_NUM
+#error                                                                         \
+    "Mismatch between Lua version specified in Makefile and Lua version in lua.h"
+#endif
 #endif
 
 #endif /* #ifndef CIVETWEB_LUA_H */

+ 1 - 1
src/timer.inl

@@ -4,7 +4,7 @@
  */
 
 #if !defined(MAX_TIMERS)
-#	define MAX_TIMERS MAX_WORKER_THREADS
+#define MAX_TIMERS MAX_WORKER_THREADS
 #endif
 
 typedef int (*taction)(void *arg);

+ 16 - 16
unittest/civetweb_check.h

@@ -22,14 +22,14 @@
 #define TEST_CIVETWEB_CHECK_H_
 
 #ifdef __clang__
-#	pragma clang diagnostic push
+#pragma clang diagnostic push
 // FIXME: check uses GCC specific variadic macros that are non-standard
-#	pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
+#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
 #endif
 
 #if defined(__MINGW__) || defined(__GNUC__)
-#	pragma GCC diagnostic push
-#	pragma GCC diagnostic ignored "-Wall"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wall"
 /* Disable warnings for defining _CRT_SECURE_NO_* (here) and
  * _CHECK_CHECK_STDINT_H (in check.h)
  */
@@ -41,12 +41,12 @@
 #endif
 
 #ifdef _MSC_VER
-#	undef pid_t
-#	define pid_t int
+#undef pid_t
+#define pid_t int
 /* Unreferenced formal parameter. START_TEST has _i */
-#	pragma warning(disable : 4100)
+#pragma warning(disable : 4100)
 /* conditional expression is constant . asserts use while(0) */
-#	pragma warning(disable : 4127)
+#pragma warning(disable : 4127)
 #endif
 #include <stdint.h>
 
@@ -56,31 +56,31 @@
 #include "check.h"
 
 #if (CHECK_MINOR_VERSION < 11)
-#	ifndef LOCAL_TEST
-#		error "CivetWeb unit tests require at least check 0.11.0"
-#	endif
+#ifndef LOCAL_TEST
+#error "CivetWeb unit tests require at least check 0.11.0"
+#endif
 #endif
 
 #ifdef __clang__
-#	pragma clang diagnostic pop
+#pragma clang diagnostic pop
 #endif
 
 #if !defined(_CRT_SECURE_NO_WARNINGS)
-#	define _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
 #endif
 #if !defined(_CRT_SECURE_NO_DEPRECATE)
-#	define _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE
 #endif
 
 #if defined(__MINGW__) || defined(__GNUC__)
-#	pragma GCC diagnostic pop
+#pragma GCC diagnostic pop
 #endif
 
 #ifdef __clang__
 /* When using -Weverything, clang does not accept it's own headers
  * in a release build configuration. Disable what is too much in
  * -Weverything. */
-#	pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
 #endif
 
 /* A minimal timeout used for all tests with the "check" framework. */

+ 1 - 1
unittest/main.c

@@ -20,7 +20,7 @@
  */
 
 #if defined(_MSC_VER)
-#	define _CRT_SECURE_NO_WARNINGS /* Microsoft nonsense */
+#define _CRT_SECURE_NO_WARNINGS /* Microsoft nonsense */
 #endif
 
 #include "civetweb_check.h"

+ 11 - 11
unittest/private.c

@@ -24,23 +24,23 @@
  * static functions
  */
 #ifdef _MSC_VER
-#	ifndef _CRT_SECURE_NO_WARNINGS
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
-#	define CIVETWEB_API static
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+#define CIVETWEB_API static
 #endif
 
 #ifdef REPLACE_CHECK_FOR_LOCAL_DEBUGGING
-#	undef MEMORY_DEBUGGING
+#undef MEMORY_DEBUGGING
 #endif
 
-#include "private.h"
-
 #include "../src/civetweb.c"
 
 #include <stdlib.h>
 #include <time.h>
 
+#include "private.h"
+
 
 /* This unit test file uses the excellent Check unit testing library.
  * The API documentation is available here:
@@ -1169,11 +1169,11 @@ make_private_suite(void)
 void
 MAIN_PRIVATE(void)
 {
-#	if defined(_WIN32)
+#if defined(_WIN32)
 	/* test_parse_port_string requires WSAStartup for IPv6 */
 	WSADATA data;
 	WSAStartup(MAKEWORD(2, 2), &data);
-#	endif
+#endif
 
 	test_alloc_vprintf(0);
 	test_mg_vsnprintf(0);
@@ -1183,9 +1183,9 @@ MAIN_PRIVATE(void)
 	test_parse_http_message(0);
 	test_sha1(0);
 
-#	if defined(_WIN32)
+#if defined(_WIN32)
 	WSACleanup();
-#	endif
+#endif
 }
 
 #endif

+ 3 - 3
unittest/private_exe.c

@@ -24,9 +24,9 @@
  * static functions.
  */
 #ifdef _MSC_VER
-#	ifndef _CRT_SECURE_NO_WARNINGS
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 #endif
 
 #include "private_exe.h"

+ 6 - 6
unittest/public_func.c

@@ -20,17 +20,17 @@
  */
 
 #ifdef _MSC_VER
-#	ifndef _CRT_SECURE_NO_WARNINGS
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 #endif
 
-#include "public_func.h"
-
-#include <civetweb.h>
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "public_func.h"
+#include <civetweb.h>
+
 /* This unit test file uses the excellent Check unit testing library.
  * The API documentation is available here:
  * http://check.sourceforge.net/doc/check_html/index.html

+ 98 - 98
unittest/public_server.c

@@ -20,14 +20,11 @@
  */
 
 #ifdef _MSC_VER
-#	ifndef _CRT_SECURE_NO_WARNINGS
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 #endif
 
-#include "public_server.h"
-
-#include <civetweb.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -37,12 +34,15 @@
 #include <sys/types.h>
 #include <time.h>
 
+#include "public_server.h"
+#include <civetweb.h>
+
 #if defined(_WIN32)
-#	include <windows.h>
-#	define test_sleep(x) (Sleep((x)*1000))
+#include <windows.h>
+#define test_sleep(x) (Sleep((x)*1000))
 #else
-#	include <unistd.h>
-#	define test_sleep(x) (sleep(x))
+#include <unistd.h>
+#define test_sleep(x) (sleep(x))
 #endif
 
 #define SLEEP_BEFORE_MG_START (1)
@@ -59,7 +59,7 @@
 /* Return codes of the tested functions are evaluated. Checking all other
  * functions, used only to prepare the test environment seems redundant.
  * If they fail, the test fails anyway. */
-#	pragma GCC diagnostic ignored "-Wunused-result"
+#pragma GCC diagnostic ignored "-Wunused-result"
 #endif
 
 static const char *
@@ -68,25 +68,25 @@ locate_path(const char *a_path)
 	static char r_path[256];
 
 #ifdef _WIN32
-#	ifdef LOCAL_TEST
+#ifdef LOCAL_TEST
 	sprintf(r_path, "%s\\", a_path);
-#	else
+#else
 	/* Appveyor */
 	sprintf(r_path, "..\\..\\..\\%s\\", a_path);
 /* TODO: the different paths
  * used in the different test
  * system is an unsolved
  * problem. */
-#	endif
+#endif
 #else
-#	ifdef LOCAL_TEST
+#ifdef LOCAL_TEST
 	sprintf(r_path, "%s/", a_path);
-#	else
+#else
 	/* Travis */
 	sprintf(r_path,
 	        "../../%s/",
 	        a_path); // TODO: fix path in CI test environment
-#	endif
+#endif
 #endif
 
 	return r_path;
@@ -131,9 +131,9 @@ wait_not_null(void *volatile *data)
 	}
 
 #if defined(__MINGW32__) || defined(__GNUC__)
-#	pragma GCC diagnostic push
-#	pragma GCC diagnostic ignored "-Wunreachable-code"
-#	pragma GCC diagnostic ignored "-Wunreachable-code-return"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#pragma GCC diagnostic ignored "-Wunreachable-code-return"
 #endif
 
 	ck_abort_msg("wait_not_null failed (%i sec)", i);
@@ -141,7 +141,7 @@ wait_not_null(void *volatile *data)
 	return 0;
 
 #if defined(__MINGW32__) || defined(__GNUC__)
-#	pragma GCC diagnostic pop
+#pragma GCC diagnostic pop
 #endif
 }
 
@@ -205,18 +205,18 @@ START_TEST(test_the_test_environment)
 
 #ifdef _WIN32
 /* Try to copy the files required for AppVeyor */
-#	if defined(_WIN64) || defined(__MINGW64__)
+#if defined(_WIN64) || defined(__MINGW64__)
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\libeay32.dll libeay32.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\libssl32.dll libssl32.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\ssleay32.dll ssleay32.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\libeay32.dll libeay64.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\libssl32.dll libssl64.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win64\\ssleay32.dll ssleay64.dll");
-#	else
+#else
 	(void)system("cmd /c copy C:\\OpenSSL-Win32\\libeay32.dll libeay32.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win32\\libssl32.dll libssl32.dll");
 	(void)system("cmd /c copy C:\\OpenSSL-Win32\\ssleay32.dll ssleay32.dll");
-#	endif
+#endif
 #endif
 }
 END_TEST
@@ -584,11 +584,11 @@ START_TEST(test_mg_start_stop_https_server)
 
 	struct mg_context *ctx;
 
-#	if defined(MG_LEGACY_INTERFACE)
+#if defined(MG_LEGACY_INTERFACE)
 	size_t ports_cnt;
 	int ports[16];
 	int ssl[16];
-#	endif
+#endif
 	struct mg_callbacks callbacks;
 	char errmsg[256];
 
@@ -605,10 +605,10 @@ START_TEST(test_mg_start_stop_https_server)
 	ck_assert(ssl_cert != NULL);
 
 	memset((void *)OPTIONS, 0, sizeof(OPTIONS));
-#	if !defined(NO_FILES)
+#if !defined(NO_FILES)
 	OPTIONS[opt_idx++] = "document_root";
 	OPTIONS[opt_idx++] = ".";
-#	endif
+#endif
 	OPTIONS[opt_idx++] = "listening_ports";
 	OPTIONS[opt_idx++] = "8080r,8443s";
 	OPTIONS[opt_idx++] = "ssl_certificate";
@@ -618,10 +618,10 @@ START_TEST(test_mg_start_stop_https_server)
 	ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 1] == NULL);
 	ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 2] == NULL);
 
-#	if defined(MG_LEGACY_INTERFACE)
+#if defined(MG_LEGACY_INTERFACE)
 	memset(ports, 0, sizeof(ports));
 	memset(ssl, 0, sizeof(ssl));
-#	endif
+#endif
 	memset(portinfo, 0, sizeof(portinfo));
 	memset(&callbacks, 0, sizeof(callbacks));
 	memset(errmsg, 0, sizeof(errmsg));
@@ -633,7 +633,7 @@ START_TEST(test_mg_start_stop_https_server)
 	ck_assert_str_eq(errmsg, "");
 	ck_assert(ctx != NULL);
 
-#	if defined(MG_LEGACY_INTERFACE)
+#if defined(MG_LEGACY_INTERFACE)
 	ports_cnt = mg_get_ports(ctx, 16, ports, ssl);
 	ck_assert_uint_eq(ports_cnt, 2);
 	ck_assert_int_eq(ports[0], 8080);
@@ -642,7 +642,7 @@ START_TEST(test_mg_start_stop_https_server)
 	ck_assert_int_eq(ssl[1], 1);
 	ck_assert_int_eq(ports[2], 0);
 	ck_assert_int_eq(ssl[2], 0);
-#	endif
+#endif
 
 	ret = mg_get_server_ports(ctx, 0, portinfo);
 	ck_assert_int_lt(ret, 0);
@@ -687,15 +687,15 @@ START_TEST(test_mg_start_stop_https_server)
 	client_ri = mg_get_response_info(client_conn);
 	ck_assert(client_ri != NULL);
 
-#	if defined(NO_FILES)
+#if defined(NO_FILES)
 	ck_assert_int_eq(client_ri->status_code, 404);
-#	else
+#else
 	ck_assert_int_eq(client_ri->status_code, 200);
 	/* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */
 	client_res = (int)mg_read(client_conn, client_err, sizeof(client_err));
 	ck_assert_int_gt(client_res, 0);
 	ck_assert_int_le(client_res, sizeof(client_err));
-#	endif
+#endif
 	mg_close_connection(client_conn);
 
 	test_sleep(1);
@@ -733,19 +733,19 @@ START_TEST(test_mg_server_and_client_tls)
 	ck_assert(res_dir != NULL);
 	strcpy(server_cert, res_dir);
 	strcpy(client_cert, res_dir);
-#	ifdef _WIN32
+#ifdef _WIN32
 	strcat(server_cert, "cert\\server.pem");
 	strcat(client_cert, "cert\\client.pem");
-#	else
+#else
 	strcat(server_cert, "cert/server.pem");
 	strcat(client_cert, "cert/client.pem");
-#	endif
+#endif
 
 	memset((void *)OPTIONS, 0, sizeof(OPTIONS));
-#	if !defined(NO_FILES)
+#if !defined(NO_FILES)
 	OPTIONS[opt_idx++] = "document_root";
 	OPTIONS[opt_idx++] = ".";
-#	endif
+#endif
 	OPTIONS[opt_idx++] = "listening_ports";
 	OPTIONS[opt_idx++] = "8080r,8443s";
 	OPTIONS[opt_idx++] = "ssl_certificate";
@@ -816,15 +816,15 @@ START_TEST(test_mg_server_and_client_tls)
 	client_ri = mg_get_response_info(client_conn);
 	ck_assert(client_ri != NULL);
 
-#	if defined(NO_FILES)
+#if defined(NO_FILES)
 	ck_assert_int_eq(client_ri->status_code, 404);
-#	else
+#else
 	ck_assert_int_eq(client_ri->status_code, 200);
 	/* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */
 	client_res = (int)mg_read(client_conn, client_err, sizeof(client_err));
 	ck_assert_int_gt(client_res, 0);
 	ck_assert_int_le(client_res, sizeof(client_err));
-#	endif
+#endif
 	mg_close_connection(client_conn);
 
 	/* TODO: A client API using a client certificate is missing */
@@ -934,7 +934,7 @@ static const size_t websocket_goodbye_msg_len =
     14 /* strlen(websocket_goodbye_msg) */;
 
 
-#	if defined(DEBUG)
+#if defined(DEBUG)
 static void
 WS_TEST_TRACE(const char *f, ...)
 {
@@ -943,9 +943,9 @@ WS_TEST_TRACE(const char *f, ...)
 	vprintf(f, l);
 	va_end(l);
 }
-#	else
-#		define WS_TEST_TRACE(...)
-#	endif
+#else
+#define WS_TEST_TRACE(...)
+#endif
 
 
 static int
@@ -981,8 +981,8 @@ websock_server_ready(struct mg_connection *conn, void *udata)
 }
 
 
-#	define long_ws_buf_len_16 (500)
-#	define long_ws_buf_len_64 (70000)
+#define long_ws_buf_len_16 (500)
+#define long_ws_buf_len_64 (70000)
 static char long_ws_buf[long_ws_buf_len_64];
 
 
@@ -1036,26 +1036,26 @@ websock_server_data(struct mg_connection *conn,
 		mg_unlock_connection(conn);
 	} else {
 
-#	if defined(__MINGW32__) || defined(__GNUC__)
-#		pragma GCC diagnostic push
-#		pragma GCC diagnostic ignored "-Wunreachable-code"
-#	endif
-#	ifdef __clang__
-#		pragma clang diagnostic push
-#		pragma clang diagnostic ignored "-Wunreachable-code"
-#	endif
+#if defined(__MINGW32__) || defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunreachable-code"
+#endif
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunreachable-code"
+#endif
 
 		ck_abort_msg("Got unexpected message from websocket client");
 
 
 		return 0;
 
-#	ifdef __clang__
-#		pragma clang diagnostic pop
-#	endif
-#	if defined(__MINGW32__) || defined(__GNUC__)
-#		pragma GCC diagnostic pop
-#	endif
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+#if defined(__MINGW32__) || defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
 	}
 	mark_point();
 
@@ -1066,7 +1066,7 @@ websock_server_data(struct mg_connection *conn,
 static void
 websock_server_close(const struct mg_connection *conn, void *udata)
 {
-#	ifndef __MACH__
+#ifndef __MACH__
 	ck_assert_ptr_eq((void *)udata, (void *)(ptrdiff_t)7531);
 	WS_TEST_TRACE("Server: Close connection\n");
 
@@ -1074,7 +1074,7 @@ websock_server_close(const struct mg_connection *conn, void *udata)
 	 * the connection is already closed */
 
 	mark_point();
-#	endif
+#endif
 
 	(void)conn;
 	(void)udata;
@@ -1143,7 +1143,7 @@ websocket_client_close_handler(const struct mg_connection *conn,
 	struct tclient_data *pclient_data =
 	    (struct tclient_data *)mg_get_user_data(ctx);
 
-#	ifndef __MACH__
+#ifndef __MACH__
 	ck_assert_ptr_eq(user_data, (void *)pclient_data);
 
 	ck_assert(pclient_data != NULL);
@@ -1152,12 +1152,12 @@ websocket_client_close_handler(const struct mg_connection *conn,
 	pclient_data->closed++;
 
 	mark_point();
-#	else
+#else
 
 	(void)user_data;
 	pclient_data->closed++;
 
-#	endif /* __MACH__ */
+#endif /* __MACH__ */
 }
 
 #endif /* USE_WEBSOCKET */
@@ -1661,12 +1661,12 @@ START_TEST(test_request_handlers)
 
 	ck_assert(client_ri != NULL);
 
-#	if defined(NO_FILES)
+#if defined(NO_FILES)
 	ck_assert_int_eq(client_ri->status_code, 404);
 
 	(void)expected_cgi_result;
 	(void)cgi_script_content;
-#	else
+#else
 	i = mg_read(client_conn, buf, sizeof(buf));
 	if ((i >= 0) && (i < (int)sizeof(buf))) {
 		while ((i > 0) && ((buf[i - 1] == '\r') || (buf[i - 1] == '\n'))) {
@@ -1678,7 +1678,7 @@ START_TEST(test_request_handlers)
 	ck_assert_str_eq(buf, expected_cgi_result);
 	ck_assert_int_eq(client_ri->status_code, 200);
 	mg_close_connection(client_conn);
-#	endif
+#endif
 
 #else
 	(void)expected_cgi_result;
@@ -1957,7 +1957,7 @@ START_TEST(test_request_handlers)
 	ws_client1_data.len = 0;
 
 /* Now connect a second client */
-#	ifdef USE_IPV6
+#ifdef USE_IPV6
 	ws_client2_conn =
 	    mg_connect_websocket_client("[::1]",
 	                                ipv6_port,
@@ -1969,7 +1969,7 @@ START_TEST(test_request_handlers)
 	                                websocket_client_data_handler,
 	                                websocket_client_close_handler,
 	                                &ws_client2_data);
-#	else
+#else
 	ws_client2_conn =
 	    mg_connect_websocket_client("127.0.0.1",
 	                                ipv4_port,
@@ -1981,7 +1981,7 @@ START_TEST(test_request_handlers)
 	                                websocket_client_data_handler,
 	                                websocket_client_close_handler,
 	                                &ws_client2_data);
-#	endif
+#endif
 	ck_assert(ws_client2_conn != NULL);
 
 	wait_not_null(
@@ -2088,13 +2088,13 @@ START_TEST(test_request_handlers)
 	/* Connect client 3 */
 	ws_client3_conn =
 	    mg_connect_websocket_client("localhost",
-#	if defined(NO_SSL)
+#if defined(NO_SSL)
 	                                ipv4_port,
 	                                0,
-#	else
+#else
 	                                ipv4s_port,
 	                                1,
-#	endif
+#endif
 	                                ebuf,
 	                                sizeof(ebuf),
 	                                "/websocket",
@@ -2161,13 +2161,13 @@ START_TEST(test_request_handlers)
 	/* Connect client 4 */
 	ws_client4_conn =
 	    mg_connect_websocket_client("localhost",
-#	if defined(NO_SSL)
+#if defined(NO_SSL)
 	                                ipv4_port,
 	                                0,
-#	else
+#else
 	                                ipv4s_port,
 	                                1,
-#	endif
+#endif
 	                                ebuf,
 	                                sizeof(ebuf),
 	                                "/websocket",
@@ -3146,10 +3146,10 @@ START_TEST(test_http_auth)
 		".",
 		"listening_ports",
 		"8080",
-#	if !defined(NO_CACHING)
+#if !defined(NO_CACHING)
 		"static_file_max_age",
 		"0",
-#	endif
+#endif
 		"put_delete_auth_file",
 		"put_delete_auth_file.csv",
 		NULL,
@@ -4230,16 +4230,16 @@ START_TEST(test_large_file)
 	OPTIONS[opt_cnt++] = "8443s";
 	OPTIONS[opt_cnt++] = "ssl_certificate";
 	OPTIONS[opt_cnt++] = ssl_cert;
-#	ifdef __MACH__
+#ifdef __MACH__
 	/* The Apple builds on Travis CI seem to have problems with TLS1.x
 	 * Allow SSLv3 and TLS */
 	OPTIONS[opt_cnt++] = "ssl_protocol_version";
 	OPTIONS[opt_cnt++] = "2";
-#	else
+#else
 	/* The Linux builds on Travis CI work fine with TLS1.2 */
 	OPTIONS[opt_cnt++] = "ssl_protocol_version";
 	OPTIONS[opt_cnt++] = "4";
-#	endif
+#endif
 	ck_assert(ssl_cert != NULL);
 #endif
 	OPTIONS[opt_cnt] = NULL;
@@ -4505,7 +4505,7 @@ END_TEST
 
 #if defined(MG_USE_OPEN_FILE) && !defined(NO_FILES)
 
-#	define FILE_IN_MEM_SIZE (1024 * 100)
+#define FILE_IN_MEM_SIZE (1024 * 100)
 static char *file_in_mem_data;
 
 static const char *
@@ -4533,9 +4533,9 @@ START_TEST(test_file_in_memory)
 	struct mg_callbacks callbacks;
 	const char *OPTIONS[32];
 	int opt_cnt = 0;
-#	if !defined(NO_SSL)
+#if !defined(NO_SSL)
 	const char *ssl_cert = locate_ssl_cert();
-#	endif
+#endif
 
 	/* Client var */
 	struct mg_connection *client;
@@ -4555,16 +4555,16 @@ START_TEST(test_file_in_memory)
 	/* Set options and start server */
 	OPTIONS[opt_cnt++] = "document_root";
 	OPTIONS[opt_cnt++] = ".";
-#	if defined(NO_SSL)
+#if defined(NO_SSL)
 	OPTIONS[opt_cnt++] = "listening_ports";
 	OPTIONS[opt_cnt++] = "8080";
-#	else
+#else
 	OPTIONS[opt_cnt++] = "listening_ports";
 	OPTIONS[opt_cnt++] = "8443s";
 	OPTIONS[opt_cnt++] = "ssl_certificate";
 	OPTIONS[opt_cnt++] = ssl_cert;
 	ck_assert(ssl_cert != NULL);
-#	endif
+#endif
 	OPTIONS[opt_cnt] = NULL;
 
 
@@ -4580,13 +4580,13 @@ START_TEST(test_file_in_memory)
 
 	client =
 	    mg_download("127.0.0.1",
-#	if defined(NO_SSL)
+#if defined(NO_SSL)
 	                8080,
 	                0,
-#	else
+#else
 	                8443,
 	                1,
-#	endif
+#endif
 	                client_err_buf,
 	                sizeof(client_err_buf),
 	                "GET /file_in_mem HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n");
@@ -4754,7 +4754,7 @@ START_TEST(test_minimal_tls_client)
 
 #if !defined(NO_SSL) /* dont run https test if SSL is not enabled */
 
-#	if (!defined(__MACH__) || defined(LOCAL_TEST)) && !defined(OPENSSL_API_1_1)
+#if (!defined(__MACH__) || defined(LOCAL_TEST)) && !defined(OPENSSL_API_1_1)
 	/* dont run on Travis OSX worker with OpenSSL 1.0 */
 
 	/* Initialize the library */
@@ -4772,7 +4772,7 @@ START_TEST(test_minimal_tls_client)
 	/* Un-initialize the library */
 	mg_exit_library();
 
-#	endif
+#endif
 #endif
 
 	mark_point();
@@ -4883,7 +4883,7 @@ START_TEST(test_minimal_https_server_callback)
 	OPTIONS[opt_idx++] = "ssl_certificate";
 	OPTIONS[opt_idx++] = locate_ssl_cert();
 
-#	if defined(LOCAL_TEST) || defined(_WIN32)
+#if defined(LOCAL_TEST) || defined(_WIN32)
 	/* Do not set this on Travis CI, since the build containers
 	 * contain older SSL libraries */
 
@@ -4894,7 +4894,7 @@ START_TEST(test_minimal_https_server_callback)
 	/* set some modern ciphers - recommended */
 	OPTIONS[opt_idx++] = "ssl_cipher_list";
 	OPTIONS[opt_idx++] = "ECDH+AESGCM+AES256:!aNULL:!MD5:!DSS";
-#	endif
+#endif
 
 	/* set "HTTPS only" header - recommended */
 	OPTIONS[opt_idx++] = "strict_transport_security_max_age";

+ 6 - 7
unittest/shared.c

@@ -20,16 +20,15 @@
  */
 
 #ifdef _MSC_VER
-#	if !defined(_CRT_SECURE_NO_WARNINGS)
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
-#	if !defined(_CRT_SECURE_NO_DEPRECATE)
-#		define _CRT_SECURE_NO_DEPRECATE
-#	endif
+#if !defined(_CRT_SECURE_NO_WARNINGS)
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+#if !defined(_CRT_SECURE_NO_DEPRECATE)
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
 #endif
 
 #include "shared.h"
-
 #include <string.h>
 
 static char s_test_directory[1024] = {'\0'};

+ 11 - 11
unittest/timertest.c

@@ -24,26 +24,26 @@
  * static functions
  */
 #ifdef _MSC_VER
-#	ifndef _CRT_SECURE_NO_WARNINGS
-#		define _CRT_SECURE_NO_WARNINGS
-#	endif
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 #endif
 
 #if defined(__GNUC__)
-#	pragma GCC diagnostic push
-#	pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
 #endif
 
 #define CIVETWEB_API static
 #define USE_TIMERS
 
-#include "timertest.h"
-
 #include "../src/civetweb.c"
 
 #include <stdlib.h>
 #include <time.h>
 
+#include "timertest.h"
+
 static int action_dec_ret;
 
 static int
@@ -326,10 +326,10 @@ TIMER_PRIVATE(void)
 	unsigned f_avail;
 	unsigned f_ret;
 
-#	if defined(_WIN32)
+#if defined(_WIN32)
 	WSADATA data;
 	WSAStartup(MAKEWORD(2, 2), &data);
-#	endif
+#endif
 
 	f_avail = mg_check_feature(0xFF);
 	f_ret = mg_init_library(f_avail);
@@ -342,9 +342,9 @@ TIMER_PRIVATE(void)
 
 	mg_exit_library();
 
-#	if defined(_WIN32)
+#if defined(_WIN32)
 	WSACleanup();
-#	endif
+#endif
 }
 
 #endif

Some files were not shown because too many files changed in this diff