diff --git a/ChangeLog b/ChangeLog index 5337c7e075..4051cfaa90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 4 04:48:36 2006 Yukihiro Matsumoto + + * bignum.c: ruby 1.9 HEAD 64 bit warnings clean up from + . [ruby-core:08120] + Mon Jul 3 19:04:38 2006 Hidetoshi NAGAI * ext/tk/tcltklib.c (ip_make_menu_embeddable): help to make a menu @@ -3161,7 +3166,7 @@ Tue Nov 01 10:48:49 2005 GOTOU Yuuzou Mon Oct 31 17:34:46 2005 Yukihiro Matsumoto * configure.in: use proper option for Sun linker. A patch from - Shinya Kuwamura . [ruby-dev:27603] + Shinya Kuwamura . [ruby-dev:27603] Mon Oct 31 05:46:08 2005 GOTOU Yuuzou @@ -4298,7 +4303,7 @@ Fri Sep 16 18:34:01 2005 Yukihiro Matsumoto * ext/syck/node.c (syck_replace_str): was using return from the void function. a patch from MIYAMUKO Katsuyuki - . [ruby-dev:27111] + . [ruby-dev:27111] Fri Sep 16 14:48:48 2005 Hidetoshi NAGAI @@ -4623,7 +4628,7 @@ Fri Sep 9 16:45:25 2005 Nobuyoshi Nakada Thu Sep 8 14:58:11 2005 Yukihiro Matsumoto - * merged a patch from Takahiro Kambe to + * merged a patch from Takahiro Kambe to support DragonFly BSD. [ruby-dev:26984] Thu Sep 8 13:14:57 2005 Tadashi Saito @@ -4726,13 +4731,13 @@ Mon Sep 5 17:03:07 2005 Yukihiro Matsumoto * lib/find.rb: should raise ENOENT if root entry does not exist. [ruby-list:41054] - * lib/ostruct.rb: a patch from Florian Gross + * lib/ostruct.rb: a patch from Florian Gross merged to allow recursive inspect (and to_s) for OpenStruct. [ruby-core:05532] Mon Sep 5 08:20:19 2005 Yukihiro Matsumoto - * lib/observer.rb: a patch from nornagon + * lib/observer.rb: a patch from nornagon merged to allow arbitrary names for update methods. [ruby-core:05416] @@ -4981,7 +4986,7 @@ Wed Aug 17 00:05:46 2005 Yukihiro Matsumoto * parse.y (lambda): need separate block variable stack manipulation and lpar_beg maintenance. based on a patch found - in [ruby-core:05551] from Mauricio Fernandez . + in [ruby-core:05551] from Mauricio Fernandez . * parse.y (parser_yylex): adjust lpar_beg after tLAMBEG and kDO_LAMBDA. [ruby-core:05551] @@ -6414,19 +6419,19 @@ Wed Jun 8 01:27:06 2005 Yukihiro Matsumoto Wed Jun 8 00:15:08 2005 Yukihiro Matsumoto * ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from - KUBO Takehiro to support AIX. [ruby-list:40832] + KUBO Takehiro to support AIX. [ruby-list:40832] Wed Jun 8 00:09:01 2005 Yukihiro Matsumoto * lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from - Tilman Sauerbeck . [ruby-core:05055] + Tilman Sauerbeck . [ruby-core:05055] * lib/yaml/rubytypes.rb (Hash::to_yaml): ditto. Wed Jun 8 00:00:01 2005 Yukihiro Matsumoto * ext/curses/curses.c (curses_insertln): merged a patch from - TAKAHASHI Tamotsu . [ruby-ext:02305] + TAKAHASHI Tamotsu . [ruby-ext:02305] Tue Jun 7 19:34:15 2005 Yukihiro Matsumoto @@ -12596,7 +12601,7 @@ Mon Sep 6 11:00:47 2004 Yukihiro Matsumoto * dir.c (dir_s_chdir): the patch to shut up false warning when exception occurred within a block. a patch was given from Johan - Holmberg . [ruby-core:03292] + Holmberg . [ruby-core:03292] Mon Sep 6 10:57:40 2004 Hirokazu Yamamoto diff --git a/bignum.c b/bignum.c index f06444d8dd..f1e4bf98f0 100644 --- a/bignum.c +++ b/bignum.c @@ -1249,8 +1249,8 @@ bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp) dd = 0; q = yds[ny-1]; - while ((q & (1<<(BITSPERDIG-1))) == 0) { - q <<= 1; + while ((q & (1UL<<(BITSPERDIG-1))) == 0) { + q <<= 1UL; dd++; } if (dd) { diff --git a/dir.c b/dir.c index 2c868c2747..cdca612783 100644 --- a/dir.c +++ b/dir.c @@ -921,7 +921,7 @@ sys_warning_1(const char* mesg) rb_sys_warning("%s", mesg); } -#define GLOB_VERBOSE (1 << (sizeof(int) * CHAR_BIT - 1)) +#define GLOB_VERBOSE (1UL << (sizeof(int) * CHAR_BIT - 1)) #define sys_warning(val) \ ((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)_((VALUE)))sys_warning_1, (VALUE)(val), 0)) diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 739de9659e..94816204f1 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -229,6 +229,10 @@ rb_dlcfunc_inspect(VALUE self) #elif defined(_MSC_VER) || defined(__BORLANDC__) # define DECL_FUNC_CDECL(f,ret,args) ret (__cdecl *f)(args) # define DECL_FUNC_STDCALL(f,ret,args) ret (__stdcall *f)(args) +#elif defined(__SUNPRO_C) +# define DECL_FUNC(f,ret,args,calltype) ret (*f)(args) +# define DECL_FUNC_CDECL(f,ret,args) ret (*f)(args) +# define DECL_FUNC_STDCALL(f,ret,args) ret (*f)(args) #else # error "unsupported compiler." #endif diff --git a/ext/dl/dl.c b/ext/dl/dl.c index 4473e8d498..fcfcbd1bcc 100644 --- a/ext/dl/dl.c +++ b/ext/dl/dl.c @@ -70,6 +70,13 @@ rb_dl_value2ptr(VALUE self, VALUE val) # define MIDST_DECL_STDCALL __stdcall # define POST_DECL_CDECL # define POST_DECL_STDCALL +#elif (__SUNPRO_C) +# define PRE_DECL_CDECL +# define PRE_DECL_STDCALL +# define MIDST_DECL_CDECL +# define MIDST_DECL_STDCALL +# define POST_DECL_CDECL +# define POST_DECL_STDCALL #else # error "unsupported compiler" #endif diff --git a/oniguruma.h b/oniguruma.h index 9e02ecaa6e..ed31b9e65f 100644 --- a/oniguruma.h +++ b/oniguruma.h @@ -457,8 +457,8 @@ typedef unsigned int OnigOptionType; #define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE /* options */ -#define ONIG_OPTION_NONE 0 -#define ONIG_OPTION_IGNORECASE 1L +#define ONIG_OPTION_NONE 0U +#define ONIG_OPTION_IGNORECASE 1U #define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1) #define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1) #define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1) @@ -513,81 +513,81 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax /* syntax (operators) */ -#define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1<<0) -#define ONIG_SYN_OP_DOT_ANYCHAR (1<<1) /* . */ -#define ONIG_SYN_OP_ASTERISK_ZERO_INF (1<<2) /* * */ -#define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1<<3) -#define ONIG_SYN_OP_PLUS_ONE_INF (1<<4) /* + */ -#define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1<<5) -#define ONIG_SYN_OP_QMARK_ZERO_ONE (1<<6) /* ? */ -#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1<<7) -#define ONIG_SYN_OP_BRACE_INTERVAL (1<<8) /* {lower,upper} */ -#define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1<<9) /* \{lower,upper\} */ -#define ONIG_SYN_OP_VBAR_ALT (1<<10) /* | */ -#define ONIG_SYN_OP_ESC_VBAR_ALT (1<<11) /* \| */ -#define ONIG_SYN_OP_LPAREN_SUBEXP (1<<12) /* (...) */ -#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1<<13) /* \(...\) */ -#define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1<<14) /* \A, \Z, \z */ -#define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1<<15) /* \G */ -#define ONIG_SYN_OP_DECIMAL_BACKREF (1<<16) /* \num */ -#define ONIG_SYN_OP_BRACKET_CC (1<<17) /* [...] */ -#define ONIG_SYN_OP_ESC_W_WORD (1<<18) /* \w, \W */ -#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1<<19) /* \<. \> */ -#define ONIG_SYN_OP_ESC_B_WORD_BOUND (1<<20) /* \b, \B */ -#define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1<<21) /* \s, \S */ -#define ONIG_SYN_OP_ESC_D_DIGIT (1<<22) /* \d, \D */ -#define ONIG_SYN_OP_LINE_ANCHOR (1<<23) /* ^, $ */ -#define ONIG_SYN_OP_POSIX_BRACKET (1<<24) /* [:xxxx:] */ -#define ONIG_SYN_OP_QMARK_NON_GREEDY (1<<25) /* ??,*?,+?,{n,m}? */ -#define ONIG_SYN_OP_ESC_CONTROL_CHARS (1<<26) /* \n,\r,\t,\a ... */ -#define ONIG_SYN_OP_ESC_C_CONTROL (1<<27) /* \cx */ -#define ONIG_SYN_OP_ESC_OCTAL3 (1<<28) /* \OOO */ -#define ONIG_SYN_OP_ESC_X_HEX2 (1<<29) /* \xHH */ -#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1<<30) /* \x{7HHHHHHH} */ +#define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0) +#define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */ +#define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */ +#define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3) +#define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */ +#define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5) +#define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */ +#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7) +#define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */ +#define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */ +#define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */ +#define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */ +#define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */ +#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */ +#define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */ +#define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */ +#define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */ +#define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */ +#define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */ +#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* \<. \> */ +#define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */ +#define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */ +#define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */ +#define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */ +#define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */ +#define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */ +#define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */ +#define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */ +#define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */ +#define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */ +#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */ -#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1<<0) /* \Q...\E */ -#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1<<1) /* (?...) */ -#define ONIG_SYN_OP2_OPTION_PERL (1<<2) /* (?imsx),(?-imsx) */ -#define ONIG_SYN_OP2_OPTION_RUBY (1<<3) /* (?imx), (?-imx) */ -#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1<<4) /* ?+,*+,++ */ -#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1<<5) /* {n,m}+ */ -#define ONIG_SYN_OP2_CCLASS_SET_OP (1<<6) /* [...&&..[..]..] */ -#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1<<7) /* (?...) */ -#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1<<8) /* \k */ -#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1<<9) /* \g, \g */ -#define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1<<10) /* (?@..),(?@..) */ -#define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1<<11) /* \C-x */ -#define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1<<12) /* \M-x */ -#define ONIG_SYN_OP2_ESC_V_VTAB (1<<13) /* \v as VTAB */ -#define ONIG_SYN_OP2_ESC_U_HEX4 (1<<14) /* \uHHHH */ -#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1<<15) /* \`, \' */ -#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1<<16) /* \p{...}, \P{...} */ -#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1<<17) /* \p{^..}, \P{^..} */ -#define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1<<18) /* \p{IsXDigit} */ -#define ONIG_SYN_OP2_ESC_H_XDIGIT (1<<19) /* \h, \H */ -#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1<<20) /* \ */ +#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */ +#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */ +#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */ +#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */ +#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */ +#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */ +#define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */ +#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?...) */ +#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k */ +#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g, \g */ +#define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@..) */ +#define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */ +#define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */ +#define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */ +#define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */ +#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */ +#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */ +#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */ +#define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) /* \p{IsXDigit} */ +#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */ +#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */ /* syntax (behavior) */ -#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1<<31) /* not implemented */ -#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1<<0) /* ?, *, +, {n,m} */ -#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1<<1) /* error or ignore */ -#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1<<2) /* ...)... */ -#define ONIG_SYN_ALLOW_INVALID_INTERVAL (1<<3) /* {??? */ -#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1<<4) /* {,n} => {0,n} */ -#define ONIG_SYN_STRICT_CHECK_BACKREF (1<<5) /* /(\1)/,/\1()/ ..*/ -#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1<<6) /* (?<=a|bc) */ -#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1<<7) /* see doc/RE */ -#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1<<8) /* (?)(?) */ -#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1<<9) /* a{n}?=(?:a{n})? */ +#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */ +#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */ +#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */ +#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */ +#define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */ +#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */ +#define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/ +#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */ +#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */ +#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?)(?) */ +#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */ /* syntax (behavior) in char class [...] */ -#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1<<20) /* [^...] */ -#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1<<21) /* [..\w..] etc.. */ -#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1<<22) -#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1<<23) /* [0-9-a]=[0-9\-a] */ +#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */ +#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */ +#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22) +#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */ /* syntax (behavior) warning */ -#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1<<24) /* [,-,] */ -#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1<<25) /* (?:a*)+ */ +#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */ +#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */ /* meta character specifiers (onig_set_meta_char()) */ #define ONIG_META_CHAR_ESCAPE 0 diff --git a/st.c b/st.c index c1cb7b6c40..2e23050867 100644 --- a/st.c +++ b/st.c @@ -568,14 +568,14 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg) static int strhash(register const char *string) { - register int hval = FNV1_32A_INIT; + register unsigned int hval = FNV1_32A_INIT; /* * FNV-1a hash each octet in the buffer */ while (*string) { /* xor the bottom with the current octet */ - hval ^= (int)*string++; + hval ^= (unsigned int)*string++; /* multiply by the 32 bit FNV magic prime mod 2^32 */ hval *= FNV_32_PRIME; diff --git a/string.c b/string.c index 7090140614..d511297089 100644 --- a/string.c +++ b/string.c @@ -845,14 +845,14 @@ rb_str_hash(VALUE str) { register long len = RSTRING(str)->len; register char *p = RSTRING(str)->ptr; - register int hval = FNV1_32A_INIT; + register unsigned int hval = FNV1_32A_INIT; /* * FNV-1a hash each octet in the buffer */ while (len--) { /* xor the bottom with the current octet */ - hval ^= (int)*p++; + hval ^= (unsigned int)*p++; /* multiply by the 32 bit FNV magic prime mod 2^32 */ #if defined(FNV_GCC_OPTIMIZATION) diff --git a/time.c b/time.c index 60c0e6b641..ffaad3baa4 100644 --- a/time.c +++ b/time.c @@ -1923,8 +1923,8 @@ time_mdump(VALUE time) if ((tm->tm_year & 0xffff) != tm->tm_year) rb_raise(rb_eArgError, "year too big to marshal"); - - p = 0x1 << 31 | /* 1 */ + + p = 0x1UL << 31 | /* 1 */ tobj->gmt << 30 | /* 1 */ tm->tm_year << 14 | /* 16 */ tm->tm_mon << 10 | /* 4 */ @@ -1994,13 +1994,13 @@ time_mload(VALUE time, VALUE str) s |= buf[i]<<(8*(i-4)); } - if ((p & (1<<31)) == 0) { + if ((p & (1UL<<31)) == 0) { gmt = 0; sec = p; usec = s; } else { - p &= ~(1<<31); + p &= ~(1UL<<31); gmt = (p >> 30) & 0x1; tm.tm_year = (p >> 14) & 0xffff; tm.tm_mon = (p >> 10) & 0xf;