Skip to content

Commit 8c9759a

Browse files
committed
Fix CI-CD feedback (round 4)
Fix some compiler warnings I found while inspecting build logs.
1 parent f2db03d commit 8c9759a

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/main/cpp/_nix_based/jssc.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,16 @@
6060
#include <jssc_SerialNativeInterface.h>
6161
#include "version.h"
6262

63-
//#include <iostream> //-lCstd use for Solaris linker
63+
#if defined(_MSC_VER) && _MSC_VER < 1800
64+
# define PRIsz "Iu"
65+
# define PRIssz "Id"
66+
#elif defined(__MINGW32__) && !defined(__MINGW64__)
67+
# define PRIsz "u"
68+
# define PRIssz "d"
69+
#else
70+
# define PRIsz "zu"
71+
# define PRIssz "zd"
72+
#endif
6473

6574
/*
6675
* Get native library version
@@ -672,7 +681,7 @@ JNIEXPORT jbyteArray JNICALL Java_jssc_SerialNativeInterface_readBytes
672681
lpBuffer = (jbyte*)malloc(byteCount*sizeof*lpBuffer);
673682
if( !lpBuffer ){
674683
char emsg[32]; emsg[0] = '\0';
675-
snprintf(emsg, sizeof emsg, "malloc(%ld) failed", byteCount*sizeof*lpBuffer);
684+
snprintf(emsg, sizeof emsg, "malloc(%" PRIsz ") failed", byteCount*sizeof*lpBuffer);
676685
jclass exClz = env->FindClass("java/lang/RuntimeException");
677686
if( exClz ) env->ThrowNew(exClz, emsg);
678687
returnArray = NULL; goto Finally;

src/main/cpp/windows/jssc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
# define PRIsz "Iu"
3434
# define PRIssz "Id"
3535
#elif defined(__MINGW32__) && !defined(__MINGW64__)
36-
# define PRIsz "lu"
37-
# define PRIssz "ld"
36+
# define PRIsz "u"
37+
# define PRIssz "d"
3838
#else
3939
# define PRIsz "zu"
4040
# define PRIssz "zd"

0 commit comments

Comments
 (0)