Procházet zdrojové kódy

Fix OpENerTests.cpp issues

Signed-off-by: Martin Melik Merkumians <martin.melik@gmail.com>
Martin Melik Merkumians před 1 měsícem
rodič
revize
80cabc9ce0
1 změnil soubory, kde provedl 9 přidání a 11 odebrání
  1. 9 11
      source/tests/OpENerTests.cpp

+ 9 - 11
source/tests/OpENerTests.cpp

@@ -6,8 +6,8 @@
 
 #include "OpENerTests.h"
 
-#include <setjmp.h>
-#include <stdio.h>
+#include <csetjmp>
+#include <cstdio>
 
 #include <stdexcept>
 
@@ -15,7 +15,7 @@
 #include "CppUTestExt/MockSupportPlugin.h"
 
 extern "C" {
-#include "endianconv.h"
+#include "enet_encap/endianconv.h"
 }
 
 /*
@@ -79,7 +79,7 @@ extern "C" void test_assert_fail(const char* const file,
     char dummy;
 
     /* Determine how long the exception message would be. */
-    int len_no_null = snprintf(&dummy, 1, format, file, line);
+    int len_no_null = snprintf(&dummy, sizeof(dummy), format, file, line);
 
     if (len_no_null > 0) {
       /*
@@ -104,13 +104,11 @@ extern "C" void test_assert_fail(const char* const file,
 
     /* Throw a generic exception if string generation fails. */
     throw std::runtime_error("Assertion failure.");
-  }
-
-  /*
-   * Execute the jump back to the unit test function if an assertion was
-   * expected.
-   */
-  else {
+  } else {
+    /*
+     * Execute the jump back to the unit test function if an assertion was
+     * expected.
+     */
     longjmp(assert_jump, 0);
   }
 }