Skip to content

Commit 193361e

Browse files
Merge pull request #99 from cconlon/castingCleanup
Casting cleanup, Java side
2 parents 3c1b994 + b3533c0 commit 193361e

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

native/com_wolfssl_WolfSSLSession.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3637,7 +3637,7 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_gotCloseNotify
36373637
WOLFSSL* ssl = (WOLFSSL*)(uintptr_t)sslPtr;
36383638
(void)jcl;
36393639

3640-
if (jenv == NULL || ssl <= 0) {
3640+
if (jenv == NULL || ssl == NULL) {
36413641
return gotCloseNotify;
36423642
}
36433643

src/java/com/wolfssl/WolfSSLCertificate.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public WolfSSLCertificate(byte[] der) throws WolfSSLException {
9393
}
9494

9595
x509Ptr = X509_load_certificate_buffer(der, WolfSSL.SSL_FILETYPE_ASN1);
96-
if (x509Ptr <= 0) {
96+
if (x509Ptr == 0) {
9797
throw new WolfSSLException("Failed to create WolfSSLCertificate");
9898
}
9999

@@ -126,7 +126,7 @@ public WolfSSLCertificate(byte[] in, int format) throws WolfSSLException {
126126
}
127127

128128
x509Ptr = X509_load_certificate_buffer(in, format);
129-
if (x509Ptr <= 0) {
129+
if (x509Ptr == 0) {
130130
throw new WolfSSLException("Failed to create WolfSSLCertificate");
131131
}
132132

@@ -149,7 +149,7 @@ public WolfSSLCertificate(String fileName) throws WolfSSLException {
149149

150150
x509Ptr = X509_load_certificate_file(fileName,
151151
WolfSSL.SSL_FILETYPE_ASN1);
152-
if (x509Ptr <= 0) {
152+
if (x509Ptr == 0) {
153153
throw new WolfSSLException("Failed to create WolfSSLCertificate");
154154
}
155155

@@ -183,7 +183,7 @@ public WolfSSLCertificate(String fileName, int format)
183183
}
184184

185185
x509Ptr = X509_load_certificate_file(fileName, format);
186-
if (x509Ptr <= 0) {
186+
if (x509Ptr == 0) {
187187
throw new WolfSSLException("Failed to create WolfSSLCertificate");
188188
}
189189

@@ -199,8 +199,8 @@ public WolfSSLCertificate(String fileName, int format)
199199
*/
200200
public WolfSSLCertificate(long x509) throws WolfSSLException {
201201

202-
if (x509 <= 0) {
203-
throw new WolfSSLException("Input pointer may not be <= 0");
202+
if (x509 == 0) {
203+
throw new WolfSSLException("Input pointer may not be 0/NULL");
204204
}
205205
x509Ptr = x509;
206206
this.active = true;

0 commit comments

Comments
 (0)