From: Damir Tomic Date: Sat, 4 Jul 2015 07:49:26 +0000 (+0200) Subject: minor warning fixes like adding void etc. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0987d95dd780a13aae4c6120955d4decaa73b9fd;p=thirdparty%2Fntp.git minor warning fixes like adding void etc. bk: 55979006Ht8Q4m8juxtzFgnKfHg5Og --- diff --git a/sntp/tests/crypto.c b/sntp/tests/crypto.c index 254469e63..c9a1cedbf 100644 --- a/sntp/tests/crypto.c +++ b/sntp/tests/crypto.c @@ -8,6 +8,7 @@ #define MD5_LENGTH 16 #define SHA1_LENGTH 20 + void test_MakeMd5Mac(void) { const char* PKT_DATA = "abcdefgh0123"; diff --git a/sntp/tests/keyFile.c b/sntp/tests/keyFile.c index 3769947c5..10a68fb02 100644 --- a/sntp/tests/keyFile.c +++ b/sntp/tests/keyFile.c @@ -50,7 +50,7 @@ bool CompareKeysAlternative(int key_id, } -void test_ReadEmptyKeyFile() { +void test_ReadEmptyKeyFile(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys)); @@ -58,7 +58,7 @@ void test_ReadEmptyKeyFile() { TEST_ASSERT_TRUE(keys == NULL); } -void test_ReadASCIIKeys() { +void test_ReadASCIIKeys(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-ascii", INPUT_DIR), &keys)); @@ -76,7 +76,7 @@ void test_ReadASCIIKeys() { TEST_ASSERT_TRUE(CompareKeysAlternative(50, 11, "MD5", "asciikeyOne", *result)); } -void test_ReadHexKeys() { +void test_ReadHexKeys(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys)); @@ -102,7 +102,7 @@ void test_ReadHexKeys() { TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result)); } -void test_ReadKeyFileWithComments() { +void test_ReadKeyFileWithComments(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-comments", INPUT_DIR), &keys)); @@ -121,7 +121,7 @@ void test_ReadKeyFileWithComments() { TEST_ASSERT_TRUE(CompareKeysAlternative(34, 3, "MD5", "xyz", *result)); } -void test_ReadKeyFileWithInvalidHex() { +void test_ReadKeyFileWithInvalidHex(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(1, auth_init(CreatePath("key-test-invalid-hex", INPUT_DIR), &keys)); diff --git a/sntp/tests/kodDatabase.c b/sntp/tests/kodDatabase.c index a6b86d06b..f64dc73e1 100644 --- a/sntp/tests/kodDatabase.c +++ b/sntp/tests/kodDatabase.c @@ -19,7 +19,7 @@ void tearDown(void) } -void test_SingleEntryHandling() { +void test_SingleEntryHandling(void) { char HOST[] = "192.0.2.5"; char REASON[] = "DENY"; @@ -32,7 +32,7 @@ void test_SingleEntryHandling() { TEST_ASSERT_EQUAL_STRING(REASON, result->type); } -void test_MultipleEntryHandling() { +void test_MultipleEntryHandling(void) { char HOST1[] = "192.0.2.3"; char REASON1[] = "DENY"; @@ -63,7 +63,7 @@ void test_MultipleEntryHandling() { free(result); } -void test_NoMatchInSearch() { +void test_NoMatchInSearch(void) { char HOST_ADD[] = "192.0.2.6"; char HOST_NOTADD[] = "192.0.6.1"; char REASON[] = "DENY"; @@ -76,7 +76,7 @@ void test_NoMatchInSearch() { TEST_ASSERT_TRUE(result == NULL); } -void test_AddDuplicate() { +void test_AddDuplicate(void) { char HOST[] = "192.0.2.3"; char REASON1[] = "RATE"; char REASON2[] = "DENY"; @@ -101,7 +101,7 @@ void test_AddDuplicate() { free(result2); } -void test_DeleteEntry() { +void test_DeleteEntry(void) { char HOST1[] = "192.0.2.1"; char HOST2[] = "192.0.2.2"; char HOST3[] = "192.0.2.3"; diff --git a/sntp/tests/kodFile.c b/sntp/tests/kodFile.c index 7daec2126..b76d1b117 100644 --- a/sntp/tests/kodFile.c +++ b/sntp/tests/kodFile.c @@ -17,22 +17,22 @@ extern int kod_db_cnt; extern struct kod_entry** kod_db; extern char* kod_db_file; -void setUp() { +void setUp(void) { kod_db_cnt = 0; kod_db = NULL; } -void tearDown() { +void tearDown(void) { } -void test_ReadEmptyFile() { +void test_ReadEmptyFile(void) { kod_init_kod_db(CreatePath("kod-test-empty", INPUT_DIR), TRUE); TEST_ASSERT_EQUAL(0, kod_db_cnt); } -void test_ReadCorrectFile() { +void test_ReadCorrectFile(void) { kod_init_kod_db(CreatePath("kod-test-correct", INPUT_DIR), TRUE); TEST_ASSERT_EQUAL(2, kod_db_cnt); @@ -50,7 +50,7 @@ void test_ReadCorrectFile() { TEST_ASSERT_EQUAL(0xfff, res->timestamp); } -void test_ReadFileWithBlankLines() { +void test_ReadFileWithBlankLines(void) { kod_init_kod_db(CreatePath("kod-test-blanks", INPUT_DIR), TRUE); TEST_ASSERT_EQUAL(3, kod_db_cnt); @@ -73,7 +73,7 @@ void test_ReadFileWithBlankLines() { TEST_ASSERT_EQUAL(0xabcd, res->timestamp); } -void test_WriteEmptyFile() { +void test_WriteEmptyFile(void) { //kod_db_file = estrdup(CreatePath("kod-output-blank", OUTPUT_DIR)); //causing issues on psp-at1, replaced kod_db_file = estrdup("kod-output-blank"); //printf("kod PATH: %s\n",kod_db_file); @@ -89,7 +89,7 @@ void test_WriteEmptyFile() { fclose(is); } -void test_WriteFileWithSingleEntry() { +void test_WriteFileWithSingleEntry(void) { //kod_db_file = estrdup(CreatePath("kod-output-single", OUTPUT_DIR)); //causing issues on psp-at1, replaced kod_db_file = estrdup("kod-output-single"); //printf("kod PATH: %s\n",kod_db_file); @@ -113,7 +113,7 @@ void test_WriteFileWithSingleEntry() { TEST_ASSERT_TRUE(CompareFileContent(expected, actual)); } -void test_WriteFileWithMultipleEntries() { +void test_WriteFileWithMultipleEntries(void) { //kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR)); //causing issues on psp-at1, replaced kod_db_file = estrdup("kod-output-multiple"); //printf("kod PATH: %s\n",kod_db_file); diff --git a/sntp/tests/packetProcessing.c b/sntp/tests/packetProcessing.c index 27ab72e4d..07bfc30f6 100644 --- a/sntp/tests/packetProcessing.c +++ b/sntp/tests/packetProcessing.c @@ -43,7 +43,7 @@ void PrepareAuthenticationTestMD5(int key_id, PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq); } -void setUp() { +void setUp(void) { sntptest(); restoreKeyDb = false; @@ -66,7 +66,7 @@ void setUp() { } -void tearDown() { +void tearDown(void) { if (restoreKeyDb) { key_cnt = 0; diff --git a/sntp/tests/run-keyFile.c b/sntp/tests/run-keyFile.c index 0a6380d33..decf612c7 100644 --- a/sntp/tests/run-keyFile.c +++ b/sntp/tests/run-keyFile.c @@ -26,11 +26,12 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); -extern void test_ReadEmptyKeyFile(); -extern void test_ReadASCIIKeys(); -extern void test_ReadHexKeys(); -extern void test_ReadKeyFileWithComments(); -extern void test_ReadKeyFileWithInvalidHex(); +void resetTest(void); +extern void test_ReadEmptyKeyFile(void); +extern void test_ReadASCIIKeys(void); +extern void test_ReadHexKeys(void); +extern void test_ReadKeyFileWithComments(void); +extern void test_ReadKeyFileWithInvalidHex(void); //=======Test Reset Option===== diff --git a/sntp/tests/run-kodDatabase.c b/sntp/tests/run-kodDatabase.c index 7fc96783e..db7addcd2 100644 --- a/sntp/tests/run-kodDatabase.c +++ b/sntp/tests/run-kodDatabase.c @@ -26,11 +26,12 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); -extern void test_SingleEntryHandling(); -extern void test_MultipleEntryHandling(); -extern void test_NoMatchInSearch(); -extern void test_AddDuplicate(); -extern void test_DeleteEntry(); +void resetTest(void); +extern void test_SingleEntryHandling(void); +extern void test_MultipleEntryHandling(void); +extern void test_NoMatchInSearch(void); +extern void test_AddDuplicate(void); +extern void test_DeleteEntry(void); //=======Test Reset Option===== diff --git a/sntp/tests/run-kodFile.c b/sntp/tests/run-kodFile.c index 9c5896263..7e8490bd2 100644 --- a/sntp/tests/run-kodFile.c +++ b/sntp/tests/run-kodFile.c @@ -26,12 +26,13 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); -extern void test_ReadEmptyFile(); -extern void test_ReadCorrectFile(); -extern void test_ReadFileWithBlankLines(); -extern void test_WriteEmptyFile(); -extern void test_WriteFileWithSingleEntry(); -extern void test_WriteFileWithMultipleEntries(); +void resetTest(void); +extern void test_ReadEmptyFile(void); +extern void test_ReadCorrectFile(void); +extern void test_ReadFileWithBlankLines(void); +extern void test_WriteEmptyFile(void); +extern void test_WriteFileWithSingleEntry(void); +extern void test_WriteFileWithMultipleEntries(void); //=======Test Reset Option===== diff --git a/sntp/tests/run-utilities.c b/sntp/tests/run-utilities.c index 715bd110c..8b6448d40 100644 --- a/sntp/tests/run-utilities.c +++ b/sntp/tests/run-utilities.c @@ -27,13 +27,13 @@ extern void setUp(void); extern void tearDown(void); void resetTest(void); -extern void test_IPv4Address(); -extern void test_IPv6Address(); -extern void test_SetLiVnMode1(); -extern void test_SetLiVnMode2(); -extern void test_PktOutput(); -extern void test_LfpOutputBinaryFormat(); -extern void test_LfpOutputDecimalFormat(); +extern void test_IPv4Address(void); +extern void test_IPv6Address(void); +extern void test_SetLiVnMode1(void); +extern void test_SetLiVnMode2(void); +extern void test_PktOutput(void); +extern void test_LfpOutputBinaryFormat(void); +extern void test_LfpOutputDecimalFormat(void); //=======Test Reset Option===== @@ -52,13 +52,13 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "utilities.c"; UnityBegin("utilities.c"); - RUN_TEST(test_IPv4Address, 68); - RUN_TEST(test_IPv6Address, 78); - RUN_TEST(test_SetLiVnMode1, 98); - RUN_TEST(test_SetLiVnMode2, 111); - RUN_TEST(test_PktOutput, 126); - RUN_TEST(test_LfpOutputBinaryFormat, 146); - RUN_TEST(test_LfpOutputDecimalFormat, 162); + RUN_TEST(test_IPv4Address, 66); + RUN_TEST(test_IPv6Address, 76); + RUN_TEST(test_SetLiVnMode1, 96); + RUN_TEST(test_SetLiVnMode2, 109); + RUN_TEST(test_PktOutput, 124); + RUN_TEST(test_LfpOutputBinaryFormat, 144); + RUN_TEST(test_LfpOutputDecimalFormat, 160); return (UnityEnd()); } diff --git a/sntp/tests/sntptest.h b/sntp/tests/sntptest.h index eff6f6e99..277361c5b 100644 --- a/sntp/tests/sntptest.h +++ b/sntp/tests/sntptest.h @@ -4,12 +4,15 @@ #include "ntp_stdlib.h" #include "sntp-opts.h" +void sntptest(void); +void sntptest_destroy(void); +void ActivateOption(const char* option, const char* argument); -sntptest() { +void sntptest(void) { optionSaveState(&sntpOptions); } -sntptest_destroy() { +void sntptest_destroy(void) { optionRestore(&sntpOptions); } diff --git a/sntp/tests/utilities.c b/sntp/tests/utilities.c index 65be8df9d..294052559 100644 --- a/sntp/tests/utilities.c +++ b/sntp/tests/utilities.c @@ -34,8 +34,6 @@ struct addrinfo CreateAddrinfo( sockaddr_u* sock) { bool outputFileOpened; FILE* outputFile; -//debugUtilitiesTest() : outputFileOpened(false) {} - void InitDebugTest(const char * filename) { // Clear the contents of the current file. // Open the output file @@ -65,7 +63,7 @@ void FinishDebugTest(const char * expected, * tests can be removed. */ -void test_IPv4Address() { +void test_IPv4Address(void) { const char* ADDR = "192.0.2.10"; sockaddr_u input = CreateSockaddr4(ADDR); @@ -75,7 +73,7 @@ void test_IPv4Address() { TEST_ASSERT_EQUAL_STRING(ADDR, addrinfo_to_str(&inputA)); } -void test_IPv6Address() { +void test_IPv6Address(void) { const struct in6_addr address = { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, @@ -95,7 +93,7 @@ void test_IPv6Address() { TEST_ASSERT_EQUAL_STRING(expected, addrinfo_to_str(&inputA)); } -void test_SetLiVnMode1() { +void test_SetLiVnMode1(void) { struct pkt expected; expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION, @@ -108,7 +106,7 @@ void test_SetLiVnMode1() { TEST_ASSERT_EQUAL(expected.li_vn_mode, actual.li_vn_mode); } -void test_SetLiVnMode2() { +void test_SetLiVnMode2(void) { struct pkt expected; expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC, NTP_OLDVERSION, @@ -123,7 +121,7 @@ void test_SetLiVnMode2() { /* Debug utilities tests */ -void test_PktOutput() { +void test_PktOutput(void) { char * filename = "debug-output-pkt";//CreatePath("debug-output-pkt", OUTPUT_DIR); InitDebugTest(filename); @@ -143,7 +141,7 @@ void test_PktOutput() { FinishDebugTest(CreatePath("debug-input-pkt", INPUT_DIR), filename); } -void test_LfpOutputBinaryFormat() { +void test_LfpOutputBinaryFormat(void) { char * filename = "debug-output-lfp-bin";//CreatePath("debug-output-lfp-bin", OUTPUT_DIR); InitDebugTest(filename); @@ -159,7 +157,7 @@ void test_LfpOutputBinaryFormat() { FinishDebugTest(CreatePath("debug-input-lfp-bin", INPUT_DIR), filename); } -void test_LfpOutputDecimalFormat() { +void test_LfpOutputDecimalFormat(void) { char * filename = "debug-output-lfp-dec"; //CreatePath("debug-output-lfp-dec", OUTPUT_DIR); InitDebugTest(filename);