I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 0848e342 authored by dev's avatar dev
Browse files

Replaced 0 with NULL to fix miscompilation on windows.

parent 5c56de72
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPow ...@@ -102,7 +102,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPow
// disallow negative exponents to avoid divide by zero exception if no inverse exists // disallow negative exponents to avoid divide by zero exception if no inverse exists
convert_j2mp(env, jexp, &mexp); convert_j2mp(env, jexp, &mexp);
if (mpz_sgn(mexp) < 0) { if (mpz_sgn(mexp) < 0) {
mpz_clears(mmod, mexp, 0); mpz_clears(mmod, mexp, NULL);
jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException"); jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException");
(*env)->ThrowNew(env, exc, "Exponent cannot be negative"); (*env)->ThrowNew(env, exc, "Exponent cannot be negative");
return 0; return 0;
...@@ -117,7 +117,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPow ...@@ -117,7 +117,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPow
convert_mp2j(env, mmod, &jresult); convert_mp2j(env, mmod, &jresult);
mpz_clears(mbase, mexp, mmod, 0); mpz_clears(mbase, mexp, mmod, NULL);
return jresult; return jresult;
} }
...@@ -170,7 +170,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPowCT ...@@ -170,7 +170,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPowCT
// disallow negative or zero exponents as specified in the GMP docs // disallow negative or zero exponents as specified in the GMP docs
convert_j2mp(env, jexp, &mexp); convert_j2mp(env, jexp, &mexp);
if (mpz_sgn(mexp) <= 0) { if (mpz_sgn(mexp) <= 0) {
mpz_clears(mmod, mexp, 0); mpz_clears(mmod, mexp, NULL);
jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException"); jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException");
(*env)->ThrowNew(env, exc, "Exponent must be positive"); (*env)->ThrowNew(env, exc, "Exponent must be positive");
return 0; return 0;
...@@ -182,7 +182,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPowCT ...@@ -182,7 +182,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModPowCT
convert_mp2j(env, mmod, &jresult); convert_mp2j(env, mmod, &jresult);
mpz_clears(mbase, mexp, mmod, 0); mpz_clears(mbase, mexp, mmod, NULL);
return jresult; return jresult;
} }
...@@ -236,7 +236,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModInverse ...@@ -236,7 +236,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModInverse
mpz_init(mgcd); mpz_init(mgcd);
mpz_gcd(mgcd, mbase, mmod); mpz_gcd(mgcd, mbase, mmod);
if (mpz_cmp_si(mgcd, 1) != 0) { if (mpz_cmp_si(mgcd, 1) != 0) {
mpz_clears(mbase, mexp, mmod, mgcd, 0); mpz_clears(mbase, mexp, mmod, mgcd, NULL);
jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException"); jclass exc = (*env)->FindClass(env, "java/lang/ArithmeticException");
(*env)->ThrowNew(env, exc, "Not coprime in nativeModInverse()"); (*env)->ThrowNew(env, exc, "Not coprime in nativeModInverse()");
return 0; return 0;
...@@ -249,7 +249,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModInverse ...@@ -249,7 +249,7 @@ JNIEXPORT jbyteArray JNICALL Java_net_i2p_util_NativeBigInteger_nativeModInverse
convert_mp2j(env, mmod, &jresult); convert_mp2j(env, mmod, &jresult);
mpz_clears(mbase, mexp, mmod, mgcd, 0); mpz_clears(mbase, mexp, mmod, mgcd, NULL);
return jresult; return jresult;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment