fixed several warnings from Xcode 4 LLVM compiler; fixed bug #920

This commit is contained in:
Vadim Pisarevsky
2011-04-30 19:29:26 +00:00
parent 92852ca06e
commit 23a9b7bb9c
18 changed files with 51 additions and 53 deletions

View File

@@ -125,7 +125,7 @@ int jas_memdump(FILE *out, void *data, size_t len)
uchar *dp;
dp = data;
for (i = 0; i < len; i += 16) {
fprintf(out, "%04x:", i);
fprintf(out, "%04x:", (int)i);
for (j = 0; j < 16; ++j) {
if (i + j < len) {
fprintf(out, " %02x", dp[i + j]);

View File

@@ -490,18 +490,18 @@ int jp2_box_put(jp2_box_t *box, jas_stream_t *out)
box->len = jas_stream_tell(tmpstream) + JP2_BOX_HDRLEN(false);
jas_stream_rewind(tmpstream);
}
extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0;
if (jp2_putuint32(out, extlen ? 1 : box->len)) {
//extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0;
if (jp2_putuint32(out, /*extlen ? 1 :*/ box->len)) {
goto error;
}
if (jp2_putuint32(out, box->type)) {
goto error;
}
if (extlen) {
/*if (extlen) {
if (jp2_putuint64(out, box->len)) {
goto error;
}
}
}*/
if (dataflag) {
if (jas_stream_copy(out, tmpstream, box->len - JP2_BOX_HDRLEN(false))) {

View File

@@ -240,8 +240,7 @@ jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate)
}
/* Get the marker type. */
if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN ||
ms->id > JPC_MS_MAX) {
if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN /*|| ms->id > JPC_MS_MAX*/) {
jpc_ms_destroy(ms);
return 0;
}

View File

@@ -300,7 +300,7 @@ void jpc_mqdec_dump(jpc_mqdec_t *mqdec, FILE *out)
fprintf(out, "MQDEC A = %08lx, C = %08lx, CT=%08lx, ",
(unsigned long) mqdec->areg, (unsigned long) mqdec->creg,
(unsigned long) mqdec->ctreg);
fprintf(out, "CTX = %d, ", mqdec->curctx - mqdec->ctxs);
fprintf(out, "IND %d, MPS %d, QEVAL %x\n", *mqdec->curctx -
jpc_mqstates, (*mqdec->curctx)->mps, (*mqdec->curctx)->qeval);
fprintf(out, "CTX = %d, ", (int)(mqdec->curctx - mqdec->ctxs));
fprintf(out, "IND %d, MPS %d, QEVAL %x\n", (int)(*mqdec->curctx -
jpc_mqstates), (int)(*mqdec->curctx)->mps, (int)(*mqdec->curctx)->qeval);
}

View File

@@ -386,7 +386,7 @@ int jpc_mqenc_dump(jpc_mqenc_t *mqenc, FILE *out)
fprintf(out, "AREG = %08x, CREG = %08x, CTREG = %d\n",
mqenc->areg, mqenc->creg, mqenc->ctreg);
fprintf(out, "IND = %02d, MPS = %d, QEVAL = %04x\n",
*mqenc->curctx - jpc_mqstates, (*mqenc->curctx)->mps,
(*mqenc->curctx)->qeval);
(int)(*mqenc->curctx - jpc_mqstates), (int)(*mqenc->curctx)->mps,
(int)(*mqenc->curctx)->qeval);
return 0;
}

View File

@@ -574,7 +574,7 @@ long jpc_dec_lookahead(jas_stream_t *in)
jas_stream_ungetc(in, x >> 8) == EOF) {
return -1;
}
if (x >= JPC_MS_INMIN && x <= JPC_MS_INMAX) {
if (x >= JPC_MS_INMIN /*&& x <= JPC_MS_INMAX*/) {
return x;
}
return 0;

View File

@@ -1309,6 +1309,8 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
case JXFORM_ROT_270:
transpose_critical_parameters(dstinfo);
break;
default:
break;
}
/* Adjust Exif properties */
@@ -1446,6 +1448,8 @@ jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height,
if (image_height % (JDIMENSION) MCU_height)
result = FALSE;
break;
default:
break;
}
return result;

View File

@@ -584,7 +584,7 @@ PredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s)
{
TIFFErrorExt(tif->tif_clientdata, module,
"Out of memory allocating %d byte temp buffer.",
cc0 );
(int)cc0 );
return 0;
}
memcpy( working_copy, bp0, cc0 );

View File

@@ -51,25 +51,25 @@
static tsize_t
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
{
return ((tsize_t) read((int) fd, buf, (size_t) size));
return ((tsize_t) read((int) (size_t)fd, buf, (size_t) size));
}
static tsize_t
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
{
return ((tsize_t) write((int) fd, buf, (size_t) size));
return ((tsize_t) write((int) (size_t)fd, buf, (size_t) size));
}
static toff_t
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
{
return ((toff_t) lseek((int) fd, (off_t) off, whence));
return ((toff_t) lseek((int) (size_t)fd, (off_t) off, whence));
}
static int
_tiffCloseProc(thandle_t fd)
{
return (close((int) fd));
return (close((int) (size_t)fd));
}
@@ -81,7 +81,7 @@ _tiffSizeProc(thandle_t fd)
return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize);
#else
struct stat sb;
return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);
return (toff_t) (fstat((int) (size_t)fd, &sb) < 0 ? 0 : sb.st_size);
#endif
}
@@ -133,7 +133,7 @@ TIFFFdOpen(int fd, const char* name, const char* mode)
TIFF* tif;
tif = TIFFClientOpen(name, mode,
(thandle_t) fd,
(thandle_t) (size_t)fd,
_tiffReadProc, _tiffWriteProc,
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
_tiffMapProc, _tiffUnmapProc);