From be7855591e3b47e5e72c09555946f75975a8c028 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Mar 2022 11:58:22 +1100 Subject: Cleanup: rename cnt to count Follow naming from T85728. --- source/blender/imbuf/intern/dds/Stream.cpp | 14 +++++++------- source/blender/imbuf/intern/dds/Stream.h | 2 +- source/blender/imbuf/intern/indexer.c | 6 +++--- source/blender/imbuf/intern/iris.c | 6 +++--- source/blender/imbuf/intern/radiance_hdr.c | 20 ++++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp index bc7239dbd1b..34f3654aa3f 100644 --- a/source/blender/imbuf/intern/dds/Stream.cpp +++ b/source/blender/imbuf/intern/dds/Stream.cpp @@ -12,14 +12,14 @@ static const char *msg_error_seek = "DDS: trying to seek beyond end of stream (corrupt file?)"; static const char *msg_error_read = "DDS: trying to read beyond end of stream (corrupt file?)"; -inline bool is_read_within_bounds(const Stream &mem, unsigned int cnt) +inline bool is_read_within_bounds(const Stream &mem, unsigned int count) { if (mem.pos >= mem.size) { /* No more data remained in the memory buffer. */ return false; } - if (cnt > mem.size - mem.pos) { + if (count > mem.size - mem.pos) { /* Reading past the memory bounds. */ return false; } @@ -83,15 +83,15 @@ unsigned int mem_read(Stream &mem, unsigned char &i) return 1; } -unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int cnt) +unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int count) { - if (!is_read_within_bounds(mem, cnt)) { + if (!is_read_within_bounds(mem, count)) { mem.set_failed(msg_error_read); return 0; } - memcpy(i, mem.mem + mem.pos, cnt); - mem.pos += cnt; - return cnt; + memcpy(i, mem.mem + mem.pos, count); + mem.pos += count; + return count; } void Stream::set_failed(const char *msg) diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h index 3e17b143629..d90440f47cd 100644 --- a/source/blender/imbuf/intern/dds/Stream.h +++ b/source/blender/imbuf/intern/dds/Stream.h @@ -24,4 +24,4 @@ unsigned int mem_read(Stream &mem, unsigned long long &i); unsigned int mem_read(Stream &mem, unsigned int &i); unsigned int mem_read(Stream &mem, unsigned short &i); unsigned int mem_read(Stream &mem, unsigned char &i); -unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int cnt); +unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int count); diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index c1e00642a6d..84bed479577 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1314,14 +1314,14 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context, short *do_update, float *progress) { - int cnt = IMB_anim_get_duration(context->anim, IMB_TC_NONE); + int count = IMB_anim_get_duration(context->anim, IMB_TC_NONE); int i, pos; struct anim *anim = context->anim; - for (pos = 0; pos < cnt; pos++) { + for (pos = 0; pos < count; pos++) { struct ImBuf *ibuf = IMB_anim_absolute(anim, pos, IMB_TC_NONE, IMB_PROXY_NONE); struct ImBuf *tmp_ibuf = IMB_dupImBuf(ibuf); - float next_progress = (float)pos / (float)cnt; + float next_progress = (float)pos / (float)count; if (*progress != next_progress) { *progress = next_progress; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 86321d6432c..eb0a2c4a47f 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -105,7 +105,7 @@ static int expandrow2( float *optr, const float *optr_end, const uchar *iptr, const uchar *iptr_end, int z); static void interleaverow(uchar *lptr, const uchar *cptr, int z, int n); static void interleaverow2(float *lptr, const uchar *cptr, int z, int n); -static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int cnt); +static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int row_len); static void lumrow(const uchar *rgbptr, uchar *lumptr, int n); /* @@ -892,7 +892,7 @@ static void lumrow(const uchar *rgbptr, uchar *lumptr, int n) } } -static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int cnt) +static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int row_len) { uchar *iptr, *ibufend, *sptr, *optr; short todo, cc; @@ -900,7 +900,7 @@ static int compressrow(uchar *lbuf, uchar *rlebuf, int z, int cnt) lbuf += z; iptr = lbuf; - ibufend = iptr + cnt * 4; + ibufend = iptr + row_len * 4; optr = rlebuf; while (iptr < ibufend) { diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 3786f1c5754..aa07edf5c3a 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -308,7 +308,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, static int fwritecolrs( FILE *file, int width, int channels, const unsigned char *ibufscan, const float *fpscan) { - int beg, c2, cnt = 0; + int beg, c2, count = 0; fCOLOR fcol; RGBE rgbe, *rgbe_scan; @@ -347,14 +347,14 @@ static int fwritecolrs( putc((unsigned char)(width & 255), file); /* put components separately */ for (size_t i = 0; i < 4; i++) { - for (size_t j = 0; j < width; j += cnt) { /* find next run */ - for (beg = j; beg < width; beg += cnt) { - for (cnt = 1; (cnt < 127) && ((beg + cnt) < width) && - (rgbe_scan[beg + cnt][i] == rgbe_scan[beg][i]); - cnt++) { + for (size_t j = 0; j < width; j += count) { /* find next run */ + for (beg = j; beg < width; beg += count) { + for (count = 1; (count < 127) && ((beg + count) < width) && + (rgbe_scan[beg + count][i] == rgbe_scan[beg][i]); + count++) { /* pass */ } - if (cnt >= MINRUN) { + if (count >= MINRUN) { break; /* long enough */ } } @@ -378,12 +378,12 @@ static int fwritecolrs( putc(rgbe_scan[j++][i], file); } } - if (cnt >= MINRUN) { /* write out run */ - putc((unsigned char)(128 + cnt), file); + if (count >= MINRUN) { /* write out run */ + putc((unsigned char)(128 + count), file); putc(rgbe_scan[beg][i], file); } else { - cnt = 0; + count = 0; } } } -- cgit v1.2.3