decode.h: use size_t consistently

replaces mixed use of int/uint32_t for buffer sizes
further changes the API/ABI.

Change-Id: I91d70fd82ee3e1ac34b884b8ead9a114a9b1015a
This commit is contained in:
James Zern
2012-04-17 16:01:33 -07:00
parent dceb8b4d9a
commit 9b3d1f3a1b
12 changed files with 115 additions and 158 deletions

View File

@ -35,8 +35,6 @@
// Decoder specific
%apply int *OUTPUT { int *width, int *height }
%apply int { uint32_t data_size }
%apply Number NONNEGATIVE { uint32_t data_size }
// free the buffer returned by these functions after copying into
// the native type
@ -48,18 +46,18 @@
%typemap(newfree) uint8_t* "free($1);"
int WebPGetDecoderVersion(void);
int WebPGetInfo(const uint8_t* data, uint32_t data_size,
int WebPGetInfo(const uint8_t* data, size_t data_size,
int *width, int *height);
uint8_t* WebPDecodeRGB(const uint8_t* data, uint32_t data_size,
uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size,
int *width, int *height);
uint8_t* WebPDecodeRGBA(const uint8_t* data, uint32_t data_size,
uint8_t* WebPDecodeRGBA(const uint8_t* data, size_t data_size,
int *width, int *height);
uint8_t* WebPDecodeARGB(const uint8_t* data, uint32_t data_size,
uint8_t* WebPDecodeARGB(const uint8_t* data, size_t data_size,
int* width, int* height);
uint8_t* WebPDecodeBGR(const uint8_t* data, uint32_t data_size,
uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
int *width, int *height);
uint8_t* WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size,
int *width, int *height);
//------------------------------------------------------------------------------

Binary file not shown.

View File

@ -923,10 +923,10 @@ SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetDecoderVersion(JN
}
SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jint jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -937,7 +937,7 @@ SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -960,13 +960,6 @@ SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = (jint)result;
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
@ -985,10 +978,10 @@ SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -999,7 +992,7 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIE
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -1022,13 +1015,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIE
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (uint8_t *)WebPDecodeRGB((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
@ -1048,10 +1034,10 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIE
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -1062,7 +1048,7 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNI
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -1085,13 +1071,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNI
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (uint8_t *)WebPDecodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
@ -1111,10 +1090,10 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNI
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -1125,7 +1104,7 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNI
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -1148,13 +1127,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNI
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
@ -1174,10 +1146,10 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNI
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -1188,7 +1160,7 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIE
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -1211,13 +1183,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIE
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (uint8_t *)WebPDecodeBGR((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
@ -1237,10 +1202,10 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIE
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) {
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
uint32_t arg2 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
@ -1251,7 +1216,7 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNI
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (uint32_t)jarg2;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
@ -1274,13 +1239,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNI
}
arg4 = &temp4;
}
{
if (arg2 < 0) {
{
SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0;
};
}
}
result = (uint8_t *)WebPDecodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);