diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-06 10:39:57 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-06 10:39:57 +0000 |
commit | 2b785b0f3e4f902e7de29a895d1f6ae0f10c3265 (patch) | |
tree | bc1801ecbd4d1e852a5ae0a0b8202a41c7ec933b /util.c | |
parent | 23a434b3630b05781dc48e07582ed180d9661a6a (diff) |
Merge changes from ruby_1_8 to reduce warnings and potentially improve
security.
* mkconfig.rb: hide build path from rbconfig.rb.
* util.c (ruby_strtod, dtoa): initialize more variables for error
handling.
* io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique),
(path2class, path2module): constified.
* pack.c (pack_unpack), process.c (rb_syswait): suppress warnings.
* suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -6,7 +6,7 @@ $Date$ created at: Fri Mar 10 17:22:34 JST 1995 - Copyright (C) 1993-2003 Yukihiro Matsumoto + Copyright (C) 1993-2008 Yukihiro Matsumoto **********************************************************************/ @@ -21,6 +21,9 @@ #ifdef _WIN32 #include "missing/file.h" #endif +#if defined(__CYGWIN32__) || defined(_WIN32) +#include <io.h> +#endif #include "util.h" #ifndef HAVE_STRING_H @@ -50,7 +53,7 @@ scan_hex(start, len, retlen) int len; int *retlen; { - static char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; + static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; register const char *s = start; register unsigned long retval = 0; char *tmp; @@ -149,8 +152,8 @@ scan_hex(start, len, retlen) static int valid_filename(char *s); -static char suffix1[] = ".$$$"; -static char suffix2[] = ".~~~"; +static const char suffix1[] = ".$$$"; +static const char suffix2[] = ".~~~"; #define ext (&buf[1000]) @@ -228,6 +231,12 @@ fallback: } #if defined(__CYGWIN32__) || defined(_WIN32) +#if defined __CYGWIN32__ || defined __MINGW32__ +extern int _open(const char *, int, ...); +extern int _close(int); +extern int _unlink(const char *); +#endif + static int valid_filename(char *s) { @@ -2103,6 +2112,7 @@ ruby_strtod(const char *s00, char **se) const char *s2; #endif + errno = 0; sign = nz0 = nz = 0; dval(rv) = 0.; for (s = s00;;s++) @@ -2282,7 +2292,7 @@ ret0: #endif dval(rv) = tens[k - 9] * dval(rv) + z; } - bd0 = 0; + bd0 = bb = bd = bs = delta = 0; if (nd <= DBL_DIG #ifndef RND_PRODQUOT #ifndef Honor_FLT_ROUNDS @@ -3208,7 +3218,7 @@ dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve) int denorm; ULong x; #endif - Bigint *b, *b1, *delta, *mlo, *mhi, *S; + Bigint *b, *b1, *delta, *mlo = 0, *mhi = 0, *S; double d2, ds, eps; char *s, *s0; #ifdef Honor_FLT_ROUNDS @@ -3561,7 +3571,6 @@ bump_up: m2 = b2; m5 = b5; - mhi = mlo = 0; if (leftright) { i = #ifndef Sudden_Underflow |