From 749f6482c368023a4c4f9dd222c72dba3b94480d Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 3 Nov 2016 19:08:15 +0000 Subject: Avoid warnings in 64bit windows builds of luratech bindings. --- source/fitz/load-jpx.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'source/fitz/load-jpx.c') diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c index 9eb5e2ed..b1d77c74 100644 --- a/source/fitz/load-jpx.c +++ b/source/fitz/load-jpx.c @@ -14,7 +14,7 @@ struct fz_jpxd_s JP2_Palette_Params *palette; JP2_Colorspace colorspace; unsigned char *data; - int size; + size_t size; JP2_Property_Value width; JP2_Property_Value height; fz_colorspace *cs; @@ -56,7 +56,7 @@ jpx_read(unsigned char *pucData, if (ulPos >= state->size) return 0; - ulSize = fz_mini(ulSize, state->size - ulPos); + ulSize = (unsigned long)fz_minz(ulSize, state->size - ulPos); memcpy(pucData, &state->data[ulPos], ulSize); return ulSize; } @@ -68,9 +68,9 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, fz_jpxd *state = (fz_jpxd *) param; JP2_Property_Value hstep, vstep; unsigned char *row; - int x, y, i; + JP2_Property_Value x, y, i; - if (ulRow >= state->pix->h || ulStart >= state->pix->w || sComponent >= state->pix->n) + if (ulRow >= (unsigned long)state->pix->h || ulStart >= (unsigned long)state->pix->w || sComponent >= state->pix->n) return cJP2_Error_OK; ulNum = fz_mini(ulNum, state->pix->w - ulStart); @@ -85,13 +85,13 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, state->pix->n * ulStart * hstep + sComponent; - for (y = 0; ulRow * vstep + y < state->pix->h && y < vstep; y++) + for (y = 0; ulRow * vstep + y < (JP2_Property_Value)state->pix->h && y < vstep; y++) { unsigned char *p = row; for (i = 0; i < ulNum; i++) { - for (x = 0; (ulStart + i) * hstep + x < state->pix->w && x < hstep; x++) + for (x = 0; (ulStart + i) * hstep + x < (JP2_Property_Value)state->pix->w && x < hstep; x++) { unsigned char v = fz_clampi(pucData[i], 0, state->palette->ulEntries - 1); @@ -128,13 +128,13 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, if (state->bpss[sComponent] > 8) { - for (y = 0; ulRow * vstep + y < state->pix->h && y < vstep; y++) + for (y = 0; ulRow * vstep + y < (JP2_Property_Value)state->pix->h && y < vstep; y++) { unsigned char *p = row; for (i = 0; i < ulNum; i++) { - for (x = 0; (ulStart + i) * hstep + x < state->pix->w && x < hstep; x++) + for (x = 0; (ulStart + i) * hstep + x < (JP2_Property_Value)state->pix->w && x < hstep; x++) { unsigned int v = (pucData[2 * i + 1] << 8) | pucData[2 * i + 0]; v &= (1 << state->bpss[sComponent]) - 1; @@ -149,13 +149,13 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, } else if (state->bpss[sComponent] == 8) { - for (y = 0; ulRow * vstep + y < state->pix->h && y < vstep; y++) + for (y = 0; ulRow * vstep + y < (JP2_Property_Value)state->pix->h && y < vstep; y++) { unsigned char *p = row; for (i = 0; i < ulNum; i++) { - for (x = 0; (ulStart + i) * hstep + x < state->pix->w && x < hstep; x++) + for (x = 0; (ulStart + i) * hstep + x < (JP2_Property_Value)state->pix->w && x < hstep; x++) { unsigned int v = pucData[i]; v &= (1 << state->bpss[sComponent]) - 1; @@ -170,13 +170,13 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, } else { - for (y = 0; ulRow * vstep + y < state->pix->h && y < vstep; y++) + for (y = 0; ulRow * vstep + y < (JP2_Property_Value)state->pix->h && y < vstep; y++) { unsigned char *p = row; for (i = 0; i < ulNum; i++) { - for (x = 0; (ulStart + i) * hstep + x < state->pix->w && x < hstep; x++) + for (x = 0; (ulStart + i) * hstep + x < (JP2_Property_Value)state->pix->w && x < hstep; x++) { unsigned int v = pucData[i]; v &= (1 << state->bpss[sComponent]) - 1; @@ -197,7 +197,7 @@ jpx_write(unsigned char * pucData, short sComponent, unsigned long ulRow, static void jpx_ycc_to_rgb(fz_context *ctx, fz_jpxd *state) { - int x, y; + JP2_Property_Value x, y; for (y = 0; y < state->height; y++) { @@ -235,7 +235,8 @@ jpx_read_image(fz_context *ctx, fz_jpxd *state, unsigned char *data, size_t size { JP2_Channel_Def_Params *chans = NULL; JP2_Error err; - int k, colors, alphas, prealphas; + int colors, alphas, prealphas; + JP2_Property_Value k; memset(state, 0x00, sizeof (fz_jpxd)); state->ctx = ctx; -- cgit v1.2.3