Cleanup: rename cnt to count

Follow naming from T85728.
This commit is contained in:
Campbell Barton 2022-03-16 11:58:22 +11:00
parent 379bd6d50c
commit be7855591e
17 changed files with 78 additions and 78 deletions

View File

@ -270,7 +270,7 @@ bool Scene::initialize()
m_ytask.resize(m_ncTotal);
bool toggle = true;
int cnt = 0;
int count = 0;
// Initialize all ConstraintSets:
for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) {
// Calculate the external pose:
@ -279,8 +279,8 @@ bool Scene::initialize()
getConstraintPose(cs->task, cs, external_pose);
result &= cs->task->initialise(external_pose);
cs->task->initCache(m_cache);
for (int i = 0; i < cs->constraintrange.count; i++, cnt++) {
m_ytask[cnt] = toggle;
for (int i = 0; i < cs->constraintrange.count; i++, count++) {
m_ytask[count] = toggle;
}
toggle = !toggle;
project(m_Cf, cs->constraintrange, cs->featurerange) = cs->task->getCf();

View File

@ -739,13 +739,13 @@ file_format_data = '$CACHE_DATA_FORMAT$'\n\
file_format_mesh = '$CACHE_MESH_FORMAT$'\n\
\n\
# How many frame to load from cache\n\
from_cache_cnt = 100\n\
from_cache_count = 100\n\
\n\
loop_cnt = 0\n\
loop_count = 0\n\
while current_frame_s$ID$ <= end_frame_s$ID$:\n\
\n\
# Load already simulated data from cache:\n\
if loop_cnt < from_cache_cnt:\n\
if loop_count < from_cache_count:\n\
load_data(current_frame_s$ID$, cache_resumable)\n\
\n\
# Otherwise simulate new data\n\
@ -756,7 +756,7 @@ while current_frame_s$ID$ <= end_frame_s$ID$:\n\
step(current_frame_s$ID$)\n\
\n\
current_frame_s$ID$ += 1\n\
loop_cnt += 1\n\
loop_count += 1\n\
\n\
if gui:\n\
gui.pause()\n";

View File

@ -1754,7 +1754,7 @@ static void update_distances(int index,
/* Count ray mesh misses (i.e. no face hit) and cases where the ray direction matches the face
* normal direction. From this information it can be derived whether a cell is inside or
* outside the mesh. */
int miss_cnt = 0, dir_cnt = 0;
int miss_count = 0, dir_count = 0;
for (int i = 0; i < ARRAY_SIZE(ray_dirs); i++) {
BVHTreeRayHit hit_tree = {0};
@ -1773,14 +1773,14 @@ static void update_distances(int index,
/* Ray did not hit mesh.
* Current point definitely not inside mesh. Inside mesh as all rays have to hit. */
if (hit_tree.index == -1) {
miss_cnt++;
miss_count++;
/* Skip this ray since nothing was hit. */
continue;
}
/* Ray and normal are pointing in opposite directions. */
if (dot_v3v3(ray_dirs[i], hit_tree.no) <= 0) {
dir_cnt++;
dir_count++;
}
if (hit_tree.dist < min_dist) {
@ -1790,7 +1790,7 @@ static void update_distances(int index,
/* Point lies inside mesh. Use negative sign for distance value.
* This "if statement" has 2 conditions that can be true for points outside mesh. */
if (!(miss_cnt > 0 || dir_cnt == ARRAY_SIZE(ray_dirs))) {
if (!(miss_count > 0 || dir_count == ARRAY_SIZE(ray_dirs))) {
min_dist = (-1.0f) * fabsf(min_dist);
}

View File

@ -423,7 +423,7 @@ template<typename T> std::ostream &operator<<(std::ostream &os, const CDT_state<
os << " merge to " << vertname(cdt_state.cdt.verts[v->merge_to_index]) << "\n";
}
const SymEdge<T> *se = v->symedge;
int cnt = 0;
int count = 0;
constexpr int print_count_limit = 25;
if (se) {
os << " edges out:\n";
@ -440,8 +440,8 @@ template<typename T> std::ostream &operator<<(std::ostream &os, const CDT_state<
os << " " << vertname(vother) << "(e=" << trunc_ptr(se->edge)
<< ", se=" << trunc_ptr(se) << ")\n";
se = se->rot;
cnt++;
} while (se != v->symedge && cnt < print_count_limit);
count++;
} while (se != v->symedge && count < print_count_limit);
os << "\n";
}
}

View File

@ -829,18 +829,18 @@ static bool parse_unary(ExprParseState *state)
/* Specially supported functions. */
if (STREQ(state->tokenbuf, "min")) {
int cnt = parse_function_args(state);
CHECK_ERROR(cnt > 0);
int count = parse_function_args(state);
CHECK_ERROR(count > 0);
parse_add_op(state, OPCODE_MIN, 1 - cnt)->arg.ival = cnt;
parse_add_op(state, OPCODE_MIN, 1 - count)->arg.ival = count;
return true;
}
if (STREQ(state->tokenbuf, "max")) {
int cnt = parse_function_args(state);
CHECK_ERROR(cnt > 0);
int count = parse_function_args(state);
CHECK_ERROR(count > 0);
parse_add_op(state, OPCODE_MAX, 1 - cnt)->arg.ival = cnt;
parse_add_op(state, OPCODE_MAX, 1 - count)->arg.ival = count;
return true;
}

View File

@ -571,7 +571,7 @@ static EdgeHalf *next_bev(BevVert *bv, EdgeHalf *from_e)
/* Return the count of edges between e1 and e2 when going around bv CCW. */
static int count_ccw_edges_between(EdgeHalf *e1, EdgeHalf *e2)
{
int cnt = 0;
int count = 0;
EdgeHalf *e = e1;
do {
@ -579,9 +579,9 @@ static int count_ccw_edges_between(EdgeHalf *e1, EdgeHalf *e2)
break;
}
e = e->next;
cnt++;
count++;
} while (e != e1);
return cnt;
return count;
}
/* Assume bme1 and bme2 both share some vert. Do they share a face?

View File

@ -792,7 +792,7 @@ static int paint_space_stroke(bContext *C,
Paint *paint = BKE_paint_get_active_from_context(C);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
int cnt = 0;
int count = 0;
const bool use_scene_spacing = paint_stroke_use_scene_spacing(brush, mode);
float d_world_space_position[3] = {0.0f};
@ -855,14 +855,14 @@ static int paint_space_stroke(bContext *C,
pressure = stroke->last_pressure;
dpressure = final_pressure - stroke->last_pressure;
cnt++;
count++;
}
else {
break;
}
}
return cnt;
return count;
}
/**** Public API ****/

View File

@ -430,8 +430,8 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
int nSamples = 0;
vector<WFace *> wFaces;
WFace *wFace = nullptr;
unsigned cnt = 0;
unsigned cntStep = (unsigned)ceil(0.01f * vedges.size());
unsigned count = 0;
unsigned count_step = (unsigned)ceil(0.01f * vedges.size());
unsigned tmpQI = 0;
unsigned qiClasses[256];
unsigned maxIndex, maxCard;
@ -441,13 +441,13 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
if (iRenderMonitor->testBreak()) {
break;
}
if (cnt % cntStep == 0) {
if (count % count_step == 0) {
stringstream ss;
ss << "Freestyle: Visibility computations " << (100 * cnt / vedges.size()) << "%";
ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%";
iRenderMonitor->setInfo(ss.str());
iRenderMonitor->progress((float)cnt / vedges.size());
iRenderMonitor->progress((float)count / vedges.size());
}
cnt++;
count++;
}
#if LOGGING
if (_global.debug & G_DEBUG_FREESTYLE) {
@ -621,9 +621,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
}
if (iRenderMonitor && !vedges.empty()) {
stringstream ss;
ss << "Freestyle: Visibility computations " << (100 * cnt / vedges.size()) << "%";
ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%";
iRenderMonitor->setInfo(ss.str());
iRenderMonitor->progress((float)cnt / vedges.size());
iRenderMonitor->progress((float)count / vedges.size());
}
}

View File

@ -1512,17 +1512,17 @@ static IK_Scene *convert_tree(
iktarget->bldepsgraph = depsgraph;
condata = (bKinematicConstraint *)iktarget->blenderConstraint->data;
pchan = tree->pchan[iktarget->channel];
unsigned int controltype, bonecnt;
double bonelen;
unsigned int controltype, bone_count;
double bone_length;
float mat[4][4];
/* add the end effector
* estimate the average bone length, used to clamp feedback error */
for (bonecnt = 0, bonelen = 0.0f, a = iktarget->channel; a >= 0;
a = tree->parent[a], bonecnt++) {
bonelen += ikscene->blScale * tree->pchan[a]->bone->length;
for (bone_count = 0, bone_length = 0.0f, a = iktarget->channel; a >= 0;
a = tree->parent[a], bone_count++) {
bone_length += ikscene->blScale * tree->pchan[a]->bone->length;
}
bonelen /= bonecnt;
bone_length /= bone_count;
/* store the rest pose of the end effector to compute enforce target */
copy_m4_m4(mat, pchan->bone->arm_mat);
@ -1567,7 +1567,7 @@ static IK_Scene *convert_tree(
}
}
if (controltype) {
iktarget->constraint = new iTaSC::CopyPose(controltype, controltype, bonelen);
iktarget->constraint = new iTaSC::CopyPose(controltype, controltype, bone_length);
/* set the gain */
if (controltype & iTaSC::CopyPose::CTL_POSITION) {
iktarget->constraint->setControlParameter(
@ -1599,7 +1599,7 @@ static IK_Scene *convert_tree(
}
break;
case CONSTRAINT_IK_DISTANCE:
iktarget->constraint = new iTaSC::Distance(bonelen);
iktarget->constraint = new iTaSC::Distance(bone_length);
iktarget->constraint->setControlParameter(
iTaSC::Distance::ID_DISTANCE, iTaSC::ACT_VALUE, condata->dist);
iktarget->constraint->registerCallback(distance_callback, iktarget);

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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;
}
}
}

View File

@ -61,7 +61,7 @@ static void get_uvs(const CDStreamConfig &config,
MLoop *mloop = config.mloop;
if (!config.pack_uvs) {
int cnt = 0;
int count = 0;
uvidx.resize(config.totloop);
uvs.resize(config.totloop);
@ -70,12 +70,12 @@ static void get_uvs(const CDStreamConfig &config,
MPoly &current_poly = polygons[i];
MLoopUV *loopuv = mloopuv_array + current_poly.loopstart + current_poly.totloop;
for (int j = 0; j < current_poly.totloop; j++, cnt++) {
for (int j = 0; j < current_poly.totloop; j++, count++) {
loopuv--;
uvidx[cnt] = cnt;
uvs[cnt][0] = loopuv->uv[0];
uvs[cnt][1] = loopuv->uv[1];
uvidx[count] = count;
uvs[count][0] = loopuv->uv[0];
uvs[count][1] = loopuv->uv[1];
}
}
}

View File

@ -525,14 +525,14 @@ static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo)
return true;
}
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skip_count)
{
if (dinfo->src->bytes_in_buffer < skipcnt) {
skipcnt = dinfo->src->bytes_in_buffer;
if (dinfo->src->bytes_in_buffer < skip_count) {
skip_count = dinfo->src->bytes_in_buffer;
}
dinfo->src->next_input_byte += skipcnt;
dinfo->src->bytes_in_buffer -= skipcnt;
dinfo->src->next_input_byte += skip_count;
dinfo->src->bytes_in_buffer -= skip_count;
}
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo)

View File

@ -3737,9 +3737,9 @@ int SEQ_effect_get_num_inputs(int seq_type)
{
struct SeqEffectHandle rval = get_sequence_effect_impl(seq_type);
int cnt = rval.num_inputs();
int count = rval.num_inputs();
if (rval.execute || (rval.execute_slice && rval.init_execution)) {
return cnt;
return count;
}
return 0;
}