summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-25 06:46:57 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-25 06:46:57 +0000
commit6b1cf264a80f2efe6a4b42553b8bf2e16f51690a (patch)
treede2cec1bac93bf9b8a5807f7da3a21c04756f19c
parente3c3733a30091958cb00bc1a2e4f0882fe6d59d6 (diff)
* ext/sdbm/_sdbm.c (sdbm_open): use size_t.
* ext/syck/bytecode.c: ditto. * ext/sdbm/_sdbm.c (delpair): use ptrdiff_t. * ext/sdbm/init.c: use RSTRING_LENINT. * ext/dl/handle.c: suppress warning: shorten-64-to-32. * ext/strscan/strscan.c: ditto. * ext/syck/emitter.c: ditto. * ext/syck/implicit.c: ditto. * ext/syck/syck.c: ditto. * ext/syck/token.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog22
-rw-r--r--ext/dl/handle.c2
-rw-r--r--ext/sdbm/_sdbm.c8
-rw-r--r--ext/sdbm/init.c20
-rw-r--r--ext/strscan/strscan.c4
-rw-r--r--ext/syck/bytecode.c2
-rw-r--r--ext/syck/emitter.c6
-rw-r--r--ext/syck/implicit.c12
-rw-r--r--ext/syck/syck.c2
-rw-r--r--ext/syck/token.c12
10 files changed, 56 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 0493c06..73c3dc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Fri Mar 25 15:42:17 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/sdbm/_sdbm.c (sdbm_open): use size_t.
+
+ * ext/syck/bytecode.c: ditto.
+
+ * ext/sdbm/_sdbm.c (delpair): use ptrdiff_t.
+
+ * ext/sdbm/init.c: use RSTRING_LENINT.
+
+ * ext/dl/handle.c: suppress warning: shorten-64-to-32.
+
+ * ext/strscan/strscan.c: ditto.
+
+ * ext/syck/emitter.c: ditto.
+
+ * ext/syck/implicit.c: ditto.
+
+ * ext/syck/syck.c: ditto.
+
+ * ext/syck/token.c: ditto.
+
Fri Mar 25 12:14:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: import nkf 7f18e30.
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index 6fc771c..ce04acb 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -310,7 +310,7 @@ dlhandle_sym(void *handle, const char *name)
#if defined(FUNC_STDCALL)
if( !func ){
int i;
- int len = strlen(name);
+ int len = (int)strlen(name);
char *name_n;
#if defined(__CYGWIN__) || defined(_WIN32) || defined(__MINGW32__)
{
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 5e2b8cc..28e5b03 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -155,7 +155,7 @@ sdbm_open(register char *file, register int flags, register int mode)
register DBM *db;
register char *dirname;
register char *pagname;
- register int n;
+ register size_t n;
if (file == NULL || !*file)
return errno = EINVAL, (DBM *) NULL;
@@ -164,7 +164,7 @@ sdbm_open(register char *file, register int flags, register int mode)
*/
n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
- if ((dirname = malloc((unsigned) n)) == NULL)
+ if ((dirname = malloc(n)) == NULL)
return errno = ENOMEM, (DBM *) NULL;
/*
* build the file names
@@ -755,9 +755,9 @@ delpair(char *pag, datum key)
register int m;
register char *dst = pag + (i == 1 ? PBLKSIZ : GET_SHORT(ino,i - 1));
register char *src = pag + GET_SHORT(ino,i + 1);
- register int zoo = dst - src;
+ register ptrdiff_t zoo = dst - src;
- debug(("free-up %d ", zoo));
+ debug(("free-up %"PRIdPTRDIFF" ", zoo));
/*
* shift data/keys down
*/
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index fdb7fd4..6a02e1e 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -145,7 +145,7 @@ fsdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
value = sdbm_fetch(dbm, key);
@@ -185,7 +185,7 @@ fsdbm_key(VALUE obj, VALUE valstr)
ExportStringValue(valstr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
@@ -259,7 +259,7 @@ fsdbm_delete(VALUE obj, VALUE keystr)
fdbm_modify(obj);
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
@@ -334,13 +334,13 @@ fsdbm_delete_if(VALUE obj)
keystr = RARRAY_PTR(ary)[i];
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
if (sdbm_delete(dbm, key)) {
rb_raise(rb_eDBMError, "sdbm_delete failed");
}
}
if (status) rb_jump_tag(status);
- if (n > 0) dbmp->di_size = n - RARRAY_LEN(ary);
+ if (n > 0) dbmp->di_size = n - RARRAY_LENINT(ary);
return obj;
}
@@ -401,10 +401,10 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
ExportStringValue(valstr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
@@ -588,7 +588,7 @@ fsdbm_has_key(VALUE obj, VALUE keystr)
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
- key.dsize = RSTRING_LEN(keystr);
+ key.dsize = RSTRING_LENINT(keystr);
GetDBM2(obj, dbmp, dbm);
val = sdbm_fetch(dbm, key);
@@ -605,12 +605,12 @@ fsdbm_has_value(VALUE obj, VALUE valstr)
ExportStringValue(valstr);
val.dptr = RSTRING_PTR(valstr);
- val.dsize = RSTRING_LEN(valstr);
+ val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
val = sdbm_fetch(dbm, key);
- if (val.dsize == RSTRING_LEN(valstr) &&
+ if (val.dsize == RSTRING_LENINT(valstr) &&
memcmp(val.dptr, RSTRING_PTR(valstr), val.dsize) == 0)
return Qtrue;
}
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 2bf1a4f..41e08f6 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -405,7 +405,7 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
struct strscanner *p;
regex_t *re;
- int ret;
+ long ret;
int tmpreg;
Check_Type(regex, T_REGEXP);
@@ -655,7 +655,7 @@ static void
adjust_registers_to_matched(struct strscanner *p)
{
onig_region_clear(&(p->regs));
- onig_region_set(&(p->regs), 0, 0, p->curr - p->prev);
+ onig_region_set(&(p->regs), 0, 0, (int)(p->curr - p->prev));
}
/*
diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c
index 5cddb22..3310713 100644
--- a/ext/syck/bytecode.c
+++ b/ext/syck/bytecode.c
@@ -325,7 +325,7 @@ yy24:
CHK_NL(YYCURSOR);
if ( qstr[0] == '!' )
{
- int qidx = strlen( qstr );
+ size_t qidx = strlen( qstr );
if ( qstr[1] == '\0' )
{
free( qstr );
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
index 985bfb2..af0d789 100644
--- a/ext/syck/emitter.c
+++ b/ext/syck/emitter.c
@@ -450,7 +450,7 @@ void syck_emit_tag( SyckEmitter *e, const char *tag, const char *ignore )
/* global types */
} else if ( strncmp( tag, "tag:", 4 ) == 0 ) {
- int taglen = strlen( tag );
+ int taglen = (int)strlen( tag );
syck_emitter_write( e, "!", 1 );
if ( strncmp( tag + 4, YAML_DOMAIN, strlen( YAML_DOMAIN ) ) == 0 ) {
int skip = 4 + strlen( YAML_DOMAIN ) + 1;
@@ -662,7 +662,7 @@ void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_
match_implicit = syck_match_implicit( str, len );
/* quote strings which default to implicits */
- implicit = syck_taguri( YAML_DOMAIN, match_implicit, strlen( match_implicit ) );
+ implicit = syck_taguri( YAML_DOMAIN, match_implicit, (int)strlen( match_implicit ) );
if ( syck_tagcmp( tag, implicit ) != 0 && syck_tagcmp( tag, "tag:yaml.org,2002:str" ) == 0 ) {
force_style = scalar_2quote;
} else {
@@ -1231,7 +1231,7 @@ syck_emitter_mark_node( SyckEmitter *e, st_data_t n )
/*
* Second time hitting this object, let's give it an anchor
*/
- idx = e->anchors->num_entries + 1;
+ idx = (int)(e->anchors->num_entries + 1);
anchor_name = S_ALLOC_N( char, strlen( anc ) + 10 );
S_MEMZERO( anchor_name, char, strlen( anc ) + 10 );
sprintf( anchor_name, anc, idx );
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
index 7d40747..6911e61 100644
--- a/ext/syck/implicit.c
+++ b/ext/syck/implicit.c
@@ -38,9 +38,9 @@ try_tag_implicit( SyckNode *n, int taguri )
if ( n->type_id != NULL ) S_FREE( n->type_id );
if ( taguri == 1 )
{
- n->type_id = syck_taguri( YAML_DOMAIN, tid, strlen( tid ) );
+ n->type_id = syck_taguri( YAML_DOMAIN, tid, (int)strlen( tid ) );
} else {
- n->type_id = syck_strndup( tid, strlen( tid ) );
+ n->type_id = syck_strndup( tid, (int)strlen( tid ) );
}
}
@@ -1764,7 +1764,7 @@ yy205: yyaccept = 0;
}
yy206:
#line 202 "implicit.re"
-{ return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); }
+{ return syck_taguri( YAML_DOMAIN, type_id, (int)strlen( type_id ) ); }
#line 1768 "<stdout>"
yy207: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -1838,7 +1838,7 @@ yy208: ++YYCURSOR;
goto yy209;
yy209:
#line 176 "implicit.re"
-{ return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); }
+{ return syck_xprivate( type_id + 1, (int)strlen( type_id ) - 1 ); }
#line 1842 "<stdout>"
yy210: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -2141,7 +2141,7 @@ yy219:
strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
strcat( domain, "." );
strcat( domain, YAML_DOMAIN );
- uri = syck_taguri( domain, YYCURSOR, YYLIMIT - YYCURSOR );
+ uri = syck_taguri( domain, YYCURSOR, (int)(YYLIMIT - YYCURSOR) );
S_FREE( domain );
return uri;
@@ -2357,7 +2357,7 @@ yy230:
domain[0] = '\0';
strncat( domain, type_id, ( YYCURSOR - type_id ) - 1 );
- uri = syck_taguri( domain, YYCURSOR, YYLIMIT - YYCURSOR );
+ uri = syck_taguri( domain, YYCURSOR, (int)(YYLIMIT - YYCURSOR) );
S_FREE( domain );
return uri;
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index 6ae48a7..94e3992 100644
--- a/ext/syck/syck.c
+++ b/ext/syck/syck.c
@@ -186,7 +186,7 @@ syck_add_sym( SyckParser *p, void *data )
}
id = p->syms->num_entries + 1;
st_insert( p->syms, id, (st_data_t)data );
- return id;
+ return (int)id;
}
int
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 1521c54..bea79c1 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -207,7 +207,7 @@
} \
else if ( *YYLINEPTR == ' ' ) \
{ \
- ict = YYCURSOR - YYLINEPTR; \
+ ict = (int)(YYCURSOR - YYLINEPTR); \
}
/*
@@ -377,7 +377,7 @@ yy12: ++YYCURSOR;
goto yy16;
yy13:
#line 370 "token.re"
-{ doc_level = YYCURSOR - YYLINEPTR;
+{ doc_level = (int)(YYCURSOR - YYLINEPTR);
goto Header;
}
#line 384 "<stdout>"
@@ -1037,16 +1037,16 @@ yy81: ++YYCURSOR;
goto yy82;
yy82:
#line 441 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
+{ ENSURE_YAML_IOPEN(lvl, (int)(YYTOKEN - YYLINEPTR), 1);
FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
- ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_seq);
+ ADD_LEVEL((int)((YYTOKEN + 1) - YYLINEPTR), syck_lvl_seq);
}
else /* spaces followed by content uses the space as indentation */
{
- ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_seq);
+ ADD_LEVEL((int)(YYCURSOR - YYLINEPTR), syck_lvl_seq);
}
return YYTOKEN[0];
}
@@ -2363,7 +2363,7 @@ ScalarBlock:
}
else if ( isdigit( *yyt ) )
{
- forceIndent = strtol( yyt, NULL, 10 );
+ forceIndent = rb_long2int(strtol( yyt, NULL, 10 ));
}
}