From 7c5e3348f7d4902ad8eb94d84a0a3595fbcd2ce2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 1 Jun 2008 19:55:25 +0000 Subject: * suppress warnings on cygwin, mingw and mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ encoding.c | 2 ++ file.c | 18 +++++++++--------- include/ruby/win32.h | 1 + iseq.c | 1 + missing/crypt.c | 34 ++++++++++++++++++++++++++++------ thread.c | 3 +++ time.c | 7 +++++-- vm.c | 5 +++-- win32/win32.c | 28 +++++----------------------- 10 files changed, 61 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index dba2821d37..9e2b5b1526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jun 2 04:55:05 2008 Nobuyoshi Nakada + + * suppress warnings on cygwin, mingw and mswin. + Mon Jun 2 04:35:32 2008 NARUSE, Yui * enc/gb18030.c (gb18030_code_to_mbc): add 0x80000000 diff --git a/encoding.c b/encoding.c index 6e745b5e77..ffeb62b656 100644 --- a/encoding.c +++ b/encoding.c @@ -503,6 +503,7 @@ enc_capable(VALUE obj) } } +#if 0 static void enc_check_capable(VALUE x) { @@ -527,6 +528,7 @@ enc_check_capable(VALUE x) rb_raise(rb_eTypeError, "wrong argument type %s (not encode capable)", etype); } } +#endif ID rb_id_encoding(void) diff --git a/file.c b/file.c index 0e5e8704dc..501762a5ea 100644 --- a/file.c +++ b/file.c @@ -2614,7 +2614,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result) if (s[0] == '~') { if (isdirsep(s[1]) || s[1] == '\0') { - char *dir = getenv("HOME"); + const char *dir = getenv("HOME"); if (!dir) { rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `%s'", s); @@ -2973,9 +2973,9 @@ static VALUE rb_file_s_basename(int argc, VALUE *argv) { VALUE fname, fext, basename; - char *name, *p; + const char *name, *p; #if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC - char *root; + const char *root; #endif int f, n; @@ -3202,7 +3202,7 @@ rb_file_join(VALUE ary, VALUE sep) { long len, i; VALUE result, tmp; - char *name, *tail; + const char *name, *tail; if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0); @@ -4368,7 +4368,7 @@ static int path_check_0(VALUE path, int execpath) { struct stat st; - char *p0 = StringValueCStr(path); + const char *p0 = StringValueCStr(path); char *p = 0, *s; if (!is_absolute_path(p0)) { @@ -4462,8 +4462,8 @@ VALUE rb_get_load_path(void); int rb_find_file_ext(VALUE *filep, const char *const *ext) { - char *path, *found; - char *f = RSTRING_PTR(*filep); + const char *path, *found; + const char *f = RSTRING_PTR(*filep); VALUE fname, load_path; long i, j; @@ -4519,8 +4519,8 @@ VALUE rb_find_file(VALUE path) { VALUE tmp, load_path; - char *f = StringValueCStr(path); - char *lpath; + const char *f = StringValueCStr(path); + const char *lpath; char fbuf[MAXPATHLEN]; if (f[0] == '~') { diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 4e1f14e9e1..a0acb7fff9 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -546,6 +546,7 @@ size_t rb_w32_read(int, void *, size_t); size_t rb_w32_write(int, const void *, size_t); int rb_w32_utime(const char *, const struct utimbuf *); int WINAPI rb_w32_Sleep(unsigned long msec); +int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout); /* == ***CAUTION*** diff --git a/iseq.c b/iseq.c index 9e6cf56d16..b8a84ed402 100644 --- a/iseq.c +++ b/iseq.c @@ -1300,6 +1300,7 @@ Init_ISeq(void) /* disable this feature because there is no verifier. */ /* rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1); */ + (void)iseq_s_load; rb_define_singleton_method(rb_cISeq, "compile", iseq_s_compile, -1); rb_define_singleton_method(rb_cISeq, "new", iseq_s_compile, -1); diff --git a/missing/crypt.c b/missing/crypt.c index 486df5050b..32736bccfb 100644 --- a/missing/crypt.c +++ b/missing/crypt.c @@ -107,13 +107,15 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93"; #define LARGEDATA #endif +int des_setkey(), des_cipher(); + /* compile with "-DSTATIC=int" when profiling */ #ifndef STATIC #define STATIC static #endif -STATIC init_des(), init_perm(), permute(); +STATIC void init_des(), init_perm(), permute(); #ifdef DEBUG -STATIC prtab(); +STATIC void prtab(); #endif /* ==================================== */ @@ -299,7 +301,7 @@ typedef union { #define PERM3264(d,d0,d1,cpp,p) \ { C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); } -STATIC +STATIC void permute(cp, out, p, chars_in) unsigned char *cp; C_block *out; @@ -377,46 +379,62 @@ static unsigned char PC2[] = { /* permuted choice table 2 */ }; static unsigned char S[8][64] = { /* 48->32 bit substitution tables */ + { /* S[1] */ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, + }, + { /* S[2] */ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, + }, + { /* S[3] */ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, + }, + { /* S[4] */ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, + }, + { /* S[5] */ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, + }, + { /* S[6] */ 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, + }, + { /* S[7] */ 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, + }, + { /* S[8] */ 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11, + }, }; static unsigned char P32Tr[] = { /* 32-bit permutation function */ @@ -580,6 +598,7 @@ static C_block KS[KS_SIZE]; /* * Set up the key schedule from the key. */ +int des_setkey(key) register const char *key; { @@ -614,6 +633,7 @@ des_setkey(key) * NOTE: the performance of this routine is critically dependent on your * compiler and machine architecture. */ +int des_cipher(in, out, salt, num_iter) const char *in; char *out; @@ -734,7 +754,7 @@ des_cipher(in, out, salt, num_iter) * Initialize various tables. This need only be done once. It could even be * done at compile time, if the compiler were capable of that sort of thing. */ -STATIC +STATIC void init_des() { register int i, j; @@ -878,7 +898,7 @@ init_des() * * "perm" must be all-zeroes on entry to this routine. */ -STATIC +STATIC void init_perm(perm, p, chars_in, chars_out) C_block perm[64/CHUNKBITS][1< #include #include +#include #include #include @@ -189,7 +190,7 @@ rb_w32_map_errno(DWORD winerr) #define map_errno rb_w32_map_errno -static char *NTLoginName; +static const char *NTLoginName; #ifdef WIN95 static DWORD Win32System = (DWORD)-1; @@ -419,10 +420,6 @@ exit_handler(void) void rb_w32_sysinit(int *argc, char ***argv) { - - WORD version; - int ret; - #if _MSC_VER >= 1400 static void set_pioinfo_extra(void); @@ -461,7 +458,7 @@ rb_w32_sysinit(int *argc, char ***argv) char * getlogin(void) { - return NTLoginName; + return (char *)NTLoginName; } #define MAXCHILDNUM 256 /* max num of child processes */ @@ -476,15 +473,6 @@ static struct ChildRecord { for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v) #define END_FOREACH_CHILD } while (0) -static struct ChildRecord * -FindFirstChildSlot(void) -{ - FOREACH_CHILD(child) { - if (child->pid) return child; - } END_FOREACH_CHILD; - return NULL; -} - static struct ChildRecord * FindChildSlot(rb_pid_t pid) { @@ -715,8 +703,6 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *wr HANDLE hCurProc; SECURITY_ATTRIBUTES sa; BOOL reading, writing; - SOCKET pair[2]; - int fd; int binmode; int ret; @@ -1145,7 +1131,7 @@ skipspace(char *ptr) int rb_w32_cmdvector(const char *cmd, char ***vec) { - int cmdlen, globbing, len, i; + int globbing, len; int elements, strsz, done; int slashes, escape; char *ptr, *base, *buffer, *cmdline; @@ -2694,7 +2680,6 @@ rb_w32_getservbyport(int port, const char *proto) static int socketpair_internal(int af, int type, int protocol, SOCKET *sv) { - const char *localhost = NULL; SOCKET svr = INVALID_SOCKET, r = INVALID_SOCKET, w = INVALID_SOCKET; struct sockaddr_in sock_in4; #ifdef INET6 @@ -3761,7 +3746,7 @@ rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, }); if (!thr) { - rb_fatal("failed to launch waiter thread:%d", GetLastError()); + rb_fatal("failed to launch waiter thread:%ld", GetLastError()); } return val; @@ -3790,7 +3775,6 @@ rb_w32_get_environ(void) myenvtop = (char **)malloc(sizeof(char *) * (num + 1)); for (env = envtop, myenv = myenvtop; *env; env += strlen(env) + 1) { if (*env != '=') { - int len = strlen(env) + 1; if (!(*myenv = strdup(env))) { break; } @@ -3919,9 +3903,7 @@ int rb_w32_utime(const char *path, const struct utimbuf *times) { HANDLE hFile; - SYSTEMTIME st; FILETIME atime, mtime; - struct tm *tm; struct stati64 stat; int ret = 0; -- cgit v1.2.3