From c3df3a12aa88739e303340ccd7436d467b4662d2 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 16 Mar 2022 11:03:57 +0100 Subject: Fixed msys2 build warnings and re-activated CI Mingw64 build. * Removed Visual Studio leftovers. Maintaining an autotools project with VS integration requires some additional overhead. Signed-off-by: Toni Uhlig Signed-off-by: lns --- tests/unit/unit.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'tests/unit/unit.c') diff --git a/tests/unit/unit.c b/tests/unit/unit.c index 69d44f3c2..bf08d7ed0 100644 --- a/tests/unit/unit.c +++ b/tests/unit/unit.c @@ -29,8 +29,8 @@ #include #include #include -#define getopt getopt____ #else +#include #include #include #include @@ -39,7 +39,6 @@ #include #include -#include #include #include #include @@ -96,8 +95,8 @@ int serializerUnitTest() { for(i=0; i<16; i++) { char kbuf[32], vbuf[32]; - snprintf(kbuf, sizeof(kbuf), "Key %d", i); - snprintf(vbuf, sizeof(vbuf), "Value %d", i); + ndpi_snprintf(kbuf, sizeof(kbuf), "Key %d", i); + ndpi_snprintf(vbuf, sizeof(vbuf), "Value %d", i); assert(ndpi_serialize_uint32_uint32(&serializer, i, i*i) != -1); assert(ndpi_serialize_uint32_string(&serializer, i, "Data") != -1); assert(ndpi_serialize_string_string(&serializer, kbuf, vbuf) != -1); @@ -112,8 +111,8 @@ int serializerUnitTest() { for(i=0; i<4; i++) { char kbuf[32], vbuf[32]; - snprintf(kbuf, sizeof(kbuf), "Ignored"); - snprintf(vbuf, sizeof(vbuf), "Item %d", i); + ndpi_snprintf(kbuf, sizeof(kbuf), "Ignored"); + ndpi_snprintf(vbuf, sizeof(vbuf), "Item %d", i); assert(ndpi_serialize_uint32_uint32(&serializer, i, i*i) != -1); assert(ndpi_serialize_string_string(&serializer, kbuf, vbuf) != -1); assert(ndpi_serialize_string_float(&serializer, kbuf, (float)(i*i), "%f") != -1); @@ -325,7 +324,9 @@ int serializeProtoUnitTest(void) /* *********************************************** */ int main(int argc, char **argv) { +#ifndef WIN32 int c; +#endif if (ndpi_get_api_version() != NDPI_API_VERSION) { printf("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n"); @@ -337,6 +338,11 @@ int main(int argc, char **argv) { if (ndpi_info_mod == NULL) return -1; +/* + * If we want argument parsing on Windows, + * we need to re-implement it as Windows has no such function. + */ +#ifndef WIN32 while((c = getopt(argc, argv, "vh")) != -1) { switch(c) { case 'v': @@ -348,6 +354,9 @@ int main(int argc, char **argv) { return(0); } } +#else + verbose = 0; +#endif /* Tests */ if (serializerUnitTest() != 0) return -1; -- cgit v1.2.3