[前][次][番号順一覧][スレッド一覧]

ruby-changes:11268

From: nobu <ko1@a...>
Date: Wed, 11 Mar 2009 04:30:02 +0900 (JST)
Subject: [ruby-changes:11268] Ruby:r22879 (trunk): * win32/win32.c: suppress warnings. based on a patch from Charlie

nobu	2009-03-11 04:29:51 +0900 (Wed, 11 Mar 2009)

  New Revision: 22879

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22879

  Log:
    * win32/win32.c: suppress warnings.  based on a patch from Charlie
      Savage at [ruby-core:22804].

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22878)
+++ ChangeLog	(revision 22879)
@@ -1,3 +1,8 @@
+Wed Mar 11 04:29:52 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/win32.c: suppress warnings.  based on a patch from Charlie
+	  Savage at [ruby-core:22804].
+
 Wed Mar 11 04:22:12 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* signal.c (sig_trap): suppress warnings.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 22878)
+++ win32/win32.c	(revision 22879)
@@ -31,6 +31,7 @@
 #include <mbstring.h>
 #if _MSC_VER >= 1400
 #include <crtdbg.h>
+#include <rtcapi.h>
 #endif
 #ifdef __MINGW32__
 #include <mswsock.h>
@@ -1596,7 +1597,7 @@
 	return NULL;
     if (!(sbuf.st_mode & S_IFDIR) &&
 	(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
-	((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) {
+	 ((1 << ((filename[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
 	errno = ENOTDIR;
 	return NULL;
     }
@@ -2136,21 +2137,21 @@
 static int
 extract_fd(rb_fdset_t *dst, fd_set *src, int (*func)(SOCKET))
 {
-    int s = 0;
+    unsigned int s = 0;
     if (!src || !dst) return 0;
 
     while (s < src->fd_count) {
         SOCKET fd = src->fd_array[s];
 
 	if (!func || (*func)(fd)) { /* move it to dst */
-	    int d;
+	    unsigned int d;
 
 	    for (d = 0; d < dst->fdset->fd_count; d++) {
 		if (dst->fdset->fd_array[d] == fd)
 		    break;
 	    }
 	    if (d == dst->fdset->fd_count) {
-		if (dst->fdset->fd_count >= dst->capa) {
+		if ((int)dst->fdset->fd_count >= dst->capa) {
 		    dst->capa = (dst->fdset->fd_count / FD_SETSIZE + 1) * FD_SETSIZE;
 		    dst->fdset = xrealloc(dst->fdset, sizeof(unsigned int) + sizeof(SOCKET) * dst->capa);
 		}
@@ -2170,12 +2171,12 @@
 static int
 copy_fd(fd_set *dst, fd_set *src)
 {
-    int s;
+    unsigned int s;
     if (!src || !dst) return 0;
 
     for (s = 0; s < src->fd_count; ++s) {
 	SOCKET fd = src->fd_array[s];
-	int d;
+	unsigned int d;
 	for (d = 0; d < dst->fd_count; ++d) {
 	    if (dst->fd_array[d] == fd)
 		break;
@@ -2380,9 +2381,9 @@
     extract_fd(&except, ex, is_not_socket); // drop only
 
     r = 0;
-    if (rd && rd->fd_count > r) r = rd->fd_count;
-    if (wr && wr->fd_count > r) r = wr->fd_count;
-    if (ex && ex->fd_count > r) r = ex->fd_count;
+    if (rd && (int)rd->fd_count > r) r = (int)rd->fd_count;
+    if (wr && (int)wr->fd_count > r) r = (int)wr->fd_count;
+    if (ex && (int)ex->fd_count > r) r = (int)ex->fd_count;
     if (nfds > r) nfds = r;
 
     {
@@ -3193,7 +3194,7 @@
 
     if (pid == -1) {
 	int count = 0;
-	DWORD ret;
+	int ret;
 	HANDLE events[MAXCHILDNUM];
 
 	FOREACH_CHILD(child) {
@@ -3257,8 +3258,8 @@
     lt /= 10;	/* to usec */
     lt -= (LONG_LONG)((1970-1601)*365.2425) * 24 * 60 * 60 * 1000 * 1000;
 
-    tv->tv_sec = lt / (1000 * 1000);
-    tv->tv_usec = lt % (1000 * 1000);
+    tv->tv_sec = (long)(lt / (1000 * 1000));
+    tv->tv_usec = (long)(lt % (1000 * 1000));
 
     return tv->tv_sec > 0 ? 0 : -1;
 }
@@ -3540,7 +3541,7 @@
     return 0;
 }
 
-#define COPY_STAT(src, dest) do {		\
+#define COPY_STAT(src, dest, size_cast) do {	\
 	(dest).st_dev 	= (src).st_dev;		\
 	(dest).st_ino 	= (src).st_ino;		\
 	(dest).st_mode  = (src).st_mode;	\
@@ -3548,7 +3549,7 @@
 	(dest).st_uid   = (src).st_uid;		\
 	(dest).st_gid   = (src).st_gid;		\
 	(dest).st_rdev 	= (src).st_rdev;	\
-	(dest).st_size 	= (src).st_size;	\
+	(dest).st_size 	= size_cast(src).st_size; \
 	(dest).st_atime = (src).st_atime;	\
 	(dest).st_mtime = (src).st_mtime;	\
 	(dest).st_ctime = (src).st_ctime;	\
@@ -3580,7 +3581,7 @@
 
     if (ret) return ret;
     tmp.st_mode &= ~(S_IWGRP | S_IWOTH);
-    COPY_STAT(tmp, *st);
+    COPY_STAT(tmp, *st, +);
     if (GetFileInformationByHandle((HANDLE)_get_osfhandle(fd), &info)) {
 	if (!(info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) {
 	    st->st_mode |= S_IWUSR;
@@ -3626,10 +3627,10 @@
 	while (path < end) {
 	    end = CharPrev(path, end);
 	    if (*end == '.') {
-		if ((strcmpi(end, ".bat") == 0) ||
-		    (strcmpi(end, ".cmd") == 0) ||
-		    (strcmpi(end, ".com") == 0) ||
-		    (strcmpi(end, ".exe") == 0)) {
+		if ((strcasecmp(end, ".bat") == 0) ||
+		    (strcasecmp(end, ".cmd") == 0) ||
+		    (strcasecmp(end, ".com") == 0) ||
+		    (strcasecmp(end, ".exe") == 0)) {
 		    mode |= S_IEXEC;
 		}
 		break;
@@ -3663,7 +3664,7 @@
     memset(st, 0, sizeof(*st));
     st->st_nlink = 1;
 
-    if (_mbspbrk(path, "?*")) {
+    if (_mbspbrk((const unsigned char *)path, (const unsigned char *)"?*")) {
 	errno = ENOENT;
 	return -1;
     }
@@ -3717,7 +3718,7 @@
     struct stati64 tmp;
 
     if (rb_w32_stati64(path, &tmp)) return -1;
-    COPY_STAT(tmp, *st);
+    COPY_STAT(tmp, *st, (_off_t));
     return 0;
 }
 
@@ -4615,7 +4616,7 @@
 
 	if (!(_osfile(fd) & (FDEV | FPIPE))) {
 	    LONG high = ol.OffsetHigh;
-	    LONG low = ol.Offset + read;
+	    DWORD low = ol.Offset + read;
 	    if (low < ol.Offset)
 		++high;
 	    SetFilePointer((HANDLE)_osfhnd(fd), low, &high, FILE_BEGIN);
@@ -4733,7 +4734,7 @@
 
 	if (!(_osfile(fd) & (FDEV | FPIPE))) {
 	    LONG high = ol.OffsetHigh;
-	    LONG low = ol.Offset + written;
+	    DWORD low = ol.Offset + written;
 	    if (low < ol.Offset)
 		++high;
 	    SetFilePointer((HANDLE)_osfhnd(fd), low, &high, FILE_BEGIN);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]