Guest User

Untitled

a guest
Dec 9th, 2011
1,581
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ----------------------------------------------------------------------------
  2.  * This file was automatically generated by SWIG (http://www.swig.org).
  3.  * Version 1.3.40
  4.  *
  5.  * This file is not intended to be easily readable and contains a number of
  6.  * coding conventions designed to improve portability and efficiency. Do not make
  7.  * changes to this file unless you know what you are doing--modify the SWIG
  8.  * interface file instead.
  9.  * ----------------------------------------------------------------------------- */
  10.  
  11. #define SWIGJAVA
  12.  
  13. /* -----------------------------------------------------------------------------
  14.  *  This section contains generic SWIG labels for method/variable
  15.  *  declarations/attributes, and other compiler dependent labels.
  16.  * ----------------------------------------------------------------------------- */
  17.  
  18. /* template workaround for compilers that cannot correctly implement the C++ standard */
  19. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  20. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  21. #  define SWIGTEMPLATEDISAMBIGUATOR template
  22. # elif defined(__HP_aCC)
  23. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  24. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  25. #  define SWIGTEMPLATEDISAMBIGUATOR template
  26. # else
  27. #  define SWIGTEMPLATEDISAMBIGUATOR
  28. # endif
  29. #endif
  30.  
  31. /* inline attribute */
  32. #ifndef SWIGINLINE
  33. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  34. #   define SWIGINLINE inline
  35. # else
  36. #   define SWIGINLINE
  37. # endif
  38. #endif
  39.  
  40. /* attribute recognised by some compilers to avoid 'unused' warnings */
  41. #ifndef SWIGUNUSED
  42. # if defined(__GNUC__)
  43. #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  44. #     define SWIGUNUSED __attribute__ ((__unused__))
  45. #   else
  46. #     define SWIGUNUSED
  47. #   endif
  48. # elif defined(__ICC)
  49. #   define SWIGUNUSED __attribute__ ((__unused__))
  50. # else
  51. #   define SWIGUNUSED
  52. # endif
  53. #endif
  54.  
  55. #ifndef SWIG_MSC_UNSUPPRESS_4505
  56. # if defined(_MSC_VER)
  57. #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
  58. # endif
  59. #endif
  60.  
  61. #ifndef SWIGUNUSEDPARM
  62. # ifdef __cplusplus
  63. #   define SWIGUNUSEDPARM(p)
  64. # else
  65. #   define SWIGUNUSEDPARM(p) p SWIGUNUSED
  66. # endif
  67. #endif
  68.  
  69. /* internal SWIG method */
  70. #ifndef SWIGINTERN
  71. # define SWIGINTERN static SWIGUNUSED
  72. #endif
  73.  
  74. /* internal inline SWIG method */
  75. #ifndef SWIGINTERNINLINE
  76. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  77. #endif
  78.  
  79. /* exporting methods */
  80. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  81. #  ifndef GCC_HASCLASSVISIBILITY
  82. #    define GCC_HASCLASSVISIBILITY
  83. #  endif
  84. #endif
  85.  
  86. #ifndef SWIGEXPORT
  87. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  88. #   if defined(STATIC_LINKED)
  89. #     define SWIGEXPORT
  90. #   else
  91. #     define SWIGEXPORT __declspec(dllexport)
  92. #   endif
  93. # else
  94. #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  95. #     define SWIGEXPORT __attribute__ ((visibility("default")))
  96. #   else
  97. #     define SWIGEXPORT
  98. #   endif
  99. # endif
  100. #endif
  101.  
  102. /* calling conventions for Windows */
  103. #ifndef SWIGSTDCALL
  104. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  105. #   define SWIGSTDCALL __stdcall
  106. # else
  107. #   define SWIGSTDCALL
  108. # endif
  109. #endif
  110.  
  111. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  112. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  113. # define _CRT_SECURE_NO_DEPRECATE
  114. #endif
  115.  
  116. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  117. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  118. # define _SCL_SECURE_NO_DEPRECATE
  119. #endif
  120.  
  121.  
  122.  
  123. /* Fix for jlong on some versions of gcc on Windows */
  124. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  125.   typedef long long __int64;
  126. #endif
  127.  
  128. /* Fix for jlong on 64-bit x86 Solaris */
  129. #if defined(__x86_64)
  130. # ifdef _LP64
  131. #   undef _LP64
  132. # endif
  133. #endif
  134.  
  135. #include <jni.h>
  136. #include <stdlib.h>
  137. #include <string.h>
  138.  
  139.  
  140. /* Support for throwing Java exceptions */
  141. typedef enum {
  142.   SWIG_JavaOutOfMemoryError = 1,
  143.   SWIG_JavaIOException,
  144.   SWIG_JavaRuntimeException,
  145.   SWIG_JavaIndexOutOfBoundsException,
  146.   SWIG_JavaArithmeticException,
  147.   SWIG_JavaIllegalArgumentException,
  148.   SWIG_JavaNullPointerException,
  149.   SWIG_JavaDirectorPureVirtual,
  150.   SWIG_JavaUnknownError
  151. } SWIG_JavaExceptionCodes;
  152.  
  153. typedef struct {
  154.   SWIG_JavaExceptionCodes code;
  155.   const char *java_exception;
  156. } SWIG_JavaExceptions_t;
  157.  
  158.  
  159. static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
  160.   jclass excep;
  161.   static const SWIG_JavaExceptions_t java_exceptions[] = {
  162.     { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
  163.     { SWIG_JavaIOException, "java/io/IOException" },
  164.     { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
  165.     { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
  166.     { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
  167.     { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
  168.     { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
  169.     { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
  170.     { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
  171.     { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
  172.   };
  173.   const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
  174.  
  175.   while (except_ptr->code != code && except_ptr->code)
  176.     except_ptr++;
  177.  
  178.   (*jenv)->ExceptionClear(jenv);
  179.   excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
  180.   if (excep)
  181.     (*jenv)->ThrowNew(jenv, excep, msg);
  182. }
  183.  
  184.  
  185. /* Contract support */
  186.  
  187. #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
  188.  
  189. /*  Errors in SWIG */
  190. #define  SWIG_UnknownError         -1
  191. #define  SWIG_IOError              -2
  192. #define  SWIG_RuntimeError         -3
  193. #define  SWIG_IndexError           -4
  194. #define  SWIG_TypeError            -5
  195. #define  SWIG_DivisionByZero       -6
  196. #define  SWIG_OverflowError        -7
  197. #define  SWIG_SyntaxError          -8
  198. #define  SWIG_ValueError           -9
  199. #define  SWIG_SystemError          -10
  200. #define  SWIG_AttributeError       -11
  201. #define  SWIG_MemoryError          -12
  202. #define  SWIG_NullReferenceError   -13
  203.  
  204.  
  205.  
  206.  
  207. SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
  208.   SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
  209.   switch(code) {
  210.   case SWIG_MemoryError:
  211.     exception_code = SWIG_JavaOutOfMemoryError;
  212.     break;
  213.   case SWIG_IOError:
  214.     exception_code = SWIG_JavaIOException;
  215.     break;
  216.   case SWIG_SystemError:
  217.   case SWIG_RuntimeError:
  218.     exception_code = SWIG_JavaRuntimeException;
  219.     break;
  220.   case SWIG_OverflowError:
  221.   case SWIG_IndexError:
  222.     exception_code = SWIG_JavaIndexOutOfBoundsException;
  223.     break;
  224.   case SWIG_DivisionByZero:
  225.     exception_code = SWIG_JavaArithmeticException;
  226.     break;
  227.   case SWIG_SyntaxError:
  228.   case SWIG_ValueError:
  229.   case SWIG_TypeError:
  230.     exception_code = SWIG_JavaIllegalArgumentException;
  231.     break;
  232.   case SWIG_UnknownError:
  233.   default:
  234.     exception_code = SWIG_JavaUnknownError;
  235.     break;
  236.   }
  237.   SWIG_JavaThrowException(jenv, exception_code, msg);
  238. }
  239.  
  240.  
  241. #if defined(SWIG_NOINCLUDE) || defined(SWIG_NOARRAYS)
  242.  
  243.  
  244. int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input);
  245. void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input);
  246. jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz);
  247.  
  248.  
  249. int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input);
  250. void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input);
  251. jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz);
  252.  
  253.  
  254. int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input);
  255. void SWIG_JavaArrayArgoutShort (JNIEnv *jenv, jshort *jarr, short *carr, jshortArray input);
  256. jshortArray SWIG_JavaArrayOutShort (JNIEnv *jenv, short *result, jsize sz);
  257.  
  258.  
  259. int SWIG_JavaArrayInUshort (JNIEnv *jenv, jint **jarr, unsigned short **carr, jintArray input);
  260. void SWIG_JavaArrayArgoutUshort (JNIEnv *jenv, jint *jarr, unsigned short *carr, jintArray input);
  261. jintArray SWIG_JavaArrayOutUshort (JNIEnv *jenv, unsigned short *result, jsize sz);
  262.  
  263.  
  264. int SWIG_JavaArrayInInt (JNIEnv *jenv, jint **jarr, int **carr, jintArray input);
  265. void SWIG_JavaArrayArgoutInt (JNIEnv *jenv, jint *jarr, int *carr, jintArray input);
  266. jintArray SWIG_JavaArrayOutInt (JNIEnv *jenv, int *result, jsize sz);
  267.  
  268.  
  269. int SWIG_JavaArrayInUint (JNIEnv *jenv, jlong **jarr, unsigned int **carr, jlongArray input);
  270. void SWIG_JavaArrayArgoutUint (JNIEnv *jenv, jlong *jarr, unsigned int *carr, jlongArray input);
  271. jlongArray SWIG_JavaArrayOutUint (JNIEnv *jenv, unsigned int *result, jsize sz);
  272.  
  273.  
  274. int SWIG_JavaArrayInLong (JNIEnv *jenv, jint **jarr, long **carr, jintArray input);
  275. void SWIG_JavaArrayArgoutLong (JNIEnv *jenv, jint *jarr, long *carr, jintArray input);
  276. jintArray SWIG_JavaArrayOutLong (JNIEnv *jenv, long *result, jsize sz);
  277.  
  278.  
  279. int SWIG_JavaArrayInUlong (JNIEnv *jenv, jlong **jarr, unsigned long **carr, jlongArray input);
  280. void SWIG_JavaArrayArgoutUlong (JNIEnv *jenv, jlong *jarr, unsigned long *carr, jlongArray input);
  281. jlongArray SWIG_JavaArrayOutUlong (JNIEnv *jenv, unsigned long *result, jsize sz);
  282.  
  283.  
  284. int SWIG_JavaArrayInLonglong (JNIEnv *jenv, jlong **jarr, jlong **carr, jlongArray input);
  285. void SWIG_JavaArrayArgoutLonglong (JNIEnv *jenv, jlong *jarr, jlong *carr, jlongArray input);
  286. jlongArray SWIG_JavaArrayOutLonglong (JNIEnv *jenv, jlong *result, jsize sz);
  287.  
  288.  
  289. int SWIG_JavaArrayInFloat (JNIEnv *jenv, jfloat **jarr, float **carr, jfloatArray input);
  290. void SWIG_JavaArrayArgoutFloat (JNIEnv *jenv, jfloat *jarr, float *carr, jfloatArray input);
  291. jfloatArray SWIG_JavaArrayOutFloat (JNIEnv *jenv, float *result, jsize sz);
  292.  
  293.  
  294. int SWIG_JavaArrayInDouble (JNIEnv *jenv, jdouble **jarr, double **carr, jdoubleArray input);
  295. void SWIG_JavaArrayArgoutDouble (JNIEnv *jenv, jdouble *jarr, double *carr, jdoubleArray input);
  296. jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz);
  297.  
  298.  
  299. #else
  300.  
  301.  
  302. /* signed char[] support */
  303. int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input) {
  304.   int i;
  305.   jsize sz;
  306.   if (!input) {
  307.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  308.     return 0;
  309.   }
  310.   sz = (*jenv)->GetArrayLength(jenv, input);
  311.   *jarr = (*jenv)->GetByteArrayElements(jenv, input, 0);
  312.   if (!*jarr)
  313.     return 0;
  314.   *carr = (signed char*) calloc(sz, sizeof(signed char));
  315.   if (!*carr) {
  316.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  317.     return 0;
  318.   }
  319.   for (i=0; i<sz; i++)
  320.     (*carr)[i] = (signed char)(*jarr)[i];
  321.   return 1;
  322. }
  323.  
  324. void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input) {
  325.   int i;
  326.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  327.   for (i=0; i<sz; i++)
  328.     jarr[i] = (jbyte)carr[i];
  329.   (*jenv)->ReleaseByteArrayElements(jenv, input, jarr, 0);
  330. }
  331.  
  332. jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz) {
  333.   jbyte *arr;
  334.   int i;
  335.   jbyteArray jresult = (*jenv)->NewByteArray(jenv, sz);
  336.   if (!jresult)
  337.     return NULL;
  338.   arr = (*jenv)->GetByteArrayElements(jenv, jresult, 0);
  339.   if (!arr)
  340.     return NULL;
  341.   for (i=0; i<sz; i++)
  342.     arr[i] = (jbyte)result[i];
  343.   (*jenv)->ReleaseByteArrayElements(jenv, jresult, arr, 0);
  344.   return jresult;
  345. }
  346.  
  347.  
  348. /* unsigned char[] support */
  349. int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input) {
  350.   int i;
  351.   jsize sz;
  352.   if (!input) {
  353.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  354.     return 0;
  355.   }
  356.   sz = (*jenv)->GetArrayLength(jenv, input);
  357.   *jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
  358.   if (!*jarr)
  359.     return 0;
  360.   *carr = (unsigned char*) calloc(sz, sizeof(unsigned char));
  361.   if (!*carr) {
  362.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  363.     return 0;
  364.   }
  365.   for (i=0; i<sz; i++)
  366.     (*carr)[i] = (unsigned char)(*jarr)[i];
  367.   return 1;
  368. }
  369.  
  370. void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input) {
  371.   int i;
  372.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  373.   for (i=0; i<sz; i++)
  374.     jarr[i] = (jshort)carr[i];
  375.   (*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
  376. }
  377.  
  378. jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz) {
  379.   jshort *arr;
  380.   int i;
  381.   jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
  382.   if (!jresult)
  383.     return NULL;
  384.   arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
  385.   if (!arr)
  386.     return NULL;
  387.   for (i=0; i<sz; i++)
  388.     arr[i] = (jshort)result[i];
  389.   (*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
  390.   return jresult;
  391. }
  392.  
  393.  
  394. /* short[] support */
  395. int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input) {
  396.   int i;
  397.   jsize sz;
  398.   if (!input) {
  399.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  400.     return 0;
  401.   }
  402.   sz = (*jenv)->GetArrayLength(jenv, input);
  403.   *jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
  404.   if (!*jarr)
  405.     return 0;
  406.   *carr = (short*) calloc(sz, sizeof(short));
  407.   if (!*carr) {
  408.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  409.     return 0;
  410.   }
  411.   for (i=0; i<sz; i++)
  412.     (*carr)[i] = (short)(*jarr)[i];
  413.   return 1;
  414. }
  415.  
  416. void SWIG_JavaArrayArgoutShort (JNIEnv *jenv, jshort *jarr, short *carr, jshortArray input) {
  417.   int i;
  418.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  419.   for (i=0; i<sz; i++)
  420.     jarr[i] = (jshort)carr[i];
  421.   (*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
  422. }
  423.  
  424. jshortArray SWIG_JavaArrayOutShort (JNIEnv *jenv, short *result, jsize sz) {
  425.   jshort *arr;
  426.   int i;
  427.   jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
  428.   if (!jresult)
  429.     return NULL;
  430.   arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
  431.   if (!arr)
  432.     return NULL;
  433.   for (i=0; i<sz; i++)
  434.     arr[i] = (jshort)result[i];
  435.   (*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
  436.   return jresult;
  437. }
  438.  
  439.  
  440. /* unsigned short[] support */
  441. int SWIG_JavaArrayInUshort (JNIEnv *jenv, jint **jarr, unsigned short **carr, jintArray input) {
  442.   int i;
  443.   jsize sz;
  444.   if (!input) {
  445.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  446.     return 0;
  447.   }
  448.   sz = (*jenv)->GetArrayLength(jenv, input);
  449.   *jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
  450.   if (!*jarr)
  451.     return 0;
  452.   *carr = (unsigned short*) calloc(sz, sizeof(unsigned short));
  453.   if (!*carr) {
  454.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  455.     return 0;
  456.   }
  457.   for (i=0; i<sz; i++)
  458.     (*carr)[i] = (unsigned short)(*jarr)[i];
  459.   return 1;
  460. }
  461.  
  462. void SWIG_JavaArrayArgoutUshort (JNIEnv *jenv, jint *jarr, unsigned short *carr, jintArray input) {
  463.   int i;
  464.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  465.   for (i=0; i<sz; i++)
  466.     jarr[i] = (jint)carr[i];
  467.   (*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
  468. }
  469.  
  470. jintArray SWIG_JavaArrayOutUshort (JNIEnv *jenv, unsigned short *result, jsize sz) {
  471.   jint *arr;
  472.   int i;
  473.   jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
  474.   if (!jresult)
  475.     return NULL;
  476.   arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
  477.   if (!arr)
  478.     return NULL;
  479.   for (i=0; i<sz; i++)
  480.     arr[i] = (jint)result[i];
  481.   (*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
  482.   return jresult;
  483. }
  484.  
  485.  
  486. /* int[] support */
  487. int SWIG_JavaArrayInInt (JNIEnv *jenv, jint **jarr, int **carr, jintArray input) {
  488.   int i;
  489.   jsize sz;
  490.   if (!input) {
  491.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  492.     return 0;
  493.   }
  494.   sz = (*jenv)->GetArrayLength(jenv, input);
  495.   *jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
  496.   if (!*jarr)
  497.     return 0;
  498.   *carr = (int*) calloc(sz, sizeof(int));
  499.   if (!*carr) {
  500.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  501.     return 0;
  502.   }
  503.   for (i=0; i<sz; i++)
  504.     (*carr)[i] = (int)(*jarr)[i];
  505.   return 1;
  506. }
  507.  
  508. void SWIG_JavaArrayArgoutInt (JNIEnv *jenv, jint *jarr, int *carr, jintArray input) {
  509.   int i;
  510.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  511.   for (i=0; i<sz; i++)
  512.     jarr[i] = (jint)carr[i];
  513.   (*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
  514. }
  515.  
  516. jintArray SWIG_JavaArrayOutInt (JNIEnv *jenv, int *result, jsize sz) {
  517.   jint *arr;
  518.   int i;
  519.   jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
  520.   if (!jresult)
  521.     return NULL;
  522.   arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
  523.   if (!arr)
  524.     return NULL;
  525.   for (i=0; i<sz; i++)
  526.     arr[i] = (jint)result[i];
  527.   (*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
  528.   return jresult;
  529. }
  530.  
  531.  
  532. /* unsigned int[] support */
  533. int SWIG_JavaArrayInUint (JNIEnv *jenv, jlong **jarr, unsigned int **carr, jlongArray input) {
  534.   int i;
  535.   jsize sz;
  536.   if (!input) {
  537.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  538.     return 0;
  539.   }
  540.   sz = (*jenv)->GetArrayLength(jenv, input);
  541.   *jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
  542.   if (!*jarr)
  543.     return 0;
  544.   *carr = (unsigned int*) calloc(sz, sizeof(unsigned int));
  545.   if (!*carr) {
  546.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  547.     return 0;
  548.   }
  549.   for (i=0; i<sz; i++)
  550.     (*carr)[i] = (unsigned int)(*jarr)[i];
  551.   return 1;
  552. }
  553.  
  554. void SWIG_JavaArrayArgoutUint (JNIEnv *jenv, jlong *jarr, unsigned int *carr, jlongArray input) {
  555.   int i;
  556.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  557.   for (i=0; i<sz; i++)
  558.     jarr[i] = (jlong)carr[i];
  559.   (*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
  560. }
  561.  
  562. jlongArray SWIG_JavaArrayOutUint (JNIEnv *jenv, unsigned int *result, jsize sz) {
  563.   jlong *arr;
  564.   int i;
  565.   jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
  566.   if (!jresult)
  567.     return NULL;
  568.   arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
  569.   if (!arr)
  570.     return NULL;
  571.   for (i=0; i<sz; i++)
  572.     arr[i] = (jlong)result[i];
  573.   (*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
  574.   return jresult;
  575. }
  576.  
  577.  
  578. /* long[] support */
  579. int SWIG_JavaArrayInLong (JNIEnv *jenv, jint **jarr, long **carr, jintArray input) {
  580.   int i;
  581.   jsize sz;
  582.   if (!input) {
  583.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  584.     return 0;
  585.   }
  586.   sz = (*jenv)->GetArrayLength(jenv, input);
  587.   *jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
  588.   if (!*jarr)
  589.     return 0;
  590.   *carr = (long*) calloc(sz, sizeof(long));
  591.   if (!*carr) {
  592.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  593.     return 0;
  594.   }
  595.   for (i=0; i<sz; i++)
  596.     (*carr)[i] = (long)(*jarr)[i];
  597.   return 1;
  598. }
  599.  
  600. void SWIG_JavaArrayArgoutLong (JNIEnv *jenv, jint *jarr, long *carr, jintArray input) {
  601.   int i;
  602.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  603.   for (i=0; i<sz; i++)
  604.     jarr[i] = (jint)carr[i];
  605.   (*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
  606. }
  607.  
  608. jintArray SWIG_JavaArrayOutLong (JNIEnv *jenv, long *result, jsize sz) {
  609.   jint *arr;
  610.   int i;
  611.   jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
  612.   if (!jresult)
  613.     return NULL;
  614.   arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
  615.   if (!arr)
  616.     return NULL;
  617.   for (i=0; i<sz; i++)
  618.     arr[i] = (jint)result[i];
  619.   (*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
  620.   return jresult;
  621. }
  622.  
  623.  
  624. /* unsigned long[] support */
  625. int SWIG_JavaArrayInUlong (JNIEnv *jenv, jlong **jarr, unsigned long **carr, jlongArray input) {
  626.   int i;
  627.   jsize sz;
  628.   if (!input) {
  629.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  630.     return 0;
  631.   }
  632.   sz = (*jenv)->GetArrayLength(jenv, input);
  633.   *jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
  634.   if (!*jarr)
  635.     return 0;
  636.   *carr = (unsigned long*) calloc(sz, sizeof(unsigned long));
  637.   if (!*carr) {
  638.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  639.     return 0;
  640.   }
  641.   for (i=0; i<sz; i++)
  642.     (*carr)[i] = (unsigned long)(*jarr)[i];
  643.   return 1;
  644. }
  645.  
  646. void SWIG_JavaArrayArgoutUlong (JNIEnv *jenv, jlong *jarr, unsigned long *carr, jlongArray input) {
  647.   int i;
  648.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  649.   for (i=0; i<sz; i++)
  650.     jarr[i] = (jlong)carr[i];
  651.   (*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
  652. }
  653.  
  654. jlongArray SWIG_JavaArrayOutUlong (JNIEnv *jenv, unsigned long *result, jsize sz) {
  655.   jlong *arr;
  656.   int i;
  657.   jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
  658.   if (!jresult)
  659.     return NULL;
  660.   arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
  661.   if (!arr)
  662.     return NULL;
  663.   for (i=0; i<sz; i++)
  664.     arr[i] = (jlong)result[i];
  665.   (*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
  666.   return jresult;
  667. }
  668.  
  669.  
  670. /* jlong[] support */
  671. int SWIG_JavaArrayInLonglong (JNIEnv *jenv, jlong **jarr, jlong **carr, jlongArray input) {
  672.   int i;
  673.   jsize sz;
  674.   if (!input) {
  675.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  676.     return 0;
  677.   }
  678.   sz = (*jenv)->GetArrayLength(jenv, input);
  679.   *jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
  680.   if (!*jarr)
  681.     return 0;
  682.   *carr = (jlong*) calloc(sz, sizeof(jlong));
  683.   if (!*carr) {
  684.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  685.     return 0;
  686.   }
  687.   for (i=0; i<sz; i++)
  688.     (*carr)[i] = (jlong)(*jarr)[i];
  689.   return 1;
  690. }
  691.  
  692. void SWIG_JavaArrayArgoutLonglong (JNIEnv *jenv, jlong *jarr, jlong *carr, jlongArray input) {
  693.   int i;
  694.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  695.   for (i=0; i<sz; i++)
  696.     jarr[i] = (jlong)carr[i];
  697.   (*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
  698. }
  699.  
  700. jlongArray SWIG_JavaArrayOutLonglong (JNIEnv *jenv, jlong *result, jsize sz) {
  701.   jlong *arr;
  702.   int i;
  703.   jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
  704.   if (!jresult)
  705.     return NULL;
  706.   arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
  707.   if (!arr)
  708.     return NULL;
  709.   for (i=0; i<sz; i++)
  710.     arr[i] = (jlong)result[i];
  711.   (*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
  712.   return jresult;
  713. }
  714.  
  715.  
  716. /* float[] support */
  717. int SWIG_JavaArrayInFloat (JNIEnv *jenv, jfloat **jarr, float **carr, jfloatArray input) {
  718.   int i;
  719.   jsize sz;
  720.   if (!input) {
  721.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  722.     return 0;
  723.   }
  724.   sz = (*jenv)->GetArrayLength(jenv, input);
  725.   *jarr = (*jenv)->GetFloatArrayElements(jenv, input, 0);
  726.   if (!*jarr)
  727.     return 0;
  728.   *carr = (float*) calloc(sz, sizeof(float));
  729.   if (!*carr) {
  730.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  731.     return 0;
  732.   }
  733.   for (i=0; i<sz; i++)
  734.     (*carr)[i] = (float)(*jarr)[i];
  735.   return 1;
  736. }
  737.  
  738. void SWIG_JavaArrayArgoutFloat (JNIEnv *jenv, jfloat *jarr, float *carr, jfloatArray input) {
  739.   int i;
  740.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  741.   for (i=0; i<sz; i++)
  742.     jarr[i] = (jfloat)carr[i];
  743.   (*jenv)->ReleaseFloatArrayElements(jenv, input, jarr, 0);
  744. }
  745.  
  746. jfloatArray SWIG_JavaArrayOutFloat (JNIEnv *jenv, float *result, jsize sz) {
  747.   jfloat *arr;
  748.   int i;
  749.   jfloatArray jresult = (*jenv)->NewFloatArray(jenv, sz);
  750.   if (!jresult)
  751.     return NULL;
  752.   arr = (*jenv)->GetFloatArrayElements(jenv, jresult, 0);
  753.   if (!arr)
  754.     return NULL;
  755.   for (i=0; i<sz; i++)
  756.     arr[i] = (jfloat)result[i];
  757.   (*jenv)->ReleaseFloatArrayElements(jenv, jresult, arr, 0);
  758.   return jresult;
  759. }
  760.  
  761.  
  762. /* double[] support */
  763. int SWIG_JavaArrayInDouble (JNIEnv *jenv, jdouble **jarr, double **carr, jdoubleArray input) {
  764.   int i;
  765.   jsize sz;
  766.   if (!input) {
  767.     SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
  768.     return 0;
  769.   }
  770.   sz = (*jenv)->GetArrayLength(jenv, input);
  771.   *jarr = (*jenv)->GetDoubleArrayElements(jenv, input, 0);
  772.   if (!*jarr)
  773.     return 0;
  774.   *carr = (double*) calloc(sz, sizeof(double));
  775.   if (!*carr) {
  776.     SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
  777.     return 0;
  778.   }
  779.   for (i=0; i<sz; i++)
  780.     (*carr)[i] = (double)(*jarr)[i];
  781.   return 1;
  782. }
  783.  
  784. void SWIG_JavaArrayArgoutDouble (JNIEnv *jenv, jdouble *jarr, double *carr, jdoubleArray input) {
  785.   int i;
  786.   jsize sz = (*jenv)->GetArrayLength(jenv, input);
  787.   for (i=0; i<sz; i++)
  788.     jarr[i] = (jdouble)carr[i];
  789.   (*jenv)->ReleaseDoubleArrayElements(jenv, input, jarr, 0);
  790. }
  791.  
  792. jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz) {
  793.   jdouble *arr;
  794.   int i;
  795.   jdoubleArray jresult = (*jenv)->NewDoubleArray(jenv, sz);
  796.   if (!jresult)
  797.     return NULL;
  798.   arr = (*jenv)->GetDoubleArrayElements(jenv, jresult, 0);
  799.   if (!arr)
  800.     return NULL;
  801.   for (i=0; i<sz; i++)
  802.     arr[i] = (jdouble)result[i];
  803.   (*jenv)->ReleaseDoubleArrayElements(jenv, jresult, arr, 0);
  804.   return jresult;
  805. }
  806.  
  807.  
  808. #endif
  809.  
  810.  
  811. #include "webp/decode.h"
  812.  
  813. #define FillMeInAsSizeCannotBeDeterminedAutomatically \
  814.     (result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
  815.  
  816. static jint returned_buffer_size(
  817.     const char *function, int *width, int *height) {
  818.   static const struct sizemap {
  819.     const char *function;
  820.     int size_multiplier;
  821.   } size_map[] = {
  822.     { "Java_com_google_webp_libwebpJNI_WebPDecodeRGB",  3 },
  823.     { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 },
  824.     { "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 },
  825.     { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR",  3 },
  826.     { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 },
  827.     { NULL, 0 }
  828.   };
  829.   const struct sizemap *p;
  830.   jint size = -1;
  831.  
  832.   for (p = size_map; p->function; p++) {
  833.     if (!strcmp(function, p->function)) {
  834.       size = *width * *height * p->size_multiplier;
  835.       break;
  836.     }
  837.   }
  838.  
  839.   return size;
  840. }
  841.  
  842. /* Work around broken gcj jni.h */
  843. #ifdef __GCJ_JNI_H__
  844. # undef JNIEXPORT
  845. # define JNIEXPORT
  846. # undef JNICALL
  847. # define JNICALL
  848. #endif
  849.  
  850.  
  851. #ifdef __cplusplus
  852. extern "C" {
  853. #endif
  854.  
  855. SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetDecoderVersion(JNIEnv *jenv, jclass jcls) {
  856.   jint jresult = 0 ;
  857.   int result;
  858.  
  859.   (void)jenv;
  860.   (void)jcls;
  861.   result = (int)WebPGetDecoderVersion();
  862.   jresult = (jint)result;
  863.   return jresult;
  864. }
  865.  
  866.  
  867. SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  868.   jint jresult = 0 ;
  869.   uint8_t *arg1 = (uint8_t *) 0 ;
  870.   uint32_t arg2 ;
  871.   int *arg3 = (int *) 0 ;
  872.   int *arg4 = (int *) 0 ;
  873.   jbyte *jarr1 ;
  874.   int temp3 ;
  875.   int temp4 ;
  876.   int result;
  877.  
  878.   (void)jenv;
  879.   (void)jcls;
  880.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  881.   arg2 = (uint32_t)jarg2;
  882.   {
  883.     if (!jarg3) {
  884.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  885.       return 0;
  886.     }
  887.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  888.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  889.       return 0;
  890.     }
  891.     arg3 = &temp3;
  892.   }
  893.   {
  894.     if (!jarg4) {
  895.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  896.       return 0;
  897.     }
  898.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  899.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  900.       return 0;
  901.     }
  902.     arg4 = &temp4;
  903.   }
  904.   {
  905.     if (arg2 < 0) {
  906.       {
  907.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  908.       };
  909.     }
  910.   }
  911.   result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
  912.   jresult = (jint)result;
  913.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  914.   {
  915.     jint jvalue = (jint)temp3;
  916.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  917.   }
  918.   {
  919.     jint jvalue = (jint)temp4;
  920.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  921.   }
  922.   free(arg1);
  923.  
  924.  
  925.   return jresult;
  926. }
  927.  
  928.  
  929. SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  930.   jbyteArray jresult = 0 ;
  931.   uint8_t *arg1 = (uint8_t *) 0 ;
  932.   uint32_t arg2 ;
  933.   int *arg3 = (int *) 0 ;
  934.   int *arg4 = (int *) 0 ;
  935.   jbyte *jarr1 ;
  936.   int temp3 ;
  937.   int temp4 ;
  938.   uint8_t *result = 0 ;
  939.  
  940.   (void)jenv;
  941.   (void)jcls;
  942.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  943.   arg2 = (uint32_t)jarg2;
  944.   {
  945.     if (!jarg3) {
  946.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  947.       return 0;
  948.     }
  949.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  950.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  951.       return 0;
  952.     }
  953.     arg3 = &temp3;
  954.   }
  955.   {
  956.     if (!jarg4) {
  957.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  958.       return 0;
  959.     }
  960.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  961.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  962.       return 0;
  963.     }
  964.     arg4 = &temp4;
  965.   }
  966.   {
  967.     if (arg2 < 0) {
  968.       {
  969.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  970.       };
  971.     }
  972.   }
  973.   result = (uint8_t *)WebPDecodeRGB((uint8_t const *)arg1,arg2,arg3,arg4);
  974.   jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
  975.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  976.   {
  977.     jint jvalue = (jint)temp3;
  978.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  979.   }
  980.   {
  981.     jint jvalue = (jint)temp4;
  982.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  983.   }
  984.   free(arg1);
  985.  
  986.  
  987.   free(result);
  988.   return jresult;
  989. }
  990.  
  991.  
  992. SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  993.   jbyteArray jresult = 0 ;
  994.   uint8_t *arg1 = (uint8_t *) 0 ;
  995.   uint32_t arg2 ;
  996.   int *arg3 = (int *) 0 ;
  997.   int *arg4 = (int *) 0 ;
  998.   jbyte *jarr1 ;
  999.   int temp3 ;
  1000.   int temp4 ;
  1001.   uint8_t *result = 0 ;
  1002.  
  1003.   (void)jenv;
  1004.   (void)jcls;
  1005.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  1006.   arg2 = (uint32_t)jarg2;
  1007.   {
  1008.     if (!jarg3) {
  1009.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1010.       return 0;
  1011.     }
  1012.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  1013.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1014.       return 0;
  1015.     }
  1016.     arg3 = &temp3;
  1017.   }
  1018.   {
  1019.     if (!jarg4) {
  1020.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1021.       return 0;
  1022.     }
  1023.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  1024.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1025.       return 0;
  1026.     }
  1027.     arg4 = &temp4;
  1028.   }
  1029.   {
  1030.     if (arg2 < 0) {
  1031.       {
  1032.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  1033.       };
  1034.     }
  1035.   }
  1036.   result = (uint8_t *)WebPDecodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4);
  1037.   jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
  1038.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  1039.   {
  1040.     jint jvalue = (jint)temp3;
  1041.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  1042.   }
  1043.   {
  1044.     jint jvalue = (jint)temp4;
  1045.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  1046.   }
  1047.   free(arg1);
  1048.  
  1049.  
  1050.   free(result);
  1051.   return jresult;
  1052. }
  1053.  
  1054.  
  1055. SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  1056.   jbyteArray jresult = 0 ;
  1057.   uint8_t *arg1 = (uint8_t *) 0 ;
  1058.   uint32_t arg2 ;
  1059.   int *arg3 = (int *) 0 ;
  1060.   int *arg4 = (int *) 0 ;
  1061.   jbyte *jarr1 ;
  1062.   int temp3 ;
  1063.   int temp4 ;
  1064.   uint8_t *result = 0 ;
  1065.  
  1066.   (void)jenv;
  1067.   (void)jcls;
  1068.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  1069.   arg2 = (uint32_t)jarg2;
  1070.   {
  1071.     if (!jarg3) {
  1072.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1073.       return 0;
  1074.     }
  1075.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  1076.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1077.       return 0;
  1078.     }
  1079.     arg3 = &temp3;
  1080.   }
  1081.   {
  1082.     if (!jarg4) {
  1083.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1084.       return 0;
  1085.     }
  1086.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  1087.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1088.       return 0;
  1089.     }
  1090.     arg4 = &temp4;
  1091.   }
  1092.   {
  1093.     if (arg2 < 0) {
  1094.       {
  1095.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  1096.       };
  1097.     }
  1098.   }
  1099.   result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4);
  1100.   jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
  1101.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  1102.   {
  1103.     jint jvalue = (jint)temp3;
  1104.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  1105.   }
  1106.   {
  1107.     jint jvalue = (jint)temp4;
  1108.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  1109.   }
  1110.   free(arg1);
  1111.  
  1112.  
  1113.   free(result);
  1114.   return jresult;
  1115. }
  1116.  
  1117.  
  1118. SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  1119.   jbyteArray jresult = 0 ;
  1120.   uint8_t *arg1 = (uint8_t *) 0 ;
  1121.   uint32_t arg2 ;
  1122.   int *arg3 = (int *) 0 ;
  1123.   int *arg4 = (int *) 0 ;
  1124.   jbyte *jarr1 ;
  1125.   int temp3 ;
  1126.   int temp4 ;
  1127.   uint8_t *result = 0 ;
  1128.  
  1129.   (void)jenv;
  1130.   (void)jcls;
  1131.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  1132.   arg2 = (uint32_t)jarg2;
  1133.   {
  1134.     if (!jarg3) {
  1135.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1136.       return 0;
  1137.     }
  1138.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  1139.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1140.       return 0;
  1141.     }
  1142.     arg3 = &temp3;
  1143.   }
  1144.   {
  1145.     if (!jarg4) {
  1146.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1147.       return 0;
  1148.     }
  1149.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  1150.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1151.       return 0;
  1152.     }
  1153.     arg4 = &temp4;
  1154.   }
  1155.   {
  1156.     if (arg2 < 0) {
  1157.       {
  1158.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  1159.       };
  1160.     }
  1161.   }
  1162.   result = (uint8_t *)WebPDecodeBGR((uint8_t const *)arg1,arg2,arg3,arg4);
  1163.   jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
  1164.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  1165.   {
  1166.     jint jvalue = (jint)temp3;
  1167.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  1168.   }
  1169.   {
  1170.     jint jvalue = (jint)temp4;
  1171.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  1172.   }
  1173.   free(arg1);
  1174.  
  1175.  
  1176.   free(result);
  1177.   return jresult;
  1178. }
  1179.  
  1180.  
  1181. SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
  1182.   jbyteArray jresult = 0 ;
  1183.   uint8_t *arg1 = (uint8_t *) 0 ;
  1184.   uint32_t arg2 ;
  1185.   int *arg3 = (int *) 0 ;
  1186.   int *arg4 = (int *) 0 ;
  1187.   jbyte *jarr1 ;
  1188.   int temp3 ;
  1189.   int temp4 ;
  1190.   uint8_t *result = 0 ;
  1191.  
  1192.   (void)jenv;
  1193.   (void)jcls;
  1194.   if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
  1195.   arg2 = (uint32_t)jarg2;
  1196.   {
  1197.     if (!jarg3) {
  1198.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1199.       return 0;
  1200.     }
  1201.     if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
  1202.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1203.       return 0;
  1204.     }
  1205.     arg3 = &temp3;
  1206.   }
  1207.   {
  1208.     if (!jarg4) {
  1209.       SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
  1210.       return 0;
  1211.     }
  1212.     if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
  1213.       SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
  1214.       return 0;
  1215.     }
  1216.     arg4 = &temp4;
  1217.   }
  1218.   {
  1219.     if (arg2 < 0) {
  1220.       {
  1221.         SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
  1222.       };
  1223.     }
  1224.   }
  1225.   result = (uint8_t *)WebPDecodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4);
  1226.   jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
  1227.   SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
  1228.   {
  1229.     jint jvalue = (jint)temp3;
  1230.     (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
  1231.   }
  1232.   {
  1233.     jint jvalue = (jint)temp4;
  1234.     (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
  1235.   }
  1236.   free(arg1);
  1237.  
  1238.  
  1239.   free(result);
  1240.   return jresult;
  1241. }
  1242.  
  1243.  
  1244.  
  1245.  
  1246. #ifdef __cplusplus
  1247. }
  1248. #endif
  1249.  
  1250.  
RAW Paste Data