* util.c (ruby_add_suffix): fixed type warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4bf3cb5ba9
commit
e4820b1cfa
@ -1,3 +1,7 @@
|
|||||||
|
Sat Jul 17 14:10:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* util.c (ruby_add_suffix): fixed type warnings.
|
||||||
|
|
||||||
Sat Jul 17 13:48:22 2010 Tanaka Akira <akr@fsij.org>
|
Sat Jul 17 13:48:22 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/pathname/lib/pathname.rb: moved from lib/pathname.rb.
|
* ext/pathname/lib/pathname.rb: moved from lib/pathname.rb.
|
||||||
|
10
util.c
10
util.c
@ -266,9 +266,8 @@ extern const char *ruby_find_extname(const char *, long *);
|
|||||||
void
|
void
|
||||||
ruby_add_suffix(VALUE str, const char *suffix)
|
ruby_add_suffix(VALUE str, const char *suffix)
|
||||||
{
|
{
|
||||||
int baselen;
|
long baselen;
|
||||||
int extlen = strlen(suffix);
|
long extlen = strlen(suffix);
|
||||||
char *p, *q;
|
|
||||||
long slen;
|
long slen;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -299,11 +298,12 @@ ruby_add_suffix(VALUE str, const char *suffix)
|
|||||||
rb_str_cat(str, suffix, extlen);
|
rb_str_cat(str, suffix, extlen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
char *p = buf, *q;
|
||||||
strncpy(buf, name, slen);
|
strncpy(buf, name, slen);
|
||||||
if (ext)
|
if (ext)
|
||||||
p = buf + (ext - name);
|
p += (ext - name);
|
||||||
else
|
else
|
||||||
p = buf + slen;
|
p += slen;
|
||||||
p[len] = '\0';
|
p[len] = '\0';
|
||||||
if (suffix[1] == '\0') { /* Style 2 */
|
if (suffix[1] == '\0') { /* Style 2 */
|
||||||
if (len <= 3) {
|
if (len <= 3) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user