* 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
This commit is contained in:
naruse 2011-03-25 06:46:57 +00:00
Родитель e3c3733a30
Коммит 6b1cf264a8
10 изменённых файлов: 56 добавлений и 34 удалений

Просмотреть файл

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

Просмотреть файл

@ -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__)
{

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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));
}
/*

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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