mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* file.c (file_expand_path): suppress a warning. named magic
numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3a6cf6d41e
commit
0550f4cdfa
2 changed files with 15 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Feb 18 12:00:58 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (file_expand_path): suppress a warning. named magic
|
||||
numbers.
|
||||
|
||||
Wed Feb 18 01:58:11 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/etc/etc.c (sGroup): getgrent may not be available.
|
||||
|
|
14
file.c
14
file.c
|
@ -2661,7 +2661,7 @@ file_expand_path(fname, dname, result)
|
|||
}
|
||||
#if USE_NTFS
|
||||
else {
|
||||
do *++s; while (istrailinggabage(*s));
|
||||
do ++s; while (istrailinggabage(*s));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -2712,12 +2712,18 @@ file_expand_path(fname, dname, result)
|
|||
|
||||
if (s > b) {
|
||||
#if USE_NTFS
|
||||
static const char prime[] = ":$DATA";
|
||||
enum {prime_len = sizeof(prime) -1};
|
||||
endpath:
|
||||
if (s > b + 6 && strncasecmp(s - 6, ":$DATA", 6) == 0) {
|
||||
if (s > b + prime_len && strncasecmp(s - prime_len, prime, prime_len) == 0) {
|
||||
/* alias of stream */
|
||||
/* get rid of a bug of x64 VC++ */
|
||||
if (*(s-7) == ':') s -= 7; /* prime */
|
||||
else if (memchr(b, ':', s - 6 - b)) s -= 6; /* alternative */
|
||||
if (*(s - (prime_len+1)) == ':') {
|
||||
s -= prime_len + 1; /* prime */
|
||||
}
|
||||
else if (memchr(b, ':', s - prime_len - b)) {
|
||||
s -= prime_len; /* alternative */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
BUFCHECK(bdiff + (s-b) >= buflen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue