Skip to content

Commit

Permalink
Rename variabls to avoid shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
LegalizeAdulthood committed Feb 18, 2024
1 parent 60351b4 commit d510ce0
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 67 deletions.
30 changes: 15 additions & 15 deletions common/miscovl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,9 @@ void make_batch_file()
}
PCommandName[w] = 0;
{
char buf[20];
std::snprintf(buf, NUM_OF(buf), "_%c%c", PAR_KEY(i), PAR_KEY(j));
std::strcat(PCommandName, buf);
char tmpbuff[20];
std::snprintf(tmpbuff, NUM_OF(tmpbuff), "_%c%c", PAR_KEY(i), PAR_KEY(j));
std::strcat(PCommandName, tmpbuff);
}
std::fprintf(parmfile, "%-19s{", PCommandName);
g_x_min = pxxmin + pdelx*(i*pxdots) + pdelx2*(j*pydots);
Expand Down Expand Up @@ -503,18 +503,18 @@ void make_batch_file()
/* guarantee that there are no blank comments above the last
non-blank par_comment */
int last = -1;
for (int i = 0; i < 4; i++)
for (int k = 0; k < 4; k++)
{
if (*par_comment[i])
if (*par_comment[k])
{
last = i;
last = k;
}
}
for (int i = 0; i < last; i++)
for (int k = 0; k < last; k++)
{
if (g_command_comment[i].empty())
if (g_command_comment[k].empty())
{
g_command_comment[i] = ";";
g_command_comment[k] = ";";
}
}
}
Expand All @@ -524,20 +524,20 @@ void make_batch_file()
}
fputc('\n', parmfile);
{
char buf[25];
std::memset(buf, ' ', 23);
buf[23] = 0;
buf[21] = ';';
char tmpbuff[25];
std::memset(tmpbuff, ' ', 23);
tmpbuff[23] = 0;
tmpbuff[21] = ';';
for (int k = 1; k < 4; k++)
{
if (!g_command_comment[k].empty())
{
std::fprintf(parmfile, "%s%s\n", buf, g_command_comment[k].c_str());
std::fprintf(parmfile, "%s%s\n", tmpbuff, g_command_comment[k].c_str());
}
}
if (g_patch_level != 0 && !colorsonly)
{
std::fprintf(parmfile, "%s %s Version %d Patchlevel %d\n", buf,
std::fprintf(parmfile, "%s %s Version %d Patchlevel %d\n", tmpbuff,
Fractint, g_release, g_patch_level);
}
}
Expand Down
18 changes: 9 additions & 9 deletions common/mpmath_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ long ExpFloat14(long xx)
}

static double TwoPi;
static DComplex temp;
static DComplex s_temp;
static DComplex BaseLog;
static DComplex cdegree = { 3.0, 0.0 };
static DComplex croot = { 1.0, 0.0 };
Expand Down Expand Up @@ -731,8 +731,8 @@ int ComplexNewton()
cd1.x = cdegree.x - 1.0;
cd1.y = cdegree.y;

temp = ComplexPower(g_old_z, cd1);
FPUcplxmul(&temp, &g_old_z, &g_new_z);
s_temp = ComplexPower(g_old_z, cd1);
FPUcplxmul(&s_temp, &g_old_z, &g_new_z);

g_tmp_z.x = g_new_z.x - croot.x;
g_tmp_z.y = g_new_z.y - croot.y;
Expand All @@ -745,7 +745,7 @@ int ComplexNewton()
g_tmp_z.x += croot.x;
g_tmp_z.y += croot.y;

FPUcplxmul(&temp, &cdegree, &cd1);
FPUcplxmul(&s_temp, &cdegree, &cd1);
FPUcplxdiv(&g_tmp_z, &cd1, &g_old_z);
if (g_overflow)
{
Expand All @@ -766,8 +766,8 @@ int ComplexBasin()
cd1.x = cdegree.x - 1.0;
cd1.y = cdegree.y;

temp = ComplexPower(g_old_z, cd1);
FPUcplxmul(&temp, &g_old_z, &g_new_z);
s_temp = ComplexPower(g_old_z, cd1);
FPUcplxmul(&s_temp, &g_old_z, &g_new_z);

g_tmp_z.x = g_new_z.x - croot.x;
g_tmp_z.y = g_new_z.y - croot.y;
Expand All @@ -777,8 +777,8 @@ int ComplexBasin()
{
g_old_z.y = 0.0;
}
FPUcplxlog(&g_old_z, &temp);
FPUcplxmul(&temp, &cdegree, &g_tmp_z);
FPUcplxlog(&g_old_z, &s_temp);
FPUcplxmul(&s_temp, &cdegree, &g_tmp_z);
double mod = g_tmp_z.y/TwoPi;
g_color_iter = (long)mod;
if (std::fabs(mod - g_color_iter) > 0.5)
Expand All @@ -804,7 +804,7 @@ int ComplexBasin()
g_tmp_z.x += croot.x;
g_tmp_z.y += croot.y;

FPUcplxmul(&temp, &cdegree, &cd1);
FPUcplxmul(&s_temp, &cdegree, &cd1);
FPUcplxdiv(&g_tmp_z, &cd1, &g_old_z);
if (g_overflow)
{
Expand Down
86 changes: 43 additions & 43 deletions common/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ bool g_is_mandelbrot = true;
unsigned int g_operation_index;
unsigned int g_variable_index;
unsigned int g_last_op;
static unsigned int n;
static unsigned int s_n;
static unsigned int NextOp;
static unsigned int InitN;
static int paren;
static bool ExpectingArg = false;
static bool s_expecting_arg{};
int InitLodPtr;
int InitStoPtr;
int InitOpPtr;
Expand Down Expand Up @@ -2681,15 +2681,15 @@ static bool ParseStr(char const *Str, int pass)
OpPtr = g_load_index;
paren = OpPtr;
g_last_init_op = paren;
ExpectingArg = true;
for (n = 0; Str[n]; n++)
s_expecting_arg = true;
for (s_n = 0; Str[s_n]; s_n++)
{
if (!Str[n])
if (!Str[s_n])
{
break;
}
InitN = n;
switch (Str[n])
InitN = s_n;
switch (Str[s_n])
{
case ' ':
case '\t':
Expand All @@ -2703,10 +2703,10 @@ static bool ParseStr(char const *Str, int pass)
paren--;
break;
case '|':
if (Str[n+1] == '|')
if (Str[s_n+1] == '|')
{
ExpectingArg = true;
n++;
s_expecting_arg = true;
s_n++;
o[g_operation_index].f = StkOR;
o[g_operation_index++].p = 7 - (paren + Equals)*15;
}
Expand All @@ -2725,9 +2725,9 @@ static bool ParseStr(char const *Str, int pass)
break;
case ',':
case ';':
if (!ExpectingArg)
if (!s_expecting_arg)
{
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = (void(*)())nullptr;
o[g_operation_index++].p = 15;
o[g_operation_index].f = StkClr;
Expand All @@ -2737,7 +2737,7 @@ static bool ParseStr(char const *Str, int pass)
}
break;
case ':':
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = (void(*)())nullptr;
o[g_operation_index++].p = 15;
o[g_operation_index].f = EndInit;
Expand All @@ -2747,12 +2747,12 @@ static bool ParseStr(char const *Str, int pass)
g_last_init_op = 10000;
break;
case '+':
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = StkAdd;
o[g_operation_index++].p = 4 - (paren + Equals)*15;
break;
case '-':
if (ExpectingArg)
if (s_expecting_arg)
{
o[g_operation_index].f = StkNeg;
o[g_operation_index++].p = 2 - (paren + Equals)*15;
Expand All @@ -2761,26 +2761,26 @@ static bool ParseStr(char const *Str, int pass)
{
o[g_operation_index].f = StkSub;
o[g_operation_index++].p = 4 - (paren + Equals)*15;
ExpectingArg = true;
s_expecting_arg = true;
}
break;
case '&':
ExpectingArg = true;
n++;
s_expecting_arg = true;
s_n++;
o[g_operation_index].f = StkAND;
o[g_operation_index++].p = 7 - (paren + Equals)*15;
break;
case '!':
ExpectingArg = true;
n++;
s_expecting_arg = true;
s_n++;
o[g_operation_index].f = StkNE;
o[g_operation_index++].p = 6 - (paren + Equals)*15;
break;
case '<':
ExpectingArg = true;
if (Str[n+1] == '=')
s_expecting_arg = true;
if (Str[s_n+1] == '=')
{
n++;
s_n++;
o[g_operation_index].f = StkLTE;
}
else
Expand All @@ -2790,10 +2790,10 @@ static bool ParseStr(char const *Str, int pass)
o[g_operation_index++].p = 6 - (paren + Equals)*15;
break;
case '>':
ExpectingArg = true;
if (Str[n+1] == '=')
s_expecting_arg = true;
if (Str[s_n+1] == '=')
{
n++;
s_n++;
o[g_operation_index].f = StkGTE;
}
else
Expand All @@ -2803,25 +2803,25 @@ static bool ParseStr(char const *Str, int pass)
o[g_operation_index++].p = 6 - (paren + Equals)*15;
break;
case '*':
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = StkMul;
o[g_operation_index++].p = 3 - (paren + Equals)*15;
break;
case '/':
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = StkDiv;
o[g_operation_index++].p = 3 - (paren + Equals)*15;
break;
case '^':
ExpectingArg = true;
s_expecting_arg = true;
o[g_operation_index].f = StkPwr;
o[g_operation_index++].p = 2 - (paren + Equals)*15;
break;
case '=':
ExpectingArg = true;
if (Str[n+1] == '=')
s_expecting_arg = true;
if (Str[s_n+1] == '=')
{
n++;
s_n++;
o[g_operation_index].f = StkEQ;
o[g_operation_index++].p = 6 - (paren + Equals)*15;
}
Expand All @@ -2834,26 +2834,26 @@ static bool ParseStr(char const *Str, int pass)
}
break;
default:
while (std::isalnum(Str[n+1]) || Str[n+1] == '.' || Str[n+1] == '_')
while (std::isalnum(Str[s_n+1]) || Str[s_n+1] == '.' || Str[s_n+1] == '_')
{
n++;
s_n++;
}
Len = (n+1)-InitN;
ExpectingArg = false;
Len = (s_n+1)-InitN;
s_expecting_arg = false;
jumptype = isjump(&Str[InitN], Len);
if (jumptype != 0)
{
uses_jump = true;
switch (jumptype)
{
case 1: // if
ExpectingArg = true;
s_expecting_arg = true;
jump_control[jump_index++].type = 1;
o[g_operation_index].f = StkJumpOnFalse;
o[g_operation_index++].p = 1;
break;
case 2: // elseif
ExpectingArg = true;
s_expecting_arg = true;
jump_control[jump_index++].type = 2;
jump_control[jump_index++].type = 2;
o[g_operation_index].f = StkJump;
Expand Down Expand Up @@ -2885,15 +2885,15 @@ static bool ParseStr(char const *Str, int pass)
if (o[g_operation_index].f != NotAFnct)
{
o[g_operation_index++].p = 1 - (paren + Equals)*15;
ExpectingArg = true;
s_expecting_arg = true;
}
else
{
c = isconst(&Str[InitN], Len);
Load[g_load_index++] = &(c->a);
o[g_operation_index].f = StkLod;
o[g_operation_index++].p = 1 - (paren + Equals)*15;
n = InitN + c->len - 1;
s_n = InitN + c->len - 1;
}
}
break;
Expand Down Expand Up @@ -3821,11 +3821,11 @@ static bool frmgettoken(std::FILE * openfile, token_st * this_token)
this_token->token_str[i] = (char) 0;
if (this_token->token_type == OPERATOR)
{
for (int i = 0; i < sizeof(OPList)/sizeof(OPList[0]); i++)
for (int j = 0; j < sizeof(OPList)/sizeof(OPList[0]); j++)
{
if (!std::strcmp(OPList[i], this_token->token_str))
if (!std::strcmp(OPList[j], this_token->token_str))
{
this_token->token_id = i;
this_token->token_id = j;
}
}
}
Expand Down

0 comments on commit d510ce0

Please sign in to comment.