diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | encoding.c | 2 | ||||
-rw-r--r-- | file.c | 18 | ||||
-rw-r--r-- | include/ruby/win32.h | 1 | ||||
-rw-r--r-- | iseq.c | 1 | ||||
-rw-r--r-- | missing/crypt.c | 34 | ||||
-rw-r--r-- | thread.c | 3 | ||||
-rw-r--r-- | time.c | 7 | ||||
-rw-r--r-- | vm.c | 5 | ||||
-rw-r--r-- | win32/win32.c | 28 |
10 files changed, 61 insertions, 42 deletions
@@ -1,3 +1,7 @@ +Mon Jun 2 04:55:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * suppress warnings on cygwin, mingw and mswin. + Mon Jun 2 04:35:32 2008 NARUSE, Yui <naruse@ruby-lang.org> * 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) @@ -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*** @@ -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<<CHUNKBITS]; unsigned char p[64]; @@ -902,6 +922,7 @@ init_perm(perm, p, chars_in, chars_out) /* * "setkey" routine (for backwards compatibility) */ +int setkey(key) register const char *key; { @@ -922,6 +943,7 @@ setkey(key) /* * "encrypt" routine (for backwards compatibility) */ +int encrypt(block, flag) register char *block; int flag; @@ -950,7 +972,7 @@ encrypt(block, flag) } #ifdef DEBUG -STATIC +STATIC void prtab(s, t, num_rows) char *s; unsigned char *t; @@ -3256,6 +3256,9 @@ Init_Thread(void) } rb_thread_create_timer_thread(); + + (void)native_mutex_trylock; + (void)ruby_thread_set_native; } int @@ -333,7 +333,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass) return t; } -static const char const months[][4] = { +static const char months[][4] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", }; @@ -829,7 +829,10 @@ static time_t make_time_t(struct tm *tptr, int utc_p) { time_t t; - struct tm *tmp, buf; +#ifdef NEGATIVE_TIME_T + struct tm *tmp; +#endif + struct tm buf; buf = *tptr; if (utc_p) { #if defined(HAVE_TIMEGM) @@ -1600,7 +1600,6 @@ extern VALUE *rb_gc_register_stack_start; #endif /* debug functions */ -#if VMDEBUG static VALUE sdr(void) @@ -1632,7 +1631,6 @@ nsdr(void) #endif return ary; } -#endif void Init_VM(void) @@ -1692,6 +1690,9 @@ Init_VM(void) #if VMDEBUG rb_define_singleton_method(rb_cVM, "SDR", sdr, 0); rb_define_singleton_method(rb_cVM, "NSDR", nsdr, 0); +#else + (void)sdr; + (void)nsdr; #endif /* VM bootstrap: phase 2 */ diff --git a/win32/win32.c b/win32/win32.c index abc62d9987..b15f050ff9 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <errno.h> #include <assert.h> +#include <ctype.h> #include <windows.h> #include <winbase.h> @@ -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 */ @@ -477,15 +474,6 @@ static struct ChildRecord { #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; |