mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
23a434b363
commit
2b785b0f3e
24 changed files with 159 additions and 94 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
Fri Jun 6 19:34:22 2008 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Fri Jun 6 19:23:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (file_expand_path): fix for non-existent files and SFN of
|
||||
|
|
|
|||
24
dln.c
24
dln.c
|
|
@ -1689,31 +1689,31 @@ static char fbuf[MAXPATHLEN];
|
|||
|
||||
static char *
|
||||
dln_find_1(fname, path, exe_flag)
|
||||
char *fname;
|
||||
char *path;
|
||||
const char *fname;
|
||||
const char *path;
|
||||
int exe_flag; /* non 0 if looking for executable. */
|
||||
{
|
||||
register char *dp;
|
||||
register char *ep;
|
||||
register const char *dp;
|
||||
register const char *ep;
|
||||
register char *bp;
|
||||
struct stat st;
|
||||
#ifdef __MACOS__
|
||||
const char* mac_fullpath;
|
||||
#endif
|
||||
|
||||
if (!fname) return fname;
|
||||
if (fname[0] == '/') return fname;
|
||||
if (!fname) return (char *)fname;
|
||||
if (fname[0] == '/') return (char *)fname;
|
||||
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
|
||||
return fname;
|
||||
if (exe_flag && strchr(fname, '/')) return fname;
|
||||
return (char *)fname;
|
||||
if (exe_flag && strchr(fname, '/')) return (char *)fname;
|
||||
#ifdef DOSISH
|
||||
if (fname[0] == '\\') return fname;
|
||||
if (fname[0] == '\\') return (char *)fname;
|
||||
# ifdef DOSISH_DRIVE_LETTER
|
||||
if (strlen(fname) > 2 && fname[1] == ':') return fname;
|
||||
if (strlen(fname) > 2 && fname[1] == ':') return (char *)fname;
|
||||
# endif
|
||||
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
|
||||
return fname;
|
||||
if (exe_flag && strchr(fname, '\\')) return fname;
|
||||
return (char *)fname;
|
||||
if (exe_flag && strchr(fname, '\\')) return (char *)fname;
|
||||
#endif
|
||||
|
||||
for (dp = path;; dp = ++ep) {
|
||||
|
|
|
|||
30
file.c
30
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);
|
||||
|
|
|
|||
2
intern.h
2
intern.h
|
|
@ -277,7 +277,7 @@ VALUE rb_hash_lookup _((VALUE, VALUE));
|
|||
VALUE rb_hash_aset _((VALUE, VALUE, VALUE));
|
||||
VALUE rb_hash_delete_if _((VALUE));
|
||||
VALUE rb_hash_delete _((VALUE,VALUE));
|
||||
int rb_path_check _((char*));
|
||||
int rb_path_check _((const char*));
|
||||
int rb_env_path_tainted _((void));
|
||||
/* io.c */
|
||||
#define rb_defout rb_stdout
|
||||
|
|
|
|||
13
io.c
13
io.c
|
|
@ -50,6 +50,9 @@
|
|||
#elif defined(HAVE_SYS_FCNTL_H)
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_OFF_T && !defined(off_t)
|
||||
# define off_t long
|
||||
|
|
@ -429,7 +432,10 @@ static int
|
|||
wsplit_p(rb_io_t *fptr)
|
||||
{
|
||||
FILE *f = GetWriteFile(fptr);
|
||||
#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK)
|
||||
int r;
|
||||
#endif
|
||||
|
||||
if (!(fptr->mode & FMODE_WSPLIT_INITIALIZED)) {
|
||||
struct stat buf;
|
||||
if (fstat(fileno(f), &buf) == 0 &&
|
||||
|
|
@ -1675,7 +1681,7 @@ rb_io_getline_fast(fptr, delim)
|
|||
|
||||
static int
|
||||
rscheck(rsptr, rslen, rs)
|
||||
char *rsptr;
|
||||
const char *rsptr;
|
||||
long rslen;
|
||||
VALUE rs;
|
||||
{
|
||||
|
|
@ -4522,7 +4528,10 @@ next_argv()
|
|||
FILE *fr = rb_fopen(fn, "r");
|
||||
|
||||
if (ruby_inplace_mode) {
|
||||
struct stat st, st2;
|
||||
struct stat st;
|
||||
#ifndef NO_SAFE_RENAME
|
||||
struct stat st2;
|
||||
#endif
|
||||
VALUE str;
|
||||
FILE *fw;
|
||||
|
||||
|
|
|
|||
10
marshal.c
10
marshal.c
|
|
@ -130,7 +130,7 @@ static void w_long _((long, struct dump_arg*));
|
|||
|
||||
static void
|
||||
w_nbyte(s, n, arg)
|
||||
char *s;
|
||||
const char *s;
|
||||
int n;
|
||||
struct dump_arg *arg;
|
||||
{
|
||||
|
|
@ -153,7 +153,7 @@ w_byte(c, arg)
|
|||
|
||||
static void
|
||||
w_bytes(s, n, arg)
|
||||
char *s;
|
||||
const char *s;
|
||||
int n;
|
||||
struct dump_arg *arg;
|
||||
{
|
||||
|
|
@ -354,7 +354,7 @@ w_symbol(id, arg)
|
|||
|
||||
static void
|
||||
w_unique(s, arg)
|
||||
char *s;
|
||||
const char *s;
|
||||
struct dump_arg *arg;
|
||||
{
|
||||
if (s[0] == '#') {
|
||||
|
|
@ -991,7 +991,7 @@ r_ivar(obj, arg)
|
|||
|
||||
static VALUE
|
||||
path2class(path)
|
||||
char *path;
|
||||
const char *path;
|
||||
{
|
||||
VALUE v = rb_path2class(path);
|
||||
|
||||
|
|
@ -1003,7 +1003,7 @@ path2class(path)
|
|||
|
||||
static VALUE
|
||||
path2module(path)
|
||||
char *path;
|
||||
const char *path;
|
||||
{
|
||||
VALUE v = rb_path2class(path);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ extern double atanh _((double));
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_CRYPT
|
||||
extern char *crypt _((char *, char *));
|
||||
extern char *crypt _((const char *, const char *));
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DUP2
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ File.foreach "config.status" do |line|
|
|||
next if /^\$ac_\w+$/ =~ val
|
||||
next if $install_name and /^RUBY_INSTALL_NAME$/ =~ name
|
||||
next if $so_name and /^RUBY_SO_NAME$/ =~ name
|
||||
next if /^(?:X|(?:MINI|RUN)RUBY$)/ =~ name
|
||||
if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val
|
||||
next if $install_name
|
||||
sep = %r"#{Regexp.quote($1)}"
|
||||
|
|
|
|||
10
pack.c
10
pack.c
|
|
@ -1884,8 +1884,8 @@ pack_unpack(str, fmt)
|
|||
|
||||
case 'P':
|
||||
if (sizeof(char *) <= send - s) {
|
||||
VALUE tmp = Qnil;
|
||||
char *t;
|
||||
VALUE tmp;
|
||||
|
||||
memcpy(&t, s, sizeof(char *));
|
||||
s += sizeof(char *);
|
||||
|
|
@ -1915,9 +1915,6 @@ pack_unpack(str, fmt)
|
|||
rb_raise(rb_eArgError, "non associated pointer");
|
||||
}
|
||||
}
|
||||
else {
|
||||
tmp = Qnil;
|
||||
}
|
||||
rb_ary_push(ary, tmp);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1929,7 +1926,7 @@ pack_unpack(str, fmt)
|
|||
if (send - s < sizeof(char *))
|
||||
break;
|
||||
else {
|
||||
VALUE tmp;
|
||||
VALUE tmp = Qnil;
|
||||
char *t;
|
||||
|
||||
memcpy(&t, s, sizeof(char *));
|
||||
|
|
@ -1954,9 +1951,6 @@ pack_unpack(str, fmt)
|
|||
rb_raise(rb_eArgError, "non associated pointer");
|
||||
}
|
||||
}
|
||||
else {
|
||||
tmp = Qnil;
|
||||
}
|
||||
rb_ary_push(ary, tmp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
parse.y
4
parse.y
|
|
@ -5891,6 +5891,10 @@ int
|
|||
ruby_parser_stack_on_heap()
|
||||
{
|
||||
#if defined(YYMALLOC)
|
||||
(void)rb_parser_realloc;
|
||||
(void)rb_parser_calloc;
|
||||
(void)nodetype;
|
||||
(void)nodeline;
|
||||
return Qfalse;
|
||||
#else
|
||||
return Qtrue;
|
||||
|
|
|
|||
12
process.c
12
process.c
|
|
@ -1024,9 +1024,11 @@ int
|
|||
rb_proc_exec(str)
|
||||
const char *str;
|
||||
{
|
||||
#ifndef _WIN32
|
||||
const char *s = str;
|
||||
char *ss, *t;
|
||||
char **argv, **a;
|
||||
#endif
|
||||
|
||||
while (*str && ISSPACE(*str))
|
||||
str++;
|
||||
|
|
@ -1089,7 +1091,9 @@ proc_spawn_v(argv, prog)
|
|||
char **argv;
|
||||
char *prog;
|
||||
{
|
||||
#if defined(__human68k__)
|
||||
char *extension;
|
||||
#endif
|
||||
int status;
|
||||
|
||||
if (!prog)
|
||||
|
|
@ -1405,12 +1409,12 @@ rb_syswait(pid)
|
|||
{
|
||||
static int overriding;
|
||||
#ifdef SIGHUP
|
||||
RETSIGTYPE (*hfunc)_((int));
|
||||
RETSIGTYPE (*hfunc)_((int)) = 0;
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
RETSIGTYPE (*qfunc)_((int));
|
||||
RETSIGTYPE (*qfunc)_((int)) = 0;
|
||||
#endif
|
||||
RETSIGTYPE (*ifunc)_((int));
|
||||
RETSIGTYPE (*ifunc)_((int)) = 0;
|
||||
int status;
|
||||
int i, hooked = Qfalse;
|
||||
|
||||
|
|
@ -1650,7 +1654,9 @@ rb_f_sleep(argc, argv)
|
|||
static VALUE
|
||||
proc_getpgrp()
|
||||
{
|
||||
#if defined(HAVE_GETPGRP) && defined(GETPGRP_VOID)
|
||||
int pgrp;
|
||||
#endif
|
||||
|
||||
rb_secure(2);
|
||||
#if defined(HAVE_GETPGRP) && defined(GETPGRP_VOID)
|
||||
|
|
|
|||
4
re.c
4
re.c
|
|
@ -623,7 +623,7 @@ make_regexp(s, len, flags)
|
|||
int flags;
|
||||
{
|
||||
Regexp *rp;
|
||||
char *err;
|
||||
const char *err;
|
||||
|
||||
/* Handle escaped characters first. */
|
||||
|
||||
|
|
@ -846,7 +846,7 @@ rb_reg_prepare_re(re)
|
|||
}
|
||||
|
||||
if (need_recompile) {
|
||||
char *err;
|
||||
const char *err;
|
||||
|
||||
if (FL_TEST(re, KCODE_FIXED))
|
||||
rb_kcode_set_option(re);
|
||||
|
|
|
|||
10
regex.c
10
regex.c
|
|
@ -164,7 +164,7 @@ static void store_jump _((char*, int, char*));
|
|||
static void insert_jump _((int, char*, char*, char*));
|
||||
static void store_jump_n _((char*, int, char*, unsigned));
|
||||
static void insert_jump_n _((int, char*, char*, char*, unsigned));
|
||||
static void insert_op _((int, char*, char*));
|
||||
/*static void insert_op _((int, char*, char*));*/
|
||||
static void insert_op_2 _((int, char*, char*, int, int));
|
||||
static int memcmp_translate _((unsigned char*, unsigned char*, int));
|
||||
|
||||
|
|
@ -508,6 +508,7 @@ utf8_firstbyte(c)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
print_mbc(c)
|
||||
unsigned int c;
|
||||
|
|
@ -538,6 +539,7 @@ print_mbc(c)
|
|||
printf("%c%c", (int)(c >> BYTEWIDTH), (int)(c &0xff));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the buffer isn't allocated when it comes in, use this. */
|
||||
#define INIT_BUF_SIZE 28
|
||||
|
|
@ -752,6 +754,7 @@ is_in_list(c, b)
|
|||
return is_in_list_sbc(c, b) || (current_mbctype ? is_in_list_mbc(c, b) : 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
print_partial_compiled_pattern(start, end)
|
||||
unsigned char *start;
|
||||
|
|
@ -1006,6 +1009,7 @@ print_compiled_pattern(bufp)
|
|||
|
||||
print_partial_compiled_pattern(buffer, buffer + bufp->used);
|
||||
}
|
||||
#endif
|
||||
|
||||
static char*
|
||||
calculate_must_string(start, end)
|
||||
|
|
@ -1208,7 +1212,7 @@ read_special(p, pend, pp)
|
|||
the `struct re_pattern_buffer' that bufp pointed to, after
|
||||
re_compile_pattern returns. */
|
||||
|
||||
char *
|
||||
const char *
|
||||
re_compile_pattern(pattern, size, bufp)
|
||||
const char *pattern;
|
||||
int size;
|
||||
|
|
@ -2580,6 +2584,7 @@ insert_jump_n(op, from, to, current_end, n)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* Open up space at location THERE, and insert operation OP.
|
||||
CURRENT_END gives the end of the storage in use, so
|
||||
we know how much data to copy up.
|
||||
|
|
@ -2599,6 +2604,7 @@ insert_op(op, there, current_end)
|
|||
|
||||
there[0] = (char)op;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Open up space at location THERE, and insert operation OP followed by
|
||||
|
|
|
|||
4
regex.h
4
regex.h
|
|
@ -184,7 +184,7 @@ typedef struct
|
|||
|
||||
#ifdef __STDC__
|
||||
|
||||
extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);
|
||||
extern const char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);
|
||||
void re_free_pattern (struct re_pattern_buffer *);
|
||||
/* Is this really advertised? */
|
||||
extern int re_adjust_startpos (struct re_pattern_buffer *, const char*, int, int, int);
|
||||
|
|
@ -205,7 +205,7 @@ extern int re_exec (const char *);
|
|||
|
||||
#else /* !__STDC__ */
|
||||
|
||||
extern char *re_compile_pattern ();
|
||||
extern const char *re_compile_pattern ();
|
||||
void re_free_regexp ();
|
||||
/* Is this really advertised? */
|
||||
extern int re_adjust_startpos ();
|
||||
|
|
|
|||
7
ruby.c
7
ruby.c
|
|
@ -809,6 +809,9 @@ proc_options(argc, argv)
|
|||
}
|
||||
else {
|
||||
script = argv[0];
|
||||
#if defined DOSISH || defined __CYGWIN__
|
||||
translate_char(argv[0], '\\', '/');
|
||||
#endif
|
||||
if (script[0] == '\0') {
|
||||
script = "-";
|
||||
}
|
||||
|
|
@ -825,10 +828,10 @@ proc_options(argc, argv)
|
|||
if (!script) script = argv[0];
|
||||
script = ruby_sourcefile = rb_source_filename(script);
|
||||
script_node = NEW_NEWLINE(0);
|
||||
}
|
||||
#if defined DOSISH || defined __CYGWIN__
|
||||
translate_char(script, '\\', '/');
|
||||
translate_char(ruby_sourcefile, '\\', '/');
|
||||
#endif
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
signal.c
4
signal.c
|
|
@ -685,11 +685,13 @@ struct trap_arg {
|
|||
VALUE sig, cmd;
|
||||
};
|
||||
|
||||
#if USE_TRAP_MASK
|
||||
# ifdef HAVE_SIGPROCMASK
|
||||
static sigset_t trap_last_mask;
|
||||
# else
|
||||
static int trap_last_mask;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static RETSIGTYPE sigexit _((int));
|
||||
static RETSIGTYPE
|
||||
|
|
@ -991,6 +993,7 @@ install_nativethread_sighandler(signum, handler)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SIGCLD) || defined(SIGCHLD)
|
||||
static void
|
||||
init_sigchld(sig)
|
||||
int sig;
|
||||
|
|
@ -1032,6 +1035,7 @@ init_sigchld(sig)
|
|||
trap_last_mask = mask;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Many operating systems allow signals to be sent to running
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ rb_f_sprintf(argc, argv)
|
|||
fval = RFLOAT(rb_Float(val))->value;
|
||||
#if defined(_WIN32) && !defined(__BORLANDC__)
|
||||
if (isnan(fval) || isinf(fval)) {
|
||||
char *expr;
|
||||
const char *expr;
|
||||
|
||||
if (isnan(fval)) {
|
||||
expr = "NaN";
|
||||
|
|
|
|||
2
string.c
2
string.c
|
|
@ -4479,7 +4479,7 @@ static VALUE
|
|||
rb_str_crypt(str, salt)
|
||||
VALUE str, salt;
|
||||
{
|
||||
extern char *crypt();
|
||||
extern char *crypt _((const char *, const char*));
|
||||
VALUE result;
|
||||
const char *s;
|
||||
|
||||
|
|
|
|||
5
time.c
5
time.c
|
|
@ -759,7 +759,10 @@ make_time_t(tptr, utc_p)
|
|||
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)
|
||||
|
|
|
|||
23
util.c
23
util.c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define RUBY_RELEASE_DATE "2008-06-06"
|
||||
#define RUBY_VERSION_CODE 187
|
||||
#define RUBY_RELEASE_CODE 20080606
|
||||
#define RUBY_PATCHLEVEL 8
|
||||
#define RUBY_PATCHLEVEL 9
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
|
|
@ -208,7 +209,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;
|
||||
|
|
@ -448,10 +449,6 @@ init_env(void)
|
|||
void
|
||||
NtInitialize(int *argc, char ***argv)
|
||||
{
|
||||
|
||||
WORD version;
|
||||
int ret;
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
static void set_pioinfo_extra(void);
|
||||
|
||||
|
|
@ -490,7 +487,7 @@ NtInitialize(int *argc, char ***argv)
|
|||
char *
|
||||
getlogin()
|
||||
{
|
||||
return NTLoginName;
|
||||
return (char *)NTLoginName;
|
||||
}
|
||||
|
||||
#define MAXCHILDNUM 256 /* max num of child processes */
|
||||
|
|
@ -505,15 +502,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)
|
||||
{
|
||||
|
|
@ -665,7 +653,7 @@ rb_w32_get_osfhandle(int fh)
|
|||
}
|
||||
|
||||
rb_pid_t
|
||||
pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
|
||||
pipe_exec(const char *cmd, int mode, FILE **fpr, FILE **fpw)
|
||||
{
|
||||
struct ChildRecord* child;
|
||||
HANDLE hReadIn, hReadOut;
|
||||
|
|
@ -804,7 +792,7 @@ pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
|
|||
extern VALUE rb_last_status;
|
||||
|
||||
int
|
||||
do_spawn(int mode, char *cmd)
|
||||
do_spawn(int mode, const char *cmd)
|
||||
{
|
||||
struct ChildRecord *child;
|
||||
DWORD exitcode;
|
||||
|
|
@ -841,7 +829,7 @@ do_spawn(int mode, char *cmd)
|
|||
}
|
||||
|
||||
int
|
||||
do_aspawn(int mode, char *prog, char **argv)
|
||||
do_aspawn(int mode, const char *prog, char **argv)
|
||||
{
|
||||
char *cmd, *p, *q, *s, **t;
|
||||
int len, n, bs, quote;
|
||||
|
|
@ -1211,7 +1199,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;
|
||||
|
|
@ -3936,9 +3924,7 @@ int
|
|||
rb_w32_utime(const char *path, struct utimbuf *times)
|
||||
{
|
||||
HANDLE hFile;
|
||||
SYSTEMTIME st;
|
||||
FILETIME atime, mtime;
|
||||
struct tm *tm;
|
||||
struct stat stat;
|
||||
int ret = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ struct timezone {
|
|||
#endif
|
||||
extern void NtInitialize(int *, char ***);
|
||||
extern int rb_w32_cmdvector(const char *, char ***);
|
||||
extern rb_pid_t pipe_exec(char *, int, FILE **, FILE **);
|
||||
extern rb_pid_t pipe_exec(const char *, int, FILE **, FILE **);
|
||||
extern int flock(int fd, int oper);
|
||||
extern int rb_w32_accept(int, struct sockaddr *, int *);
|
||||
extern int rb_w32_bind(int, struct sockaddr *, int);
|
||||
|
|
@ -206,8 +206,8 @@ extern int chown(const char *, int, int);
|
|||
extern int link(char *, char *);
|
||||
extern int gettimeofday(struct timeval *, struct timezone *);
|
||||
extern rb_pid_t waitpid (rb_pid_t, int *, int);
|
||||
extern int do_spawn(int, char *);
|
||||
extern int do_aspawn(int, char *, char **);
|
||||
extern int do_spawn(int, const char *);
|
||||
extern int do_aspawn(int, const char *, char **);
|
||||
extern int kill(int, int);
|
||||
extern int fcntl(int, int, ...);
|
||||
extern rb_pid_t rb_w32_getpid(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue