mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-21 06:30:41 +00:00
Address issues in samples detected by new lint checks.
The only actual behavior change is in Ackermann.cc, which previously reported incorrectly high recursion depths for some calculations.
This commit is contained in:
parent
ab975b611c
commit
986fe9a65b
@ -1047,8 +1047,7 @@ printf ("%c%d ", (char) (move % 10 - 1 + 'A'), 9 - move / 10);
|
||||
****************************************************************/
|
||||
void DrawMoves (void)
|
||||
{
|
||||
GrafPortPtr port, p2; /* graphics ports */
|
||||
CtlRecHndl ctl; /* for finding scroll bar */
|
||||
GrafPortPtr port; /* graphics port */
|
||||
Rect r; /* rectangle for drawing colors */
|
||||
int i, n; /* index variables */
|
||||
|
||||
@ -1437,7 +1436,7 @@ if ((part > 4) && (part < 9)) { /* if the part is not the slide switch... */
|
||||
if ( ((Even(topMove) + movesInWindow + 1) / 2) >
|
||||
(Even(movesMade) + 1) / 2 ) {
|
||||
topMove = Even (movesMade) - movesInWindow;
|
||||
if (! (topMove >> 16) & 0x0001)
|
||||
if (! (topMove >> 15) & 0x0001)
|
||||
topMove++;
|
||||
}
|
||||
}
|
||||
@ -1451,7 +1450,7 @@ if ((part > 4) && (part < 9)) { /* if the part is not the slide switch... */
|
||||
|
||||
else if (part == 129) { /* reposition based on new thumb loc. */
|
||||
topMove = GetCtlValue (vScrollHandle) * 2 / charHeight +1;
|
||||
if (! (topMove >> 16) & 0x0001)
|
||||
if (! (topMove >> 15) & 0x0001)
|
||||
topMove++;
|
||||
updateMoves = true;
|
||||
DrawMoves ();
|
||||
|
@ -23,7 +23,6 @@ int main (void)
|
||||
{
|
||||
float r, theta, rot;
|
||||
int color = 1;
|
||||
int stopFlag;
|
||||
Rect rect;
|
||||
|
||||
GetPortRect(&rect);
|
||||
|
@ -38,6 +38,8 @@ int a, m, n, depth, maxdepth;
|
||||
int Ackermann (int m, int n)
|
||||
|
||||
{
|
||||
int result;
|
||||
|
||||
depth++;
|
||||
if (depth > maxdepth)
|
||||
maxdepth = depth;
|
||||
@ -45,8 +47,9 @@ if (m == 0)
|
||||
return (n + 1);
|
||||
if (n == 0)
|
||||
return (Ackermann (m-1, 1));
|
||||
return (Ackermann (m-1, Ackermann (m, n-1)));
|
||||
result = Ackermann (m-1, Ackermann (m, n-1));
|
||||
depth--;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,9 @@ static void BadFunction (void)
|
||||
|
||||
{
|
||||
char ch [8000]; /* this array is too large for */
|
||||
} /* the default run-time stack */
|
||||
/* the default run-time stack */
|
||||
(void)ch; /* dummy use of ch to avoid lint msg */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************
|
||||
|
@ -32,7 +32,9 @@
|
||||
static void Fail (void)
|
||||
{
|
||||
char ch [8000]; /* this array is too large for */
|
||||
} /* the default run-time stack */
|
||||
/* the default run-time stack */
|
||||
(void)ch; /* dummy use of ch to avoid lint msg */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user