[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tclock.c cleanup (and bug/feature)
From: |
A.M. Kuchling |
Subject: |
tclock.c cleanup (and bug/feature) |
Date: |
Sat, 23 Dec 2000 10:12:58 -0500 |
test/tclock.c has a redundant assignment to the sradius variable; a
cleanup patch is below.
Also, a tclock bug/feature: if you run tclock in a tall skinny window,
the clock doesn't fit onscreen. This was discovered through Thomas
Gellekum's Python translation of tclock.c, because Python raises an
exception when a curses call returns ERR; the C version just ignores
the ERR return and therefore keeps running. The fix for the Python
version was to compute ch as min( cy-1, int(cx / ASPECT) - 1).
--amk
--- tclock.c.orig Sat Dec 23 09:57:15 2000
+++ tclock.c Sat Dec 23 09:57:25 2000
@@ -145,11 +145,10 @@
ch = (cx > cy) ? cy : cx; /* usually cy */
mradius = (3 * cy) / 4; /* 9 */
hradius = cy / 2; /* 6 */
- sradius = (2 * cy) / 3; /* 8 */
+ sradius = (5 * cy) / 6; /* 10 */
for (i = 0; i < 12; i++) {
sangle = (i + 1) * (2.0 * PI) / 12.0;
- sradius = (5 * cy) / 6; /* 10 */
sdx = A2X(sangle, sradius);
sdy = A2Y(sangle, sradius);
sprintf(szChar, "%d", i + 1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tclock.c cleanup (and bug/feature),
A.M. Kuchling <=