summaryrefslogtreecommitdiff
path: root/time/xchrono/patches/patch-ab
blob: 60433f4e0bfb0bc7b4b3c7dd66332952dec202b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
$NetBSD: patch-ab,v 1.2 2006/11/28 23:04:55 agc Exp $

the time stuff is needed to compile on alpha, the other stuff kills
compiler warnings

--- MultiClock.c.orig	Sat Jun 15 16:09:44 2002
+++ MultiClock.c
@@ -33,9 +33,10 @@
 #include <X11/Xaw/XawInit.h>
 #include "MultiClockP.h"
 
-extern long time();
+#include <stdio.h>
+#include <time.h>
 static void clock_tic(), updateClocks(), DrawHand(), DrawSecond(), SetSeg(), DrawClockFace();
-static erase_hands(), round();
+static erase_hands(), xchrono_round();
 	
 /* Private Definitions */
 
@@ -177,7 +178,7 @@
     {
       ClassField(numberOfSlots) += CLOCK_LIST_SIZE;
       ClassField(clockList) =
-	(ClockWidget *) XtRealloc(ClassField(clockList),
+	(ClockWidget *) XtRealloc((void *) ClassField(clockList),
 				  sizeof(ClockWidget)*ClassField(numberOfSlots));
     }
 
@@ -239,7 +240,7 @@
     if(!w->clock.analog) {
        char *str;
        struct tm tm, *localtime();
-       long time_value;
+       time_t time_value;
        (void) time(&time_value);
        tm = *localtime(&time_value);
        str = asctime(&tm);
@@ -391,7 +392,7 @@
         XtIntervalId *id;
 {
   ClockWidget w = (ClockWidget) client_data;
-  long	time_value;
+  time_t	time_value;
   char localTimezone[TZ_BUFLEN];
   char *tzenv = getenv("TZ");
   struct tm *localtime();
@@ -417,11 +418,11 @@
     {
       (*list)->clock.show_second_hand =
 	(ClassField(updateInterval) <= SECOND_HAND_TIME);
-      if (XtIsRealized(*list))
+      if (XtIsRealized((Widget) *list))
 	{
 	  if ((*list)->clock.timezone)
 	  {
-	    sprintf (tzEnviron, "TZ=%s", (*list)->clock.timezone);
+	    snprintf (tzEnviron, sizeof(tzEnviron), "TZ=%s", (*list)->clock.timezone);
 	    putenv (tzEnviron);
 	    tzset ();
 	  }
@@ -433,7 +434,7 @@
 
   if (tzenv)
     {
-      sprintf (tzEnviron, "TZ=%s", localTimezone);
+      snprintf (tzEnviron, sizeof(tzEnviron), "TZ=%s", localTimezone);
       putenv (tzEnviron);
     }
 #ifndef SYSV
@@ -525,7 +526,7 @@
 			  }
 			else am_pm = "AM";
 
-			sprintf (time_string, "%d/%d", tm.tm_mon+1, tm.tm_mday);
+			snprintf (time_string, sizeof(time_string), "%d/%d", tm.tm_mon+1, tm.tm_mday);
 			{
 			  int len = strlen (time_string);
 			  int x = w->core.width -
@@ -760,14 +761,14 @@
 	wc = width * cosangle;
 	ws = width * sinangle;
 	SetSeg(w,
-	       x = w->clock.centerX + round(length * sinangle),
-	       y = w->clock.centerY - round(length * cosangle),
-	       x1 = w->clock.centerX - round(ws + wc), 
-	       y1 = w->clock.centerY + round(wc - ws));  /* 1 ---- 2 */
+	       x = w->clock.centerX + xchrono_round(length * sinangle),
+	       y = w->clock.centerY - xchrono_round(length * cosangle),
+	       x1 = w->clock.centerX - xchrono_round(ws + wc), 
+	       y1 = w->clock.centerY + xchrono_round(wc - ws));  /* 1 ---- 2 */
 	/* 2 */
 	SetSeg(w, x1, y1, 
-	       x2 = w->clock.centerX - round(ws - wc), 
-	       y2 = w->clock.centerY + round(wc + ws));  /* 2 ----- 3 */
+	       x2 = w->clock.centerX - xchrono_round(ws - wc), 
+	       y2 = w->clock.centerY + xchrono_round(wc + ws));  /* 2 ----- 3 */
 
 	SetSeg(w, x2, y2, x, y);	/* 3 ----- 1(4) */
 }
@@ -834,14 +835,14 @@
 	ws = width * sinangle;
 	/*1 ---- 2 */
 	SetSeg(w,
-	       x = w->clock.centerX + round(length * sinangle),
-	       y = w->clock.centerY - round(length * cosangle),
-	       w->clock.centerX + round(ms - wc),
-	       w->clock.centerY - round(mc + ws) );
-	SetSeg(w, w->clock.centerX + round(offset *sinangle),
-	       w->clock.centerY - round(offset * cosangle), /* 2-----3 */
-	       w->clock.centerX + round(ms + wc), 
-	       w->clock.centerY - round(mc - ws));
+	       x = w->clock.centerX + xchrono_round(length * sinangle),
+	       y = w->clock.centerY - xchrono_round(length * cosangle),
+	       w->clock.centerX + xchrono_round(ms - wc),
+	       w->clock.centerY - xchrono_round(mc + ws) );
+	SetSeg(w, w->clock.centerX + xchrono_round(offset *sinangle),
+	       w->clock.centerY - xchrono_round(offset * cosangle), /* 2-----3 */
+	       w->clock.centerX + xchrono_round(ms + wc), 
+	       w->clock.centerY - xchrono_round(mc - ws));
 	w->clock.segbuffptr->x = x;
 	w->clock.segbuffptr++->y = y;
 	w->clock.numseg ++;
@@ -886,7 +887,7 @@
 	w->clock.numseg = 0;
 }
 
-static int round(x)
+static int xchrono_round(x)
 double x;
 {
 	return(x >= 0.0 ? (int)(x + .5) : (int)(x - .5));