Changeset 126a4d8 for core/c


Ignore:
Timestamp:
Jun 4, 2016 1:23:05 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
280ca2c
Parents:
38b930c
Message:

jbigi: Fix GMP version reporting for shared library (ticket #1800)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/c/jbigi/jbigi/src/jbigi.c

    r38b930c r126a4d8  
    11#include <stdio.h>
     2#include <string.h>
    23#include <gmp.h>
    34#include "jbigi.h"
     
    1617 *    Removed nativeDoubleValue()
    1718 *
    18  * 3: (I2P 0.9.18)
     19 * 3: (I2P 0.9.26)
    1920 *    Added:
    2021 *      nativeJbigiVersion()
     
    2728 *    Throw ArithmeticException for bad arguments in modPow()
    2829 *
    29  */
    30 #define JBIGI_VERSION 3
     30 * 4: (I2P 0.9.27)
     31 *    Fix nativeGMPMajorVersion(), nativeGMPMinorVersion(), and nativeGMPPatchVersion()
     32 *    when built as a shared library
     33 *
     34 */
     35#define JBIGI_VERSION 4
    3136
    3237/*****************************************
     
    4045}
    4146
    42 /* since version 3 */
     47/* since version 3, fixed for dynamic builds in version 4 */
    4348JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPMajorVersion
    4449        (JNIEnv* env, jclass cls) {
    45     return (jint) __GNU_MP_VERSION;
    46 }
    47 
    48 /* since version 3 */
     50    int v = gmp_version[0] - '0';
     51    return (jint) v;
     52}
     53
     54/* since version 3, fixed for dynamic builds in version 4 */
    4955JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPMinorVersion
    5056        (JNIEnv* env, jclass cls) {
    51     return (jint) __GNU_MP_VERSION_MINOR;
    52 }
    53 
    54 /* since version 3 */
     57    int v = 0;
     58    if (strlen(gmp_version) > 2) {
     59        v = gmp_version[2] - '0';
     60    }
     61    return (jint) v;
     62}
     63
     64/* since version 3, fixed for dynamic builds in version 4 */
    5565JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPPatchVersion
    5666        (JNIEnv* env, jclass cls) {
    57     return (jint) __GNU_MP_VERSION_PATCHLEVEL;
     67    int v = 0;
     68    if (strlen(gmp_version) > 4) {
     69        v = gmp_version[4] - '0';
     70    }
     71    return (jint) v;
    5872}
    5973
Note: See TracChangeset for help on using the changeset viewer.