فهرست منبع

Format code after merge (using clang-format 10.0.0)

Bernhard Lehner 5 سال پیش
والد
کامیت
d5753d9b1c
3فایلهای تغییر یافته به همراه41 افزوده شده و 39 حذف شده
  1. 24 24
      src/civetweb.c
  2. 12 10
      src/main.c
  3. 5 5
      src/mod_lua.inl

+ 24 - 24
src/civetweb.c

@@ -3962,7 +3962,7 @@ mg_get_request_link(const struct mg_connection *conn, char *buf, size_t buflen)
 			int auth_domain_check_enabled =
 			    conn->dom_ctx->config[ENABLE_AUTH_DOMAIN_CHECK]
 			    && (!mg_strcasecmp(
-			           conn->dom_ctx->config[ENABLE_AUTH_DOMAIN_CHECK], "yes"));
+			        conn->dom_ctx->config[ENABLE_AUTH_DOMAIN_CHECK], "yes"));
 			const char *server_domain =
 			    conn->dom_ctx->config[AUTHENTICATION_DOMAIN];
 
@@ -12057,7 +12057,7 @@ print_dav_dir_entry(struct de *de, void *data)
 	struct mg_connection *conn = (struct mg_connection *)data;
 	if (!de || !conn
 	    || !print_props(
-	           conn, conn->request_info.local_uri, de->file_name, &de->file)) {
+	        conn, conn->request_info.local_uri, de->file_name, &de->file)) {
 		return -1;
 	}
 	return 0;
@@ -14385,7 +14385,7 @@ parse_port_string(const struct vec *vec, struct socket *so, int *ip_version)
 #if defined(USE_IPV6)
 	} else if (sscanf(vec->ptr, "[%49[^]]]:%u%n", buf, &port, &len) == 2
 	           && mg_inet_pton(
-	                  AF_INET6, buf, &so->lsa.sin6, sizeof(so->lsa.sin6))) {
+	               AF_INET6, buf, &so->lsa.sin6, sizeof(so->lsa.sin6))) {
 		/* IPv6 address, examples: see above */
 		/* so->lsa.sin6.sin6_family = AF_INET6; already set by mg_inet_pton
 		 */
@@ -18499,31 +18499,31 @@ get_system_name(char **sysName)
 }
 
 
-static void legacy_init(const char **options) {
-		const char *ports_option =
-			config_options[LISTENING_PORTS].default_value;
+static void
+legacy_init(const char **options)
+{
+	const char *ports_option = config_options[LISTENING_PORTS].default_value;
 
-		if (options) {
-			const char **run_options = options;
-			const char *optname = config_options[LISTENING_PORTS].name;
+	if (options) {
+		const char **run_options = options;
+		const char *optname = config_options[LISTENING_PORTS].name;
 
-			/* Try to find the "listening_ports" option */
-			while (*run_options) {
-				if (!strcmp(*run_options, optname)) {
-					ports_option = run_options[1];
-				}
-				run_options += 2;
+		/* Try to find the "listening_ports" option */
+		while (*run_options) {
+			if (!strcmp(*run_options, optname)) {
+				ports_option = run_options[1];
 			}
+			run_options += 2;
 		}
+	}
 
-		if (is_ssl_port_used(ports_option)) {
-			/* Initialize with SSL support */
-			mg_init_library(MG_FEATURES_TLS);
-		}
-		else {
-			/* Initialize without SSL support */
-			mg_init_library(MG_FEATURES_DEFAULT);
-		}
+	if (is_ssl_port_used(ports_option)) {
+		/* Initialize with SSL support */
+		mg_init_library(MG_FEATURES_TLS);
+	} else {
+		/* Initialize without SSL support */
+		mg_init_library(MG_FEATURES_DEFAULT);
+	}
 }
 
 struct mg_context *
@@ -18547,7 +18547,7 @@ mg_start(const struct mg_callbacks *callbacks,
 
 	if (mg_init_library_called == 0) {
 		/* Legacy INIT, if mg_start is called without mg_init_library.
-		* Note: This will cause a memory leak when unloading the library. */
+		 * Note: This will cause a memory leak when unloading the library. */
 		legacy_init(options);
 	}
 

+ 12 - 10
src/main.c

@@ -2030,7 +2030,7 @@ get_password(const char *user,
 
 	ok = (IDOK
 	      == DialogBoxIndirectParam(
-	             NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
+	          NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
 
 	s_dlg_proc_param.hWnd = NULL;
 	s_dlg_proc_param.guard = 0;
@@ -2519,11 +2519,10 @@ change_password_file()
 		s_dlg_proc_param.name = path;
 		s_dlg_proc_param.fRetry = NULL;
 
-	} while (
-	    (IDOK
-	     == DialogBoxIndirectParam(
-	            NULL, dia, NULL, PasswordDlgProc, (LPARAM)&s_dlg_proc_param))
-	    && (!g_exit_flag));
+	} while ((IDOK
+	          == DialogBoxIndirectParam(
+	              NULL, dia, NULL, PasswordDlgProc, (LPARAM)&s_dlg_proc_param))
+	         && (!g_exit_flag));
 
 	s_dlg_proc_param.hWnd = NULL;
 	s_dlg_proc_param.guard = 0;
@@ -2648,7 +2647,7 @@ show_system_info()
 
 	ok = (IDOK
 	      == DialogBoxIndirectParam(
-	             NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
+	          NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
 
 	s_dlg_proc_param.hWnd = NULL;
 	s_dlg_proc_param.guard = 0;
@@ -2985,13 +2984,15 @@ main(int argc, char *argv[])
 @end
 
 @implementation Civetweb
-- (void)openBrowser {
+- (void)openBrowser
+{
 	[[NSWorkspace sharedWorkspace]
 	    openURL:[NSURL URLWithString:[NSString stringWithUTF8String:
 	                                               get_url_to_first_open_port(
 	                                                   g_ctx)]]];
 }
-- (void)editConfig {
+- (void)editConfig
+{
 	create_config_file(g_ctx, g_config_file_name);
 	NSString *path = [NSString stringWithUTF8String:g_config_file_name];
 	if (![[NSWorkspace sharedWorkspace] openFile:path
@@ -3004,7 +3005,8 @@ main(int argc, char *argv[])
 		(void)[alert runModal];
 	}
 }
-- (void)shutDown {
+- (void)shutDown
+{
 	[NSApp terminate:nil];
 }
 @end

+ 5 - 5
src/mod_lua.inl

@@ -1603,11 +1603,10 @@ lsp_trace(lua_State *L)
 	int firstarg = 1;
 	int i;
 
-	for (i=0; i<8; i++) {
+	for (i = 0; i < 8; i++) {
 		if (num_args >= (i + 1)) {
 			arg_type[i] = lua_type(L, (i + 1));
-		}
-		else {
+		} else {
 			arg_type[i] = LUA_TNIL;
 		}
 	}
@@ -1629,7 +1628,8 @@ lsp_trace(lua_State *L)
 	}
 
 	if (trace_level > s_lua_traceLevel) {
-		/* If this trace request has a higher trace level than the global trace level, do not trace. */
+		/* If this trace request has a higher trace level than the global trace
+		 * level, do not trace. */
 		lua_pushboolean(L, 0);
 		return 1;
 	}
@@ -2939,7 +2939,7 @@ lua_init_optional_libraries(void)
 {
 	/* Create logging mutex */
 	pthread_mutex_init(&s_lua_traceMutex, &pthread_mutex_attr);
-	
+
 	/* shared Lua state */
 	lua_shared_init();