1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* util.c (ruby_scan_oct, ruby_scan_hex): use size_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-14 09:25:20 +00:00
parent eca77cc85c
commit 4de12b6ae9
6 changed files with 23 additions and 23 deletions

View file

@ -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

View file

@ -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);

20
parse.y
View file

@ -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);

8
re.c
View file

@ -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.

6
ruby.c
View file

@ -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;

4
util.c
View file

@ -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;