summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 10:39:57 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 10:39:57 +0000
commit2b785b0f3e4f902e7de29a895d1f6ae0f10c3265 (patch)
treebc1801ecbd4d1e852a5ae0a0b8202a41c7ec933b /file.c
parent23a434b3630b05781dc48e07582ed180d9661a6a (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 'file.c')
-rw-r--r--file.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/file.c b/file.c
index eacf066..60d5a94 100644
--- a/file.c
+++ b/file.c
@@ -2320,6 +2320,10 @@ rb_file_s_umask(argc, argv)
#define USE_NTFS 0
#endif
+#ifdef DOSISH_DRIVE_LETTER
+#include <ctype.h>
+#endif
+
#if USE_NTFS
#define istrailinggabage(x) ((x) == '.' || (x) == ' ')
#else
@@ -2532,7 +2536,7 @@ file_expand_path(fname, dname, 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);
@@ -2888,9 +2892,9 @@ rb_file_s_basename(argc, argv)
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;
@@ -3100,7 +3104,7 @@ rb_file_join(ary, sep)
long len, i;
int taint = 0;
VALUE result, tmp;
- char *name, *tail;
+ const char *name, *tail;
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
if (OBJ_TAINTED(ary)) taint = 1;
@@ -4285,7 +4289,7 @@ path_check_0(fpath, execpath)
int execpath;
{
struct stat st;
- char *p0 = StringValueCStr(fpath);
+ const char *p0 = StringValueCStr(fpath);
char *p = 0, *s;
if (!is_absolute_path(p0)) {
@@ -4324,7 +4328,7 @@ path_check_0(fpath, execpath)
static int
fpath_check(path)
- char *path;
+ const char *path;
{
#if ENABLE_PATH_CHECK
return path_check_0(rb_str_new2(path), Qfalse);
@@ -4335,10 +4339,10 @@ fpath_check(path)
int
rb_path_check(path)
- char *path;
+ const char *path;
{
#if ENABLE_PATH_CHECK
- char *p0, *p, *pend;
+ const char *p0, *p, *pend;
const char sep = PATH_SEP_CHAR;
if (!path) return 1;
@@ -4373,7 +4377,7 @@ is_macos_native_path(path)
static int
file_load_ok(file)
- char *file;
+ const char *file;
{
FILE *f;
@@ -4391,8 +4395,8 @@ rb_find_file_ext(filep, ext)
VALUE *filep;
const char * const *ext;
{
- char *path, *found;
- char *f = RSTRING(*filep)->ptr;
+ const char *path, *found;
+ const char *f = RSTRING(*filep)->ptr;
VALUE fname;
long i, j;
@@ -4447,8 +4451,8 @@ rb_find_file(path)
VALUE path;
{
VALUE tmp;
- char *f = StringValueCStr(path);
- char *lpath;
+ const char *f = StringValueCStr(path);
+ const char *lpath;
if (f[0] == '~') {
path = rb_file_expand_path(path, Qnil);