[hackers] [wmii] Fix some warnings on 64 bit systems with fr*king gcc-4.

From: Kris Maglione <jg_AT_suckless.org>
Date: Thu Jan 31 22:33:21 2008

changeset: 2269:00383ecd917e
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Thu Jan 31 16:32:24 2008 -0500
summary: Fix some warnings on 64 bit systems with fr*king gcc-4.

diff -r 664dc4fa751a -r 00383ecd917e cmd/wmii/utf.c
--- a/cmd/wmii/utf.c Wed Jan 30 21:23:07 2008 -0500
+++ b/cmd/wmii/utf.c Thu Jan 31 16:32:24 2008 -0500
@@ -15,7 +15,7 @@ toutf8n(const char *str, size_t nstr) {
 
         if(cd == nil) {
                 cd = iconv_open("UTF-8", nl_langinfo(CODESET));
- if((int)cd == -1)
+ if((long)cd == -1)
                         warning("Can't convert from local character encoding to UTF-8");
                 else
                         haveiconv = true;
diff -r 664dc4fa751a -r 00383ecd917e libfmt/fmtfd.c
--- a/libfmt/fmtfd.c Wed Jan 30 21:23:07 2008 -0500
+++ b/libfmt/fmtfd.c Thu Jan 31 16:32:24 2008 -0500
@@ -40,7 +40,7 @@ fmtfdinit(Fmt *f, int fd, char *buf, int
         f->to = buf;
         f->stop = buf + size;
         f->flush = __fmtFdFlush;
- f->farg = (void*)fd;
+ f->farg = (void*)(uintptr_t)fd;
         f->nfmt = 0;
         return 0;
 }
diff -r 664dc4fa751a -r 00383ecd917e libfmt/fmtfdflush.c
--- a/libfmt/fmtfdflush.c Wed Jan 30 21:23:07 2008 -0500
+++ b/libfmt/fmtfdflush.c Thu Jan 31 16:32:24 2008 -0500
@@ -27,7 +27,7 @@ __fmtFdFlush(Fmt *f)
         int n;
 
         n = (char*)f->to - (char*)f->start;
- if(n && write((int)f->farg, f->start, n) != n)
+ if(n && write((uintptr_t)f->farg, f->start, n) != n)
                 return 0;
         f->to = f->start;
         return 1;
diff -r 664dc4fa751a -r 00383ecd917e libfmt/runevsmprint.c
--- a/libfmt/runevsmprint.c Wed Jan 30 21:23:07 2008 -0500
+++ b/libfmt/runevsmprint.c Thu Jan 31 16:32:24 2008 -0500
@@ -30,7 +30,7 @@ runeFmtStrFlush(Fmt *f)
 
         if(f->start == nil)
                 return 0;
- n = (int)f->farg;
+ n = (uintptr_t)f->farg;
         n *= 2;
         s = (Rune*)f->start;
         f->start = realloc(s, sizeof(Rune)*n);
@@ -41,7 +41,7 @@ runeFmtStrFlush(Fmt *f)
                 free(s);
                 return 0;
         }
- f->farg = (void*)n;
+ f->farg = (void*)(uintptr_t)n;
         f->to = (Rune*)f->start + ((Rune*)f->to - s);
         f->stop = (Rune*)f->start + n - 1;
         return 1;
@@ -61,7 +61,7 @@ runefmtstrinit(Fmt *f)
         f->to = f->start;
         f->stop = (Rune*)f->start + n - 1;
         f->flush = runeFmtStrFlush;
- f->farg = (void*)n;
+ f->farg = (void*)(uintptr_t)n;
         f->nfmt = 0;
         return 0;
 }
diff -r 664dc4fa751a -r 00383ecd917e libfmt/sprint.c
--- a/libfmt/sprint.c Wed Jan 30 21:23:07 2008 -0500
+++ b/libfmt/sprint.c Thu Jan 31 16:32:24 2008 -0500
@@ -28,7 +28,7 @@ sprint(char *buf, const char *fmt, ...)
          * we must be sure not to overflow a 32-bit pointer.
          */
         if(buf+len < buf)
- len = -(uint)buf-1;
+ len = -(uintptr_t)buf-1;
 
         va_start(args, fmt);
         n = vsnprint(buf, len, fmt, args);
diff -r 664dc4fa751a -r 00383ecd917e libfmt/vsmprint.c
--- a/libfmt/vsmprint.c Wed Jan 30 21:23:07 2008 -0500
+++ b/libfmt/vsmprint.c Thu Jan 31 16:32:24 2008 -0500
@@ -30,7 +30,7 @@ fmtStrFlush(Fmt *f)
 
         if(f->start == nil)
                 return 0;
- n = (int)f->farg;
+ n = (uintptr_t)f->farg;
         n *= 2;
         s = (char*)f->start;
         f->start = realloc(s, n);
@@ -41,7 +41,7 @@ fmtStrFlush(Fmt *f)
                 free(s);
                 return 0;
         }
- f->farg = (void*)n;
+ f->farg = (void*)(uintptr_t)n;
         f->to = (char*)f->start + ((char*)f->to - s);
         f->stop = (char*)f->start + n - 1;
         return 1;
@@ -61,7 +61,7 @@ fmtstrinit(Fmt *f)
         f->to = f->start;
         f->stop = (char*)f->start + n - 1;
         f->flush = fmtStrFlush;
- f->farg = (void*)n;
+ f->farg = (void*)(uintptr_t)n;
         f->nfmt = 0;
         return 0;
 }
Received on Thu Jan 31 2008 - 22:33:21 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:14 UTC