# HG changeset patch # User Matti Hamalainen # Date 1526467780 -10800 # Node ID 009a3e3c54bf56fce3fcb530ad61ad4d62a87769 # Parent 9aaa8ee2462683476e13614c4733042ecd1bd347 Cleanups. diff -r 9aaa8ee24626 -r 009a3e3c54bf tools/libgfx.c --- a/tools/libgfx.c Wed May 16 13:42:40 2018 +0300 +++ b/tools/libgfx.c Wed May 16 13:49:40 2018 +0300 @@ -299,7 +299,7 @@ int dmWriteRAWImageFILE(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) { - int xc, yc, plane, res; + int res; DMBitStreamContext bs; if ((res = dmInitBitStreamFILE(&bs, fp)) != DMERR_OK) @@ -309,11 +309,11 @@ { // Output bitplanes in planar format // (each plane of line sequentially) - for (yc = 0; yc < img->height; yc++) - for (plane = 0; plane < spec->nplanes; plane++) + for (int yc = 0; yc < img->height; yc++) + for (int plane = 0; plane < spec->nplanes; plane++) { Uint8 *sp = img->data + yc * img->pitch; - for (xc = 0; xc < img->width; xc++) + for (int xc = 0; xc < img->width; xc++) { if (!dmPutBits(&bs, (sp[xc] & (1 << plane)) ? 1 : 0, 1)) return DMERR_FWRITE; @@ -323,11 +323,11 @@ else { // Output each bitplane in sequence - for (plane = 0; plane < spec->nplanes; plane++) - for (yc = 0; yc < img->height; yc++) + for (int plane = 0; plane < spec->nplanes; plane++) + for (int yc = 0; yc < img->height; yc++) { Uint8 *sp = img->data + yc * img->pitch; - for (xc = 0; xc < img->width; xc++) + for (int xc = 0; xc < img->width; xc++) { if (!dmPutBits(&bs, (sp[xc] & (1 << plane)) ? 1 : 0, 1)) return DMERR_FWRITE; @@ -1601,7 +1601,7 @@ } -static inline Uint8 dmDecodeBit(const Uint8 *src, const int xc) +static inline Uint8 dmDecodeBit(const Uint8 *buf, const int xc) { return (buf[xc / 8] >> (7 - (xc & 7))) & 1; }