summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--include/ruby/util.h4
-rw-r--r--parse.y20
-rw-r--r--re.c8
-rw-r--r--ruby.c6
-rw-r--r--util.c4
6 files changed, 23 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d295a7..71f8e00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Mar 14 18:25:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.
+
Sat Mar 14 18:18:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (rb_proc_call, rb_node_arity, bmcall, curry): checks
diff --git a/include/ruby/util.h b/include/ruby/util.h
index 6badca8..febd87d 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -41,9 +41,9 @@ extern "C" {
#endif
#define scan_oct ruby_scan_oct
-unsigned long ruby_scan_oct(const char *, int, int *);
+unsigned long ruby_scan_oct(const char *, size_t, size_t *);
#define scan_hex ruby_scan_hex
-unsigned long ruby_scan_hex(const char *, int, int *);
+unsigned long ruby_scan_hex(const char *, size_t, size_t *);
#if defined(__CYGWIN32__) || defined(_WIN32)
void ruby_add_suffix(VALUE str, const char *suffix);
diff --git a/parse.y b/parse.y
index 01a948e..5f3d51f 100644
--- a/parse.y
+++ b/parse.y
@@ -5288,7 +5288,7 @@ parser_tokadd(struct parser_params *parser, int c)
}
static int
-parser_tok_hex(struct parser_params *parser, int *numlen)
+parser_tok_hex(struct parser_params *parser, size_t *numlen)
{
int c;
@@ -5315,7 +5315,7 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp,
*/
int codepoint;
- int numlen;
+ size_t numlen;
if (regexp_literal) { tokadd('\\'); tokadd('u'); }
@@ -5393,7 +5393,7 @@ parser_read_escape(struct parser_params *parser, int flags,
rb_encoding **encp)
{
int c;
- int numlen;
+ size_t numlen;
switch (c = nextc()) {
case '\\': /* Backslash */
@@ -5423,13 +5423,9 @@ parser_read_escape(struct parser_params *parser, int flags,
case '0': case '1': case '2': case '3': /* octal constant */
case '4': case '5': case '6': case '7':
if (flags & (ESCAPE_CONTROL|ESCAPE_META)) goto eof;
- {
- int numlen;
-
- pushback(c);
- c = scan_oct(lex_p, 3, &numlen);
- lex_p += numlen;
- }
+ pushback(c);
+ c = scan_oct(lex_p, 3, &numlen);
+ lex_p += numlen;
return c;
case 'x': /* hex constant */
@@ -5505,7 +5501,7 @@ parser_tokadd_escape(struct parser_params *parser, rb_encoding **encp)
case '4': case '5': case '6': case '7':
if (flags & (ESCAPE_CONTROL|ESCAPE_META)) goto eof;
{
- int numlen;
+ size_t numlen;
int oct;
oct = scan_oct(--lex_p, 3, &numlen);
@@ -5518,7 +5514,7 @@ parser_tokadd_escape(struct parser_params *parser, rb_encoding **encp)
case 'x': /* hex constant */
if (flags & (ESCAPE_CONTROL|ESCAPE_META)) goto eof;
{
- int numlen;
+ size_t numlen;
int hex;
hex = tok_hex(&numlen);
diff --git a/re.c b/re.c
index 8cbcd26..5f1accf 100644
--- a/re.c
+++ b/re.c
@@ -1842,7 +1842,7 @@ read_escaped_byte(const char **pp, const char *end, onig_errmsg_buffer err)
const char *p = *pp;
int code;
int meta_prefix = 0, ctrl_prefix = 0;
- int len;
+ size_t len;
int retbyte;
retbyte = -1;
@@ -2041,7 +2041,7 @@ unescape_unicode_list(const char **pp, const char *end,
const char *p = *pp;
int has_unicode = 0;
unsigned long code;
- int len;
+ size_t len;
while (p < end && ISSPACE(*p)) p++;
@@ -2076,7 +2076,7 @@ unescape_unicode_bmp(const char **pp, const char *end,
VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
{
const char *p = *pp;
- int len;
+ size_t len;
unsigned long code;
if (end < p+4) {
@@ -2131,7 +2131,7 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
case '1': case '2': case '3':
case '4': case '5': case '6': case '7': /* \O, \OO, \OOO or backref */
{
- int octlen;
+ size_t octlen;
if (ruby_scan_oct(p-1, end-(p-1), &octlen) <= 0177) {
/* backref or 7bit octal.
no need to unescape anyway.
diff --git a/ruby.c b/ruby.c
index 0fff003..29cefed 100644
--- a/ruby.c
+++ b/ruby.c
@@ -699,7 +699,7 @@ proc_options(int argc, char **argv, struct cmdline_options *opt, int envopt)
case 'W':
{
- int numlen;
+ size_t numlen;
int v = 2; /* -W as -W2 */
if (*++s) {
@@ -861,7 +861,7 @@ proc_options(int argc, char **argv, struct cmdline_options *opt, int envopt)
case 'T':
{
- int numlen;
+ size_t numlen;
int v = 1;
if (*++s) {
@@ -887,7 +887,7 @@ proc_options(int argc, char **argv, struct cmdline_options *opt, int envopt)
case '0':
if (envopt) goto noenvopt;
{
- int numlen;
+ size_t numlen;
int v;
char c;
diff --git a/util.c b/util.c
index 99e04e7..fad309c 100644
--- a/util.c
+++ b/util.c
@@ -24,7 +24,7 @@
#include "ruby/util.h"
unsigned long
-ruby_scan_oct(const char *start, int len, int *retlen)
+ruby_scan_oct(const char *start, size_t len, size_t *retlen)
{
register const char *s = start;
register unsigned long retval = 0;
@@ -38,7 +38,7 @@ ruby_scan_oct(const char *start, int len, int *retlen)
}
unsigned long
-ruby_scan_hex(const char *start, int len, int *retlen)
+ruby_scan_hex(const char *start, size_t len, size_t *retlen)
{
static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
register const char *s = start;