Eliminate incompatible pointer type warnings

(C4057 in MSVC and -Wincompatible-pointer-types in GCC/Clang)
This commit is contained in:
DRC
2022-02-22 14:01:07 -06:00
parent 13377e6b38
commit eb21c023ab

View File

@@ -334,6 +334,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom
jbyteArray jSrcPlanes[3] = { NULL, NULL, NULL };
const unsigned char *srcPlanesTmp[3] = { NULL, NULL, NULL };
const unsigned char *srcPlanes[3] = { NULL, NULL, NULL };
jint srcOffsetsTmp[3] = { 0, 0, 0 }, srcStridesTmp[3] = { 0, 0, 0 };
int srcOffsets[3] = { 0, 0, 0 }, srcStrides[3] = { 0, 0, 0 };
unsigned char *jpegBuf = NULL;
int nc = (subsamp == org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY ? 1 : 3), i;
@@ -358,11 +359,15 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom
if (ProcessSystemProperties(env) < 0) goto bailout;
(*env)->GetIntArrayRegion(env, jSrcOffsets, 0, nc, srcOffsets);
(*env)->GetIntArrayRegion(env, jSrcOffsets, 0, nc, srcOffsetsTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
srcOffsets[i] = srcOffsetsTmp[i];
(*env)->GetIntArrayRegion(env, jSrcStrides, 0, nc, srcStrides);
(*env)->GetIntArrayRegion(env, jSrcStrides, 0, nc, srcStridesTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
srcStrides[i] = srcStridesTmp[i];
for (i = 0; i < nc; i++) {
int planeSize = tjPlaneSizeYUV(i, width, srcStrides[i], height, subsamp);
@@ -415,6 +420,7 @@ static void TJCompressor_encodeYUV
jbyteArray jDstPlanes[3] = { NULL, NULL, NULL };
unsigned char *dstPlanesTmp[3] = { NULL, NULL, NULL };
unsigned char *dstPlanes[3] = { NULL, NULL, NULL };
jint dstOffsetsTmp[3] = { 0, 0, 0 }, dstStridesTmp[3] = { 0, 0, 0 };
int dstOffsets[3] = { 0, 0, 0 }, dstStrides[3] = { 0, 0, 0 };
int nc = (subsamp == org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY ? 1 : 3), i;
@@ -440,11 +446,15 @@ static void TJCompressor_encodeYUV
if ((*env)->GetArrayLength(env, src) * srcElementSize < arraySize)
THROW_ARG("Source buffer is not large enough");
(*env)->GetIntArrayRegion(env, jDstOffsets, 0, nc, dstOffsets);
(*env)->GetIntArrayRegion(env, jDstOffsets, 0, nc, dstOffsetsTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
dstOffsets[i] = dstOffsetsTmp[i];
(*env)->GetIntArrayRegion(env, jDstStrides, 0, nc, dstStrides);
(*env)->GetIntArrayRegion(env, jDstStrides, 0, nc, dstStridesTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
dstStrides[i] = dstStridesTmp[i];
for (i = 0; i < nc; i++) {
int planeSize = tjPlaneSizeYUV(i, width, dstStrides[i], height, subsamp);
@@ -784,6 +794,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
jbyteArray jDstPlanes[3] = { NULL, NULL, NULL };
unsigned char *dstPlanesTmp[3] = { NULL, NULL, NULL };
unsigned char *dstPlanes[3] = { NULL, NULL, NULL };
jint dstOffsetsTmp[3] = { 0, 0, 0 }, dstStridesTmp[3] = { 0, 0, 0 };
int dstOffsets[3] = { 0, 0, 0 }, dstStrides[3] = { 0, 0, 0 };
int jpegSubsamp = -1, jpegWidth = 0, jpegHeight = 0;
int nc = 0, i, width, height, scaledWidth, scaledHeight, nsf = 0;
@@ -818,11 +829,15 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
if (i >= nsf)
THROW_ARG("Could not scale down to desired image dimensions");
(*env)->GetIntArrayRegion(env, jDstOffsets, 0, nc, dstOffsets);
(*env)->GetIntArrayRegion(env, jDstOffsets, 0, nc, dstOffsetsTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
dstOffsets[i] = dstOffsetsTmp[i];
(*env)->GetIntArrayRegion(env, jDstStrides, 0, nc, dstStrides);
(*env)->GetIntArrayRegion(env, jDstStrides, 0, nc, dstStridesTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
dstStrides[i] = dstStridesTmp[i];
for (i = 0; i < nc; i++) {
int planeSize = tjPlaneSizeYUV(i, scaledWidth, dstStrides[i], scaledHeight,
@@ -912,6 +927,7 @@ static void TJDecompressor_decodeYUV
jbyteArray jSrcPlanes[3] = { NULL, NULL, NULL };
const unsigned char *srcPlanesTmp[3] = { NULL, NULL, NULL };
const unsigned char *srcPlanes[3] = { NULL, NULL, NULL };
jint srcOffsetsTmp[3] = { 0, 0, 0 }, srcStridesTmp[3] = { 0, 0, 0 };
int srcOffsets[3] = { 0, 0, 0 }, srcStrides[3] = { 0, 0, 0 };
unsigned char *dstBuf = NULL;
int nc = (subsamp == org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY ? 1 : 3), i;
@@ -937,11 +953,15 @@ static void TJDecompressor_decodeYUV
if ((*env)->GetArrayLength(env, dst) * dstElementSize < arraySize)
THROW_ARG("Destination buffer is not large enough");
(*env)->GetIntArrayRegion(env, jSrcOffsets, 0, nc, srcOffsets);
(*env)->GetIntArrayRegion(env, jSrcOffsets, 0, nc, srcOffsetsTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
srcOffsets[i] = srcOffsetsTmp[i];
(*env)->GetIntArrayRegion(env, jSrcStrides, 0, nc, srcStrides);
(*env)->GetIntArrayRegion(env, jSrcStrides, 0, nc, srcStridesTmp);
if ((*env)->ExceptionCheck(env)) goto bailout;
for (i = 0; i < 3; i++)
srcStrides[i] = srcStridesTmp[i];
for (i = 0; i < nc; i++) {
int planeSize = tjPlaneSizeYUV(i, width, srcStrides[i], height, subsamp);