Browse Source

Format code using clang-format

bel2125 5 năm trước cách đây
mục cha
commit
33d4f6f998
4 tập tin đã thay đổi với 32 bổ sung25 xóa
  1. 23 20
      src/civetweb.c
  2. 1 1
      src/main.c
  3. 2 1
      unittest/private.c
  4. 6 3
      unittest/public_server.c

+ 23 - 20
src/civetweb.c

@@ -235,7 +235,7 @@ static void DEBUG_TRACE_FUNC(const char *func,
 
 #define NEED_DEBUG_TRACE_FUNC
 #ifndef DEBUG_TRACE_STREAM
-# define DEBUG_TRACE_STREAM   stdout
+#define DEBUG_TRACE_STREAM stdout
 #endif
 
 #else
@@ -585,7 +585,7 @@ typedef long off_t;
 #define CRYPTO_LIB "libeay64.dll"
 #endif /* OPENSSL_API_1_1 */
 #endif /* CRYPTO_LIB */
-#else /* defined(_WIN64) || defined(__MINGW64__) */
+#else  /* defined(_WIN64) || defined(__MINGW64__) */
 #if !defined(SSL_LIB)
 #define SSL_LIB "ssleay32.dll"
 #endif /* SSL_LIB */
@@ -1747,13 +1747,14 @@ DEBUG_TRACE_FUNC(const char *func, unsigned line, const char *fmt, ...)
 	}
 
 	flockfile(DEBUG_TRACE_STREAM);
-	fprintf( DEBUG_TRACE_STREAM,"*** %lu.%09lu %12" INT64_FMT " %lu %s:%u: ",
-	       (unsigned long)tsnow.tv_sec,
-	       (unsigned long)tsnow.tv_nsec,
-	       nsnow - nslast,
-	       thread_id,
-	       func,
-	       line);
+	fprintf(DEBUG_TRACE_STREAM,
+	        "*** %lu.%09lu %12" INT64_FMT " %lu %s:%u: ",
+	        (unsigned long)tsnow.tv_sec,
+	        (unsigned long)tsnow.tv_nsec,
+	        nsnow - nslast,
+	        thread_id,
+	        func,
+	        line);
 	va_start(args, fmt);
 	vfprintf(DEBUG_TRACE_STREAM, fmt, args);
 	va_end(args);
@@ -17087,16 +17088,17 @@ mg_connect_client2(const char *host,
 #if defined(USE_WEBSOCKET)
 	if (is_ws) {
 		/* TODO: implement all options */
-		return mg_connect_websocket_client(host,
-		                                   port,
-		                                   is_ssl,
-		                                   ((error != NULL) ? error->text : NULL),
-		                                   ((error != NULL) ? error->text_buffer_size : 0),
-		                                   (path ? path : ""),
-		                                   NULL /* TODO: origin */,
-		                                   deprecated_websocket_data_wrapper,
-		                                   deprecated_websocket_close_wrapper,
-		                                   (void *)init->callbacks);
+		return mg_connect_websocket_client(
+		    host,
+		    port,
+		    is_ssl,
+		    ((error != NULL) ? error->text : NULL),
+		    ((error != NULL) ? error->text_buffer_size : 0),
+		    (path ? path : ""),
+		    NULL /* TODO: origin */,
+		    deprecated_websocket_data_wrapper,
+		    deprecated_websocket_close_wrapper,
+		    (void *)init->callbacks);
 	}
 #endif
 
@@ -17108,7 +17110,8 @@ mg_connect_client2(const char *host,
 	return mg_connect_client_impl(&opts,
 	                              is_ssl,
 	                              ((error != NULL) ? error->text : NULL),
-	                              ((error != NULL) ? error->text_buffer_size : 0));
+	                              ((error != NULL) ? error->text_buffer_size
+	                                               : 0));
 }
 #endif
 

+ 1 - 1
src/main.c

@@ -2196,7 +2196,7 @@ add_control(struct dlg_complete *dlg,
 	for (i = 0; i <= cap_len; i++) {
 		p[i] = (WCHAR)caption[i];
 	}
-	dlg->used += (cap_len+1) * sizeof(*p);
+	dlg->used += (cap_len + 1) * sizeof(*p);
 
 	/* align to 2 bytes */
 	while (dlg->used % 2) {

+ 2 - 1
unittest/private.c

@@ -1043,7 +1043,8 @@ START_TEST(test_config_options)
 	ck_assert_str_eq("keep_alive_timeout_ms",
 	                 config_options[KEEP_ALIVE_TIMEOUT].name);
 	ck_assert_str_eq("linger_timeout_ms", config_options[LINGER_TIMEOUT].name);
-	ck_assert_str_eq("listen_backlog", config_options[LISTEN_BACKLOG_SIZE].name);
+	ck_assert_str_eq("listen_backlog",
+	                 config_options[LISTEN_BACKLOG_SIZE].name);
 	ck_assert_str_eq("ssl_verify_peer",
 	                 config_options[SSL_DO_VERIFY_PEER].name);
 	ck_assert_str_eq("ssl_ca_path", config_options[SSL_CA_PATH].name);

+ 6 - 3
unittest/public_server.c

@@ -787,7 +787,8 @@ START_TEST(test_mg_server_and_client_tls)
 
 	/* cannot connect without client certificate */
 #if defined(__MACH__)
-	/* except for Apple (maybe this is specific to the MacOS container on TravisCI?) */
+	/* except for Apple (maybe this is specific to the MacOS container on
+	 * TravisCI?) */
 	if (client_conn) {
 		mg_printf(client_conn, "GET / HTTP/1.0\r\n\r\n");
 		client_res =
@@ -796,10 +797,12 @@ START_TEST(test_mg_server_and_client_tls)
 		ck_assert_str_ne(client_err, "");
 		client_ri = mg_get_response_info(client_conn);
 		ck_assert(client_ri == NULL);
-		
+
 		mg_close_connection(client_conn);
 		client_conn = NULL;
-		strcpy(client_err, "OpenSSL on MacOS allows to connect without a mandatory client certificate, but not data exchange");
+		strcpy(client_err,
+		       "OpenSSL on MacOS allows to connect without a mandatory client "
+		       "certificate, but not data exchange");
 	}
 #endif
 	ck_assert(client_conn == NULL);