* 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:
nobu 2009-02-18 03:01:03 +00:00
parent 3a6cf6d41e
commit 0550f4cdfa
2 changed files with 15 additions and 4 deletions

View file

@ -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> Wed Feb 18 01:58:11 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/etc/etc.c (sGroup): getgrent may not be available. * ext/etc/etc.c (sGroup): getgrent may not be available.

14
file.c
View file

@ -2661,7 +2661,7 @@ file_expand_path(fname, dname, result)
} }
#if USE_NTFS #if USE_NTFS
else { else {
do *++s; while (istrailinggabage(*s)); do ++s; while (istrailinggabage(*s));
} }
#endif #endif
break; break;
@ -2712,12 +2712,18 @@ file_expand_path(fname, dname, result)
if (s > b) { if (s > b) {
#if USE_NTFS #if USE_NTFS
static const char prime[] = ":$DATA";
enum {prime_len = sizeof(prime) -1};
endpath: 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 */ /* alias of stream */
/* get rid of a bug of x64 VC++ */ /* get rid of a bug of x64 VC++ */
if (*(s-7) == ':') s -= 7; /* prime */ if (*(s - (prime_len+1)) == ':') {
else if (memchr(b, ':', s - 6 - b)) s -= 6; /* alternative */ s -= prime_len + 1; /* prime */
}
else if (memchr(b, ':', s - prime_len - b)) {
s -= prime_len; /* alternative */
}
} }
#endif #endif
BUFCHECK(bdiff + (s-b) >= buflen); BUFCHECK(bdiff + (s-b) >= buflen);