Browse Source

Re-format source

bel 9 years ago
parent
commit
1ef0bc06c1
2 changed files with 9 additions and 9 deletions
  1. 7 8
      src/civetweb.c
  2. 2 1
      test/public_server.c

+ 7 - 8
src/civetweb.c

@@ -3581,8 +3581,7 @@ get_random(void)
 		/* lfsr will be only 0 if has not been initialized,
 		 * so this code is called only once. */
 		lfsr = (((uint64_t)now.tv_sec) << 21) ^ ((uint64_t)now.tv_nsec)
-		       ^ ((uint64_t)(ptrdiff_t)&now)
-		       ^ (((uint64_t)time(NULL)) << 33);
+		       ^ ((uint64_t)(ptrdiff_t)&now) ^ (((uint64_t)time(NULL)) << 33);
 		lcg = (((uint64_t)now.tv_sec) << 25) + (uint64_t)now.tv_nsec
 		      + (uint64_t)(ptrdiff_t)&now;
 	} else {
@@ -10526,12 +10525,12 @@ ssl_id_callback(void)
 		}
 		return tls->thread_idx;
 	} else {
-        /* pthread_t may be any data type, so a simple cast to unsigned long
-         * can rise a warning/error, depending on the platform.
-         * Here memcpy is used as an anything-to-anything cast. */
-        unsigned long ret = 0;
-        pthread_t t = pthread_self();
-        memcpy(&ret, &t, sizeof(pthread_t));
+		/* pthread_t may be any data type, so a simple cast to unsigned long
+		 * can rise a warning/error, depending on the platform.
+		 * Here memcpy is used as an anything-to-anything cast. */
+		unsigned long ret = 0;
+		pthread_t t = pthread_self();
+		memcpy(&ret, &t, sizeof(pthread_t));
 		return ret;
 	}
 

+ 2 - 1
test/public_server.c

@@ -35,7 +35,7 @@
 
 #if defined(_WIN32)
 #include <Windows.h>
-#define test_sleep(x) (Sleep(x * 1000))
+#define test_sleep(x) (Sleep((x)*1000))
 #else
 #include <unistd.h>
 #define test_sleep(x) (sleep(x))
@@ -863,6 +863,7 @@ START_TEST(test_request_handlers)
 	ck_assert(ri != NULL);
 	ck_assert_str_eq(ri->uri, "200");
 	i = mg_read(client_conn, buf, sizeof(buf));
+	ck_assert(i < sizeof(buf));
 	ck_assert_int_eq(i, (int)strlen(expected));
 	buf[i] = 0;
 	ck_assert_str_eq(buf, expected);