comparison tools/libgfx.c @ 2384:36edd316184a

Fix some format strings to use proper PRI*_SIZE_T where necessary.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jan 2020 15:20:23 +0200
parents 82cb32297ed2
children 85700c9b7dc8
comparison
equal deleted inserted replaced
2383:43e39d9ec42f 2384:36edd316184a
1619 // TODO XXX this is also bogus 1619 // TODO XXX this is also bogus
1620 pcx.bufLen = hdr.bpl * 4; 1620 pcx.bufLen = hdr.bpl * 4;
1621 if ((pcx.buf = dmMalloc(pcx.bufLen)) == NULL) 1621 if ((pcx.buf = dmMalloc(pcx.bufLen)) == NULL)
1622 { 1622 {
1623 res = dmError(DMERR_MALLOC, 1623 res = dmError(DMERR_MALLOC,
1624 "PCX: Could not allocate %d bytes for RLE compression buffer.\n", 1624 "PCX: Could not allocate %" DM_PRIu_SIZE_T
1625 " bytes for RLE compression buffer.\n",
1625 pcx.bufLen); 1626 pcx.bufLen);
1626 goto error; 1627 goto error;
1627 } 1628 }
1628 1629
1629 // Write PCX header 1630 // Write PCX header
1853 "PCX: Could not allocate RLE buffer.\n"); 1854 "PCX: Could not allocate RLE buffer.\n");
1854 goto error; 1855 goto error;
1855 } 1856 }
1856 1857
1857 dmMsg(2, 1858 dmMsg(2,
1858 "PCX: bufLen=%d\n", 1859 "PCX: bufLen=%" DM_PRIu_SIZE_T "\n",
1859 pcx.bufLen); 1860 pcx.bufLen);
1860 1861
1861 // Read image data 1862 // Read image data
1862 Uint8 *dp = img->data; 1863 Uint8 *dp = img->data;
1863 for (int yc = 0; yc < img->height; yc++) 1864 for (int yc = 0; yc < img->height; yc++)
2099 off_t read = dmftell(fp) - chunk->offs, 2100 off_t read = dmftell(fp) - chunk->offs,
2100 size = chunk->size; 2101 size = chunk->size;
2101 2102
2102 if (size & 1) 2103 if (size & 1)
2103 { 2104 {
2104 dmMsg(3, "IFF: Chunk size %d is uneven, adjusting to %d.\n", 2105 dmMsg(3, "IFF: Chunk size %" DM_PRIu_SIZE_T
2106 " is uneven, adjusting to %" DM_PRIu_SIZE_T ".\n",
2105 size, size + 1); 2107 size, size + 1);
2106 size++; 2108 size++;
2107 } 2109 }
2108 2110
2109 if (size > read) 2111 if (size > read)
2110 { 2112 {
2111 dmMsg(3, "IFF: Skipping %d bytes (%d of %d consumed)\n", 2113 dmMsg(3, "IFF: Skipping %" DM_PRIu_SIZE_T
2114 " bytes (%" DM_PRIu_SIZE_T
2115 " of %" DM_PRIu_SIZE_T " consumed)\n",
2112 size - read, read, size); 2116 size - read, read, size);
2113 2117
2114 if (dmfseek(fp, size - read, SEEK_CUR) != 0) 2118 if (dmfseek(fp, size - read, SEEK_CUR) != 0)
2115 { 2119 {
2116 return dmError(DMERR_FSEEK, 2120 return dmError(DMERR_FSEEK,
2210 const int nplanes = iff->bmhd.nplanes; 2214 const int nplanes = iff->bmhd.nplanes;
2211 2215
2212 if (iff->idsig == IFF_ID_ILBM) 2216 if (iff->idsig == IFF_ID_ILBM)
2213 { 2217 {
2214 bufLen = ((img->width + 15) / 16) * 2; 2218 bufLen = ((img->width + 15) / 16) * 2;
2215 dmMsg(2, "IFF: Line / plane row size %d bytes.\n", bufLen); 2219 dmMsg(2, "IFF: Line / plane row size %" DM_PRIu_SIZE_T " bytes.\n",
2220 bufLen);
2216 2221
2217 } 2222 }
2218 else 2223 else
2219 if (iff->idsig == IFF_ID_ACBM) 2224 if (iff->idsig == IFF_ID_ACBM)
2220 { 2225 {
2221 bufLen = (img->width * img->height + 7) / 8; 2226 bufLen = (img->width * img->height + 7) / 8;
2222 dmMsg(2, "IFF: Plane buffer size %d bytes.\n", bufLen); 2227 dmMsg(2, "IFF: Plane buffer size %" DM_PRIu_SIZE_T " bytes.\n",
2228 bufLen);
2223 } 2229 }
2224 2230
2225 if (bufLen > 0 && (buf = dmMalloc(bufLen)) == NULL) 2231 if (bufLen > 0 && (buf = dmMalloc(bufLen)) == NULL)
2226 return DMERR_MALLOC; 2232 return DMERR_MALLOC;
2227 2233
2892 if (iff.idsig == IFF_ID_ACBM) 2898 if (iff.idsig == IFF_ID_ACBM)
2893 bufLen = (img->width * spec->scaleX * img->height * spec->scaleY + 7) / 8; 2899 bufLen = (img->width * spec->scaleX * img->height * spec->scaleY + 7) / 8;
2894 else 2900 else
2895 bufLen = img->width * spec->scaleX; 2901 bufLen = img->width * spec->scaleX;
2896 2902
2897 dmMsg(2, "IFF: Line/plane row size %d bytes.\n", bufLen); 2903 dmMsg(2, "IFF: Line/plane row size %" DM_PRIu_SIZE_T " bytes.\n",
2904 bufLen);
2898 2905
2899 if ((buf = dmMalloc(bufLen)) == NULL) 2906 if ((buf = dmMalloc(bufLen)) == NULL)
2900 return DMERR_MALLOC; 2907 return DMERR_MALLOC;
2901 2908
2902 // Encode the body 2909 // Encode the body