[MonoDevelop] io.c warnings about constants

Nick Drochak ndrochak@gol.com
Mon, 26 Apr 2004 18:19:16 +0900


--=-8FjPu9n/IJsl+HJ/zuAF
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi.  I noticed during the build of mono that io.c had warnings about
constants not fitting into a "long" type.  I naively fixed those
warnings with the attached patch.  Is this ok to commit?

I didn't see any regressions in the unit tests at least.

Nick D.

--=-8FjPu9n/IJsl+HJ/zuAF
Content-Disposition: attachment; filename=io.patch
Content-Type: text/x-patch; name=io.patch; charset=
Content-Transfer-Encoding: 7bit

? .io.c.swp
? io.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/public/mono/mono/io-layer/ChangeLog,v
retrieving revision 1.195
diff -u -r1.195 ChangeLog
--- ChangeLog	24 Apr 2004 02:03:49 -0000	1.195
+++ ChangeLog	26 Apr 2004 07:37:48 -0000
@@ -1,3 +1,7 @@
+2004-04-26  Nick Drochak <ndrochak@gol.com>
+
+	* io.c: Fix warnings about constants that don't fit in a long.
+
 2004-04-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
 	* socket-wrappers.h: _wapi_socket == WSASocket now. Added
Index: io.c
===================================================================
RCS file: /cvs/public/mono/mono/io-layer/io.c,v
retrieving revision 1.54
diff -u -r1.54 io.c
--- io.c	22 Apr 2004 14:37:44 -0000	1.54
+++ io.c	26 Apr 2004 07:37:49 -0000
@@ -948,14 +948,14 @@
 	 */
 	if(statbuf.st_atime < statbuf.st_ctime) {
 		create_ticks=((guint64)statbuf.st_atime*10000000)
-			+ 116444736000000000UL;
+			+ 116444736000000000ULL;
 	} else {
 		create_ticks=((guint64)statbuf.st_ctime*10000000)
-			+ 116444736000000000UL;
+			+ 116444736000000000ULL;
 	}
 	
-	access_ticks=((guint64)statbuf.st_atime*10000000)+116444736000000000UL;
-	write_ticks=((guint64)statbuf.st_mtime*10000000)+116444736000000000UL;
+	access_ticks=((guint64)statbuf.st_atime*10000000)+116444736000000000ULL;
+	write_ticks=((guint64)statbuf.st_mtime*10000000)+116444736000000000ULL;
 	
 #ifdef DEBUG
 		g_message(G_GNUC_PRETTY_FUNCTION
@@ -1040,7 +1040,7 @@
 	if(last_access!=NULL) {
 		access_ticks=((guint64)last_access->dwHighDateTime << 32) +
 			last_access->dwLowDateTime;
-		utbuf.actime=(access_ticks - 116444736000000000) / 10000000;
+		utbuf.actime=(access_ticks - 116444736000000000ULL) / 10000000;
 	} else {
 		utbuf.actime=statbuf.st_atime;
 	}
@@ -1048,7 +1048,7 @@
 	if(last_write!=NULL) {
 		write_ticks=((guint64)last_write->dwHighDateTime << 32) +
 			last_write->dwLowDateTime;
-		utbuf.modtime=(write_ticks - 116444736000000000) / 10000000;
+		utbuf.modtime=(write_ticks - 116444736000000000ULL) / 10000000;
 	} else {
 		utbuf.modtime=statbuf.st_mtime;
 	}
@@ -2268,8 +2268,8 @@
 #define TICKS_PER_MILLISECOND 10000L
 #define TICKS_PER_SECOND 10000000L
 #define TICKS_PER_MINUTE 600000000L
-#define TICKS_PER_HOUR 36000000000L
-#define TICKS_PER_DAY 864000000000L
+#define TICKS_PER_HOUR 36000000000LL
+#define TICKS_PER_DAY 864000000000LL
 
 #define isleap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
 

--=-8FjPu9n/IJsl+HJ/zuAF--