Bläddra i källkod

Fix some unit tests

bel 9 år sedan
förälder
incheckning
3426051cb7
4 ändrade filer med 5 tillägg och 5 borttagningar
  1. 1 1
      src/civetweb.c
  2. 1 1
      test/private.c
  3. 2 2
      test/public_func.c
  4. 1 1
      test/public_server.c

+ 1 - 1
src/civetweb.c

@@ -1866,7 +1866,7 @@ gmt_time_string(char *buf, size_t buf_len, time_t *t)
 {
 	struct tm *tm;
 
-	tm = gmtime(t);
+	tm = ((t != NULL) ? gmtime(t) : NULL);
 	if (tm != NULL) {
 		strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S GMT", tm);
 	} else {

+ 1 - 1
test/private.c

@@ -700,7 +700,7 @@ make_private_suite(void)
 /* Used to debug test cases without using the check framework */
 
 void
-xmain(void)
+main(void)
 {
 	test_alloc_vprintf(0);
 	test_mg_vsnprintf(0);

+ 2 - 2
test/public_func.c

@@ -447,8 +447,8 @@ START_TEST(test_mg_get_response_code_text)
 		for (j = 0; j < len; j++) {
 			if (resp[j] == ' ') {
 				/* space is valid */
-            } else if (resp[j] == '-') {
-                /* hyphen is valid */
+			} else if (resp[j] == '-') {
+				/* hyphen is valid */
 			} else if (resp[j] >= 'A' && resp[j] <= 'Z') {
 				/* A-Z is valid */
 			} else if (resp[j] >= 'a' && resp[j] <= 'z') {

+ 1 - 1
test/public_server.c

@@ -2092,7 +2092,7 @@ static int chk_failed = 0;
 
 
 void
-main(void)
+xmain(void)
 {
 	/*
 	    test_the_test_environment(0);