diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-26 05:51:46 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-26 05:51:46 +0300 |
commit | 6fc7b37583a2fa0815ae50b8c604f823d863cab1 (patch) | |
tree | bbb02a7a513e43a634739c93904f5b23ad913ae0 /source/blender/imbuf | |
parent | a3e1a9e2aace26a71c2698cd96ce4086db25e94d (diff) |
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 3 | ||||
-rw-r--r-- | source/blender/imbuf/intern/readimage.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/tiff.c | 7 |
3 files changed, 5 insertions, 9 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 967cbd04813..af9b62f1a74 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -178,7 +178,6 @@ ImBuf *imb_bmp_decode(const uchar *mem, size_t size, int flags, char colorspace[ const char(*palette)[4] = (const char(*)[4])(mem + palette_offset); const int startmask = ((1 << depth) - 1) << 8; for (size_t i = y; i > 0; i--) { - int index; int bitoffs = 8; int bitmask = startmask; int nbytes = 0; @@ -189,7 +188,7 @@ ImBuf *imb_bmp_decode(const uchar *mem, size_t size, int flags, char colorspace[ for (size_t j = x; j > 0; j--) { bitoffs -= depth; bitmask >>= depth; - index = (bmp[0] & bitmask) >> bitoffs; + const int index = (bmp[0] & bitmask) >> bitoffs; pcol = palette[index]; /* intentionally BGR -> RGB */ rect[0] = pcol[2]; diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 4b433836767..b33e9dc4e0e 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -209,7 +209,7 @@ static void imb_cache_filename(char *filepath, const char *name, int flags) ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]) { ImBuf *ibuf; - int file, a; + int file; char filepath_tx[IMB_FILENAME_SIZE]; BLI_assert(!BLI_path_is_rel(filepath)); @@ -226,7 +226,7 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_S if (ibuf) { BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name)); BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename)); - for (a = 1; a < ibuf->miptot; a++) { + for (int a = 1; a < ibuf->miptot; a++) { BLI_strncpy(ibuf->mipmap[a - 1]->cachename, filepath_tx, sizeof(ibuf->cachename)); } } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index dae6ef49c6d..1989566fc32 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -549,10 +549,8 @@ ImBuf *imb_loadtiff(const unsigned char *mem, ImbTIFFMemFile memFile; uint32_t width, height; char *format = NULL; - int level; short spp; int ib_depth; - int found; /* Check whether or not we have a TIFF file. */ if (imb_is_a_tiff(mem, size) == 0) { @@ -592,8 +590,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem, if (flags & IB_alphamode_detect) { if (spp == 4) { unsigned short extra, *extraSampleTypes; - - found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); + const int found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); if (found && (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA)) { ibuf->flags |= IB_alphamode_premul; @@ -617,7 +614,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem, int numlevel = TIFFNumberOfDirectories(image); /* create empty mipmap levels in advance */ - for (level = 0; level < numlevel; level++) { + for (int level = 0; level < numlevel; level++) { if (!TIFFSetDirectory(image, level)) { break; } |