Skip to content

Commit

Permalink
Reduce number of warnings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Nov 3, 2023
1 parent 5c22ca1 commit 8440283
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions t/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ if(UNIX) # or if (NOT WIN32)
find_package(Threads)
endif()

if(WIN32)
# libtap caused a significant number of conversion warning on Windows
add_definitions("/wd4244 /wd4267")
endif(WIN32)


foreach(TEST_TARGET_NAME ${TEST_TARGET_NAMES})
add_executable(${TEST_TARGET_NAME} ${TEST_TARGET_NAME}.c maxminddb_test_helper.c)
target_include_directories(${TEST_TARGET_NAME} PRIVATE ../src)
Expand Down
3 changes: 1 addition & 2 deletions t/bad_pointers_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ void run_tests(int mode, const char *mode_desc) {
const char *ip = "1.1.1.32";

int gai_error, mmdb_error;
MMDB_lookup_result_s UNUSED(result) =
MMDB_lookup_string(mmdb, ip, &gai_error, &mmdb_error);
MMDB_lookup_string(mmdb, ip, &gai_error, &mmdb_error);

cmp_ok(mmdb_error,
"==",
Expand Down
7 changes: 6 additions & 1 deletion t/maxminddb_test_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ char *dup_entry_string_or_bail(MMDB_entry_data_s entry_data) {
}

MMDB_s *open_ok(const char *db_file, int mode, const char *mode_desc) {
if (0 != access(db_file, R_OK)) {
#ifdef _WIN32
int access_rv = _access(db_file, 04);
#else
int access_rv = access(db_file, R_OK);
#endif
if (access_rv != 0) {
BAIL_OUT("could not read the specified file - %s\nIf you are in a git "
"checkout try running 'git submodule update --init'",
db_file);
Expand Down

0 comments on commit 8440283

Please sign in to comment.