commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject commons-crypto git commit: Windows uses LoadLibrary/GetLastError
Date Sat, 09 Jul 2016 18:43:54 GMT
Repository: commons-crypto
Updated Branches:
  refs/heads/master e8fd891f3 -> f880ccff6


Windows uses LoadLibrary/GetLastError

Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/f880ccff
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/f880ccff
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/f880ccff

Branch: refs/heads/master
Commit: f880ccff6753c49b77746f9d4a37217ecf2779e1
Parents: e8fd891
Author: Sebb <sebb@apache.org>
Authored: Sat Jul 9 19:43:51 2016 +0100
Committer: Sebb <sebb@apache.org>
Committed: Sat Jul 9 19:43:51 2016 +0100

----------------------------------------------------------------------
 .../native/org/apache/commons/crypto/cipher/OpenSslNative.c    | 6 ++++++
 .../apache/commons/crypto/random/OpenSslCryptoRandomNative.c   | 6 ++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f880ccff/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c b/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c
index bae10cd..5e39e13 100644
--- a/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c
+++ b/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c
@@ -129,8 +129,14 @@ JNIEXPORT void JNICALL Java_org_apache_commons_crypto_cipher_OpenSslNative_initI
 #endif
 
   if (!openssl) {
+#ifdef UNIX
     snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
         dlerror());
+#endif
+#ifdef WINDOWS
+    snprintf(msg, sizeof(msg), "Cannot load %s (%d)!", COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
+    		GetLastError());
+#endif
     THROW(env, "java/lang/UnsatisfiedLinkError", msg);
     return;
   }

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/f880ccff/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
b/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
index 20b9d7a..8f0e9b0 100644
--- a/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
+++ b/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
@@ -104,8 +104,14 @@ JNIEXPORT void JNICALL Java_org_apache_commons_crypto_random_OpenSslCryptoRandom
 #endif
 
   if (!openssl) {
+#ifdef UNIX
     snprintf(msg, sizeof(msg), "Cannot load %s (%s)!", COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
         dlerror());
+#endif
+#ifdef WINDOWS
+    snprintf(msg, sizeof(msg), "Cannot load %s (%d)!", COMMONS_CRYPTO_OPENSSL_LIBRARY,  \
+    		GetLastError());
+#endif
     THROW(env, "java/lang/UnsatisfiedLinkError", msg);
     return;
   }


Mime
View raw message