132 lines
4.3 KiB
Text
132 lines
4.3 KiB
Text
$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));
|