# HG changeset patch # User Matti Hamalainen # Date 1578576023 -7200 # Node ID 36edd316184a896b1d5d74c019b3ee71b2a44b2e # Parent 43e39d9ec42f87cb016161e2ffc00f9c63adef1b Fix some format strings to use proper PRI*_SIZE_T where necessary. diff -r 43e39d9ec42f -r 36edd316184a src/dmengine.c --- a/src/dmengine.c Thu Jan 09 14:55:41 2020 +0200 +++ b/src/dmengine.c Thu Jan 09 15:20:23 2020 +0200 @@ -208,7 +208,7 @@ { OggVorbis_File vf; - dmMsg(2, "vorbisfile '%s', %d bytes resource loading\n", + dmMsg(2, "vorbisfile '%s', %" DM_PRIu_SIZE_T " bytes resource loading\n", res->filename, res->rawSize); if (ov_open_callbacks(res, &vf, NULL, 0, vorbisFileCBS) < 0) @@ -221,7 +221,7 @@ return DMERR_MALLOC; } - dmMsg(2, "rdataSize=%d bytes?\n", res->resSize); + dmMsg(2, "rdataSize=%" DM_PRIu_SIZE_T " bytes?\n", res->resSize); BOOL eof = FALSE; int left = res->resSize; diff -r 43e39d9ec42f -r 36edd316184a src/dmfile.c --- a/src/dmfile.c Thu Jan 09 14:55:41 2020 +0200 +++ b/src/dmfile.c Thu Jan 09 15:20:23 2020 +0200 @@ -124,7 +124,8 @@ if ((dataBuf = dmMalloc(dataSize)) == NULL) { res = dmError(DMERR_MALLOC, - "Error allocating memory for data, %d bytes.\n", dataSize); + "Error allocating memory for data, %" DM_PRIu_SIZE_T " bytes.\n", + dataSize); goto error; } @@ -143,7 +144,7 @@ if ((dataBuf = dmRealloc(dataBuf, dataSize)) == NULL) { res = dmError(DMERR_MALLOC, - "Error reallocating memory for data, %d bytes.\n", + "Error reallocating memory for data, %" DM_PRIu_SIZE_T " bytes.\n", dataSize); goto error; } diff -r 43e39d9ec42f -r 36edd316184a src/dmres.c --- a/src/dmres.c Thu Jan 09 14:55:41 2020 +0200 +++ b/src/dmres.c Thu Jan 09 15:20:23 2020 +0200 @@ -512,7 +512,8 @@ if (handle->rawSize != node->size) { ret = dmErrorDBG(DMERR_COMPRESSION, - "Decompressed data size for '%s' does not match size stored in PACK entry (%d <> %d).\n", + "Decompressed data size for '%s' does not match size " + "stored in PACK entry (%" DM_PRIu_SIZE_T " <> %d).\n", handle->filename, handle->rawSize, node->size); } } diff -r 43e39d9ec42f -r 36edd316184a src/dmzlib.c --- a/src/dmzlib.c Thu Jan 09 14:55:41 2020 +0200 +++ b/src/dmzlib.c Thu Jan 09 15:20:23 2020 +0200 @@ -497,7 +497,7 @@ static int dmZLibParseUncompressedBlock(DMZLibContext * ctx) { Uint8 header[4]; - size_t len, nlen, k, ret; + size_t len, nlen, k; // "Any bits of input up to the next byte boundary are ignored." if (ctx->numBits & 7) @@ -523,12 +523,15 @@ if (nlen != (len ^ 0xffff)) { return dmErrorDBG(DMERR_DATA_ERROR, - "Compressed data corrupt %04x :: %04x [%04x].\n", + "Compressed data corrupt %04" DM_PRIx_SIZE_T + " :: %04" DM_PRIx_SIZE_T " [%04" DM_PRIx_SIZE_T "].\n", nlen, len, len ^ 0xffff); } if (len > 0) { + int ret; + if (ctx->inBuffer + len > ctx->inBufferEnd) { return dmErrorDBG(DMERR_BOUNDS, diff -r 43e39d9ec42f -r 36edd316184a tools/fanalyze.c --- a/tools/fanalyze.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/fanalyze.c Thu Jan 09 15:20:23 2020 +0200 @@ -930,7 +930,7 @@ // BOOL slow = FALSE; int ss = 0; - dmPrint(0, "Attempting to find matching sequences of %" DM_PRIu_SIZE_T" bytes or more.\n", + dmPrint(0, "Attempting to find matching sequences of %" DM_PRIu_SIZE_T " bytes or more.\n", optMinMatchLen); if (totalSize > 32*1024) diff -r 43e39d9ec42f -r 36edd316184a tools/gfxconv.c --- a/tools/gfxconv.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/gfxconv.c Thu Jan 09 15:20:23 2020 +0200 @@ -1713,7 +1713,8 @@ if ((tmpBuf = dmMalloc(outBufSize)) == NULL) { - dmErrorMsg("Could not allocate %d bytes for conversion buffer.\n", + dmErrorMsg("Could not allocate %" DM_PRIu_SIZE_T + " bytes for conversion buffer.\n", outBufSize); goto error; } @@ -2078,7 +2079,9 @@ dataSize = optInSkip; dataRealOffs = dataSizeOrig - optInSkip; - dmMsg(1, "Input skip -%d (-0x%x). Offset %d (0x%x), size %d (0x%x).\n", + dmMsg(1, "Input skip -%d (-0x%x). " + "Offset %" DM_PRIu_SIZE_T " (0x%" DM_PRIx_SIZE_T "), " + "size %" DM_PRIu_SIZE_T " (0x%" DM_PRIx_SIZE_T ").\n", optInSkip, optInSkip, dataRealOffs, dataRealOffs, dataSize, dataSize); @@ -2090,7 +2093,8 @@ dataSize = dataSizeOrig - optInSkip; dataRealOffs = optInSkip; - dmMsg(1, "Input skip %d (0x%x), size %d (0x%x).\n", + dmMsg(1, "Input skip %d (0x%x), " + "size %" DM_PRIu_SIZE_T " (0x%" DM_PRIx_SIZE_T ").\n", optInSkip, optInSkip, dataSize, dataSize); } diff -r 43e39d9ec42f -r 36edd316184a tools/libgfx.c --- a/tools/libgfx.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/libgfx.c Thu Jan 09 15:20:23 2020 +0200 @@ -1621,7 +1621,8 @@ if ((pcx.buf = dmMalloc(pcx.bufLen)) == NULL) { res = dmError(DMERR_MALLOC, - "PCX: Could not allocate %d bytes for RLE compression buffer.\n", + "PCX: Could not allocate %" DM_PRIu_SIZE_T + " bytes for RLE compression buffer.\n", pcx.bufLen); goto error; } @@ -1855,7 +1856,7 @@ } dmMsg(2, - "PCX: bufLen=%d\n", + "PCX: bufLen=%" DM_PRIu_SIZE_T "\n", pcx.bufLen); // Read image data @@ -2101,14 +2102,17 @@ if (size & 1) { - dmMsg(3, "IFF: Chunk size %d is uneven, adjusting to %d.\n", + dmMsg(3, "IFF: Chunk size %" DM_PRIu_SIZE_T + " is uneven, adjusting to %" DM_PRIu_SIZE_T ".\n", size, size + 1); size++; } if (size > read) { - dmMsg(3, "IFF: Skipping %d bytes (%d of %d consumed)\n", + dmMsg(3, "IFF: Skipping %" DM_PRIu_SIZE_T + " bytes (%" DM_PRIu_SIZE_T + " of %" DM_PRIu_SIZE_T " consumed)\n", size - read, read, size); if (dmfseek(fp, size - read, SEEK_CUR) != 0) @@ -2212,14 +2216,16 @@ if (iff->idsig == IFF_ID_ILBM) { bufLen = ((img->width + 15) / 16) * 2; - dmMsg(2, "IFF: Line / plane row size %d bytes.\n", bufLen); + dmMsg(2, "IFF: Line / plane row size %" DM_PRIu_SIZE_T " bytes.\n", + bufLen); } else if (iff->idsig == IFF_ID_ACBM) { bufLen = (img->width * img->height + 7) / 8; - dmMsg(2, "IFF: Plane buffer size %d bytes.\n", bufLen); + dmMsg(2, "IFF: Plane buffer size %" DM_PRIu_SIZE_T " bytes.\n", + bufLen); } if (bufLen > 0 && (buf = dmMalloc(bufLen)) == NULL) @@ -2894,7 +2900,8 @@ else bufLen = img->width * spec->scaleX; - dmMsg(2, "IFF: Line/plane row size %d bytes.\n", bufLen); + dmMsg(2, "IFF: Line/plane row size %" DM_PRIu_SIZE_T " bytes.\n", + bufLen); if ((buf = dmMalloc(bufLen)) == NULL) return DMERR_MALLOC; diff -r 43e39d9ec42f -r 36edd316184a tools/objlink.c --- a/tools/objlink.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/objlink.c Thu Jan 09 15:20:23 2020 +0200 @@ -475,8 +475,10 @@ return FALSE; cropLen = optCropEnd - optCropStart + 1; - dmMsg(1, "Cutting output to $%.4x - $%.4x ($%x, %d bytes)\n", - optCropStart, optCropEnd, cropLen, cropLen); + dmMsg(1, "Cutting output to $%.4x - $%.4x " + "($%" DM_PRIx_SIZE_T ", %" DM_PRIu_SIZE_T " bytes)\n", + optCropStart, optCropEnd, + cropLen, cropLen); optCropOutput = TRUE; } @@ -496,7 +498,7 @@ if (tmpi >= 64*1024) { dmErrorMsg("Invalid or insane loading address %d/$%x!\n", - tmpi); + tmpi, tmpi); return FALSE; } optLoadAddress = tmpi; diff -r 43e39d9ec42f -r 36edd316184a tools/packed.c --- a/tools/packed.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/packed.c Thu Jan 09 15:20:23 2020 +0200 @@ -236,7 +236,7 @@ hdr.dirOffset += node->length; } - dmMsg(1, "%d entries in PACK, dir at offset 0x%08x.\n", + dmMsg(1, "%d entries in PACK, dir at offset 0x%08" DM_PRIx_SIZE_T ".\n", hdr.dirEntries, hdr.dirOffset); // Write PACK header @@ -756,7 +756,7 @@ if (match) { - dmPrint(0, "%-32s | %8d | %8d | %08x | %04x\n", + dmPrint(0, "%-32s | %8d | %8d | %08" DM_PRIx_SIZE_T " | %04x\n", node->filename, node->size, node->length, node->offset, node->flags); } @@ -809,7 +809,7 @@ node->privFlags |= PACK_EXTRACTED; // Print one entry - dmPrint(0, "Extracting: %-32s [siz=%d, cmp=%d, offs=0x%08x, flags=0x%04x]\n", + dmPrint(0, "Extracting: %-32s [siz=%d, cmp=%d, offs=0x%08" DM_PRIx_SIZE_T ", flags=0x%04x]\n", node->filename, node->size, node->length, node->offset, node->flags); diff -r 43e39d9ec42f -r 36edd316184a tools/xm2jss.c --- a/tools/xm2jss.c Thu Jan 09 14:55:41 2020 +0200 +++ b/tools/xm2jss.c Thu Jan 09 15:20:23 2020 +0200 @@ -598,7 +598,8 @@ } totalSize = sizeof(jssH); - dmMsg(1," * JSSMOD-header 0x%04x, %d bytes.\n", JSSMOD_VERSION, totalSize); + dmMsg(1," * JSSMOD-header 0x%04x, %" DM_PRIu_SIZE_T " bytes.\n", + JSSMOD_VERSION, totalSize); // Write orders list for (totalSize = index = 0; index < module->norders; index++) @@ -622,7 +623,7 @@ totalSize += sizeof(Uint16); } - dmMsg(1," * %d item orders list, %d bytes.\n", + dmMsg(1," * %d item orders list, %" DM_PRIu_SIZE_T " bytes.\n", module->norders, totalSize); // Allocate pattern compression buffer @@ -685,7 +686,9 @@ pattern); } - dmMsg(3, " - Pattern %d size %d bytes\n", index, dataSize); + dmMsg(3, " - Pattern %d size %" DM_PRIu_SIZE_T " bytes\n", + index, dataSize); + totalSize += dataSize + sizeof(JSSMODPattern); if (!dm_fwrite_le32(outFile, dataSize) || @@ -717,7 +720,7 @@ } dmFree(patBuf); - dmMsg(1," * %d patterns, %d bytes.\n", + dmMsg(1," * %d patterns, %" DM_PRIu_SIZE_T " bytes.\n", module->npatterns, totalSize); // Write extended instruments @@ -765,7 +768,7 @@ totalSize += sizeof(JSSMODExtInstrument); } - dmMsg(1," * %d Extended Instruments, %d bytes.\n", + dmMsg(1," * %d Extended Instruments, %" DM_PRIu_SIZE_T " bytes.\n", module->nextInstruments, totalSize); // Write sample instrument headers @@ -805,7 +808,7 @@ index); } - dmMsg(1," * %d Instrument headers, %d bytes.\n", + dmMsg(1," * %d Instrument headers, %" DM_PRIu_SIZE_T " bytes.\n", module->ninstruments, totalSize); // Write sample data @@ -844,7 +847,7 @@ } } - dmMsg(1," * %d samples, %d bytes.\n", + dmMsg(1," * %d samples, %" DM_PRIu_SIZE_T " bytes.\n", module->ninstruments, totalSize); return DMERR_OK; @@ -1024,7 +1027,7 @@ else { dmErrorMsg("Ext.instrument #%d sNumForNotes[%d] value out range (%d < %d).\n", - i + 1, m->ninstruments, q + 1); + i + 1, note, m->ninstruments, q + 1); } } }