commit 04c6b5b7c2535cf384926b6ccdce3dbeb0c78651
parent 1d4f2da2e3f7c05184b78e804a2c7ab9365c5282
Author: Russ Cox <rsc@swtch.com>
Date: Sun, 7 Dec 2008 20:17:22 -0800
vxa: 64-bit fixes
Diffstat:
9 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/src/vxa/flac/dflac.c b/src/vxa/flac/dflac.c
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <assert.h>
+#include <unistd.h>
#include "FLAC/file_decoder.h"
#include "src/flac/decode.h"
diff --git a/src/vxa/jp2/base/jas_debug.c b/src/vxa/jp2/base/jas_debug.c
@@ -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]);
diff --git a/src/vxa/jp2/base/jas_icc.c b/src/vxa/jp2/base/jas_icc.c
@@ -729,9 +729,9 @@ void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out)
fprintf(out, "attrno=%d; attrname=\"%s\"(0x%08x); attrtype=\"%s\"(0x%08x)\n",
i,
jas_iccsigtostr(attr->name, &buf[0]),
- attr->name,
+ (int)attr->name,
jas_iccsigtostr(attrval->type, &buf[8]),
- attrval->type
+ (int)attrval->type
);
jas_iccattrval_dump(attrval, out);
fprintf(out, "---\n");
@@ -883,7 +883,7 @@ void jas_iccattrval_dump(jas_iccattrval_t *attrval, FILE *out)
char buf[8];
jas_iccsigtostr(attrval->type, buf);
fprintf(out, "refcnt = %d; type = 0x%08x %s\n", attrval->refcnt,
- attrval->type, jas_iccsigtostr(attrval->type, &buf[0]));
+ (int)attrval->type, jas_iccsigtostr(attrval->type, &buf[0]));
if (attrval->ops->dump) {
(*attrval->ops->dump)(attrval, out);
}
@@ -1040,7 +1040,7 @@ static void jas_icccurv_dump(jas_iccattrval_t *attrval, FILE *out)
{
int i;
jas_icccurv_t *curv = &attrval->data.curv;
- fprintf(out, "number of entires = %d\n", curv->numents);
+ fprintf(out, "number of entires = %d\n", (int)curv->numents);
if (curv->numents == 1) {
fprintf(out, "gamma = %f\n", curv->ents[0] / 256.0);
} else {
@@ -1166,10 +1166,10 @@ static void jas_icctxtdesc_dump(jas_iccattrval_t *attrval, FILE *out)
{
jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
fprintf(out, "ascii = \"%s\"\n", txtdesc->ascdata);
- fprintf(out, "uclangcode = %d; uclen = %d\n", txtdesc->uclangcode,
- txtdesc->uclen);
- fprintf(out, "sccode = %d\n", txtdesc->sccode);
- fprintf(out, "maclen = %d\n", txtdesc->maclen);
+ fprintf(out, "uclangcode = %d; uclen = %d\n", (int)txtdesc->uclangcode,
+ (int)txtdesc->uclen);
+ fprintf(out, "sccode = %d\n", (int)txtdesc->sccode);
+ fprintf(out, "maclen = %d\n", (int)txtdesc->maclen);
}
/******************************************************************************\
@@ -1400,7 +1400,7 @@ static void jas_icclut8_dump(jas_iccattrval_t *attrval, FILE *out)
fprintf(out, "\n");
}
fprintf(out, "numintabents=%d, numouttabents=%d\n",
- lut8->numintabents, lut8->numouttabents);
+ (int)lut8->numintabents, (int)lut8->numouttabents);
}
/******************************************************************************\
@@ -1564,7 +1564,7 @@ static void jas_icclut16_dump(jas_iccattrval_t *attrval, FILE *out)
fprintf(out, "\n");
}
fprintf(out, "numintabents=%d, numouttabents=%d\n",
- lut16->numintabents, lut16->numouttabents);
+ (int)lut16->numintabents, (int)lut16->numouttabents);
}
/******************************************************************************\
diff --git a/src/vxa/jp2/base/jas_image.c b/src/vxa/jp2/base/jas_image.c
@@ -822,7 +822,7 @@ void jas_image_dump(jas_image_t *image, FILE *out)
for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
cmpt = image->cmpts_[cmptno];
fprintf(out, "prec=%d, sgnd=%d, cmpttype=%d\n", cmpt->prec_,
- cmpt->sgnd_, cmpt->type_);
+ cmpt->sgnd_, (int)cmpt->type_);
width = jas_image_cmptwidth(image, cmptno);
height = jas_image_cmptheight(image, cmptno);
n = JAS_MIN(16, width);
diff --git a/src/vxa/jp2/base/jas_stream.c b/src/vxa/jp2/base/jas_stream.c
@@ -366,7 +366,7 @@ jas_stream_t *jas_stream_tmpfile()
stream->obj_ = obj;
/* Choose a file name. */
- tmpnam(obj->pathname);
+ if(tmpnam(obj->pathname)){}
/* Open the underlying file. */
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
diff --git a/src/vxa/jp2/jp2/jp2_cod.c b/src/vxa/jp2/jp2/jp2_cod.c
@@ -312,7 +312,7 @@ void jp2_box_dump(jp2_box_t *box, FILE *out)
fprintf(out, "JP2 box: ");
fprintf(out, "type=%c%s%c (0x%08x); length=%d\n", '"', boxinfo->name,
- '"', box->type, box->len);
+ '"', (int)box->type, (int)box->len);
if (box->ops->dumpdata) {
(*box->ops->dumpdata)(box, out);
}
@@ -424,7 +424,7 @@ static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out)
unsigned int i;
for (i = 0; i < cdef->numchans; ++i) {
fprintf(out, "channo=%d; type=%d; assoc=%d\n",
- cdef->ents[i].channo, cdef->ents[i].type, cdef->ents[i].assoc);
+ (int)cdef->ents[i].channo, (int)cdef->ents[i].type, (int)cdef->ents[i].assoc);
}
}
@@ -850,7 +850,7 @@ static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out)
(int) pclr->numchans);
for (i = 0; i < pclr->numlutents; ++i) {
for (j = 0; j < pclr->numchans; ++j) {
- fprintf(out, "LUT[%d][%d]=%d\n", i, j, pclr->lutdata[i * pclr->numchans + j]);
+ fprintf(out, "LUT[%d][%d]=%d\n", i, j, (int)pclr->lutdata[i * pclr->numchans + j]);
}
}
}
diff --git a/src/vxa/jp2/jpc/jpc_cs.c b/src/vxa/jp2/jpc/jpc_cs.c
@@ -405,9 +405,9 @@ void jpc_ms_dump(jpc_ms_t *ms, FILE *out)
{
jpc_mstabent_t *mstabent;
mstabent = jpc_mstab_lookup(ms->id);
- fprintf(out, "type = 0x%04x (%s);", ms->id, mstabent->name);
+ fprintf(out, "type = 0x%04x (%s);", (int)ms->id, mstabent->name);
if (JPC_MS_HASPARMS(ms->id)) {
- fprintf(out, " len = %d;", ms->len + 2);
+ fprintf(out, " len = %d;", (int)ms->len + 2);
if (ms->ops->dumpparms) {
(*ms->ops->dumpparms)(ms, out);
} else {
@@ -461,7 +461,7 @@ static int jpc_sot_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_sot_t *sot = &ms->parms.sot;
fprintf(out, "tileno = %d; len = %d; partno = %d; numparts = %d\n",
- sot->tileno, sot->len, sot->partno, sot->numparts);
+ (int)sot->tileno, (int)sot->len, (int)sot->partno, (int)sot->numparts);
return 0;
}
@@ -560,12 +560,12 @@ static int jpc_siz_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_siz_t *siz = &ms->parms.siz;
unsigned int i;
- fprintf(out, "caps = 0x%02x;\n", siz->caps);
+ fprintf(out, "caps = 0x%02x;\n", (int)siz->caps);
fprintf(out, "width = %d; height = %d; xoff = %d; yoff = %d;\n",
- siz->width, siz->height, siz->xoff, siz->yoff);
+ (int)siz->width, (int)siz->height, (int)siz->xoff, (int)siz->yoff);
fprintf(out, "tilewidth = %d; tileheight = %d; tilexoff = %d; "
- "tileyoff = %d;\n", siz->tilewidth, siz->tileheight, siz->tilexoff,
- siz->tileyoff);
+ "tileyoff = %d;\n", (int)siz->tilewidth, (int)siz->tileheight, (int)siz->tilexoff,
+ (int)siz->tileyoff);
for (i = 0; i < siz->numcomps; ++i) {
fprintf(out, "prec[%d] = %d; sgnd[%d] = %d; hsamp[%d] = %d; "
"vsamp[%d] = %d\n", i, siz->comps[i].prec, i,
@@ -633,7 +633,7 @@ static int jpc_cod_dumpparms(jpc_ms_t *ms, FILE *out)
fprintf(out, "numdlvls = %d; qmfbid = %d; mctrans = %d\n",
cod->compparms.numdlvls, cod->compparms.qmfbid, cod->mctrans);
fprintf(out, "prg = %d; numlyrs = %d;\n",
- cod->prg, cod->numlyrs);
+ (int)cod->prg, (int)cod->numlyrs);
fprintf(out, "cblkwidthval = %d; cblkheightval = %d; "
"cblksty = 0x%02x;\n", cod->compparms.cblkwidthval, cod->compparms.cblkheightval,
cod->compparms.cblksty);
@@ -711,7 +711,7 @@ static int jpc_coc_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_coc_t *coc = &ms->parms.coc;
fprintf(out, "compno = %d; csty = 0x%02x; numdlvls = %d;\n",
- coc->compno, coc->compparms.csty, coc->compparms.numdlvls);
+ (int)coc->compno, (int)coc->compparms.csty, (int)coc->compparms.numdlvls);
fprintf(out, "cblkwidthval = %d; cblkheightval = %d; "
"cblksty = 0x%02x; qmfbid = %d;\n", coc->compparms.cblkwidthval,
coc->compparms.cblkheightval, coc->compparms.cblksty, coc->compparms.qmfbid);
@@ -842,7 +842,7 @@ static int jpc_rgn_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_rgn_t *rgn = &ms->parms.rgn;
fprintf(out, "compno = %d; roisty = %d; roishift = %d\n",
- rgn->compno, rgn->roisty, rgn->roishift);
+ (int)rgn->compno, (int)rgn->roisty, (int)rgn->roishift);
return 0;
}
@@ -935,8 +935,8 @@ static int jpc_qcc_dumpparms(jpc_ms_t *ms, FILE *out)
jpc_qcc_t *qcc = &ms->parms.qcc;
int i;
fprintf(out, "compno = %d; qntsty = %d; numguard = %d; "
- "numstepsizes = %d\n", qcc->compno, qcc->compparms.qntsty, qcc->compparms.numguard,
- qcc->compparms.numstepsizes);
+ "numstepsizes = %d\n", (int)qcc->compno, qcc->compparms.qntsty, qcc->compparms.numguard,
+ (int)qcc->compparms.numstepsizes);
for (i = 0; i < qcc->compparms.numstepsizes; ++i) {
fprintf(out, "expn[%d] = 0x%04x; mant[%d] = 0x%04x;\n",
i, (unsigned) JPC_QCX_GETEXPN(qcc->compparms.stepsizes[i]),
@@ -1058,7 +1058,7 @@ static int jpc_sop_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
static int jpc_sop_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_sop_t *sop = &ms->parms.sop;
- fprintf(out, "seqno = %d;\n", sop->seqno);
+ fprintf(out, "seqno = %d;\n", (int)sop->seqno);
return 0;
}
@@ -1124,7 +1124,7 @@ static int jpc_ppm_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
static int jpc_ppm_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_ppm_t *ppm = &ms->parms.ppm;
- fprintf(out, "ind=%d; len = %d;\n", ppm->ind, ppm->len);
+ fprintf(out, "ind=%d; len = %d;\n", (int)ppm->ind, (int)ppm->len);
if (ppm->len > 0) {
fprintf(out, "data =\n");
jas_memdump(out, ppm->data, ppm->len);
@@ -1196,7 +1196,7 @@ static int jpc_ppt_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
static int jpc_ppt_dumpparms(jpc_ms_t *ms, FILE *out)
{
jpc_ppt_t *ppt = &ms->parms.ppt;
- fprintf(out, "ind=%d; len = %d;\n", ppt->ind, ppt->len);
+ fprintf(out, "ind=%d; len = %d;\n", (int)ppt->ind, (int)ppt->len);
if (ppt->len > 0) {
fprintf(out, "data =\n");
jas_memdump(out, ppt->data, ppt->len);
@@ -1303,10 +1303,10 @@ static int jpc_poc_dumpparms(jpc_ms_t *ms, FILE *out)
++pchgno, ++pchg) {
fprintf(out, "po[%d] = %d; ", pchgno, pchg->prgord);
fprintf(out, "cs[%d] = %d; ce[%d] = %d; ",
- pchgno, pchg->compnostart, pchgno, pchg->compnoend);
+ (int)pchgno, (int)pchg->compnostart, (int)pchgno, (int)pchg->compnoend);
fprintf(out, "rs[%d] = %d; re[%d] = %d; ",
pchgno, pchg->rlvlnostart, pchgno, pchg->rlvlnoend);
- fprintf(out, "le[%d] = %d\n", pchgno, pchg->lyrnoend);
+ fprintf(out, "le[%d] = %d\n", pchgno, (int)pchg->lyrnoend);
}
return 0;
}
@@ -1370,7 +1370,7 @@ static int jpc_crg_dumpparms(jpc_ms_t *ms, FILE *out)
for (compno = 0, comp = crg->comps; compno < crg->numcomps; ++compno,
++comp) {
fprintf(out, "hoff[%d] = %d; voff[%d] = %d\n", compno,
- comp->hoff, compno, comp->voff);
+ (int)comp->hoff, compno, (int)comp->voff);
}
return 0;
}
@@ -1432,7 +1432,7 @@ static int jpc_com_dumpparms(jpc_ms_t *ms, FILE *out)
jpc_com_t *com = &ms->parms.com;
unsigned int i;
int printable;
- fprintf(out, "regid = %d;\n", com->regid);
+ fprintf(out, "regid = %d;\n", (int)com->regid);
printable = 1;
for (i = 0; i < com->len; ++i) {
if (!isprint(com->data[i])) {
@@ -1442,7 +1442,7 @@ static int jpc_com_dumpparms(jpc_ms_t *ms, FILE *out)
}
if (printable) {
fprintf(out, "data = ");
- fwrite(com->data, sizeof(char), com->len, out);
+ if(fwrite(com->data, sizeof(char), (int)com->len, out)){}
fprintf(out, "\n");
}
return 0;
diff --git a/src/vxa/jp2/jpc/jpc_dec.c b/src/vxa/jp2/jpc/jpc_dec.c
@@ -2010,8 +2010,8 @@ static int jpc_dec_dump(jpc_dec_t *dec, FILE *out)
tcomp->numrlvls; ++rlvlno, ++rlvl) {
fprintf(out, "RESOLUTION LEVEL %d\n", rlvlno);
fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
- rlvl->xstart, rlvl->ystart, rlvl->xend, rlvl->yend, rlvl->xend -
- rlvl->xstart, rlvl->yend - rlvl->ystart);
+ (int)rlvl->xstart, (int)rlvl->ystart,(int) rlvl->xend, (int)rlvl->yend, (int)rlvl->xend -
+ (int)rlvl->xstart, (int)rlvl->yend - (int)rlvl->ystart);
for (bandno = 0, band = rlvl->bands;
bandno < rlvl->numbands; ++bandno, ++band) {
fprintf(out, "BAND %d\n", bandno);
@@ -2024,8 +2024,8 @@ fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
++prc) {
fprintf(out, "CODE BLOCK GROUP %d\n", prcno);
fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
- prc->xstart, prc->ystart, prc->xend, prc->yend, prc->xend -
- prc->xstart, prc->yend - prc->ystart);
+ (int)prc->xstart, (int)prc->ystart, (int)prc->xend, (int)prc->yend, (int)prc->xend -
+ (int)prc->xstart, (int)prc->yend - (int)prc->ystart);
for (cblkno = 0, cblk =
prc->cblks; cblkno <
prc->numcblks; ++cblkno,
diff --git a/src/vxa/jp2/jpc/jpc_mqdec.c b/src/vxa/jp2/jpc/jpc_mqdec.c
@@ -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);
}