Skip to content

Commit

Permalink
Merge pull request #1176 from slyshykO/fix-msvc-build
Browse files Browse the repository at this point in the history
Fixed compilation for MSVC
  • Loading branch information
Nightwalker-87 committed Aug 13, 2021
2 parents 165776a + e5152c4 commit a6d19d7
Show file tree
Hide file tree
Showing 3 changed files with 293 additions and 259 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ if (STLINK_HAVE_UNISTD_H)
add_definitions(-DSTLINK_HAVE_UNISTD_H)
endif ()

CHECK_INCLUDE_FILE(dirent.h STLINK_HAVE_DIRENT_H)
if (STLINK_HAVE_DIRENT_H)
add_definitions(-DSTLINK_HAVE_DIRENT_H)
endif ()

if (MSVC)
# Use string.h rather than strings.h and disable annoying warnings
add_definitions(-DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS /wd4710)
Expand Down
2 changes: 1 addition & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ int stlink_chip_id(stlink_t *sl, uint32_t *chip_id) {

if (ret || !(*chip_id)) {
*chip_id = 0;
ret = ret?:-1;
ret = ret?ret:-1;
ELOG("Could not find chip id!\n");
} else {
*chip_id = (*chip_id) & 0xfff;
Expand Down
Loading

0 comments on commit a6d19d7

Please sign in to comment.