delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/19/17:22:26

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200106192122.XAA18906@father.ludd.luth.se>
Subject: More signed/unsigned issues
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Tue, 19 Jun 2001 23:22:21 +0200 (MET DST)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

It looks like I want to undo one of my earlier changes. (Or perhaps
I never commited changes and misremember.)


Right,

						MartinS

Index: src/libc/ansi/time/ctime.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/time/ctime.c,v
retrieving revision 1.6
diff -p -u -r1.6 ctime.c
--- src/libc/ansi/time/ctime.c  2001/06/09 17:03:07     1.6
+++ src/libc/ansi/time/ctime.c  2001/06/19 21:12:55
@@ -267,7 +267,7 @@ static int
 tzload(const char *name, struct state * const sp)
 {
   const char * p;
-  size_t i;
+  int i;
   int fid;
   char fullname[FILENAME_MAX + 1];
   const struct tzhead * tzhp;
@@ -313,7 +313,7 @@ tzload(const char *name, struct state *
   else
   {
     i = read(fid, buf, sizeof buf);
-    if (close(fid) != 0 || i < sizeof *tzhp)
+    if (close(fid) != 0 || i < (int)sizeof *tzhp)
       return -1;
   }

@@ -329,12 +329,12 @@ tzload(const char *name, struct state *
       sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
       (ttisstdcnt != sp->typecnt && ttisstdcnt != 0))
     return -1;
-  if (i < sizeof *tzhp +
+  if (i < (int)( sizeof *tzhp +
       sp->timecnt * (4 + sizeof (char)) +
       sp->typecnt * (4 + 2 * sizeof (char)) +
       sp->charcnt * sizeof (char) +
       sp->leapcnt * 2 * 4 +
-      ttisstdcnt * sizeof (char))
+      ttisstdcnt * sizeof (char) ))
     return -1;
   p = buf + sizeof *tzhp;
   for (i = 0; i < sp->timecnt; ++i)
@@ -891,7 +891,7 @@ tzparse(const char *name, struct state *
   sp->charcnt = stdlen + 1;
   if (dstlen != 0)
     sp->charcnt += dstlen + 1;
-  if (sp->charcnt > sizeof sp->chars)
+  if (sp->charcnt > (int)sizeof sp->chars)
     return -1;
   cp = sp->chars;
   (void) strncpy(cp, stdname, stdlen);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019