mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (file_expand_path): suppress a warning. named magic
numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e5edfbf207
commit
17aa3d898d
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 10:29:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* thread.c (thread_start_func_2): do not delete main thread from
|
||||
|
|
14
file.c
14
file.c
|
@ -2780,7 +2780,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
|
|||
}
|
||||
#if USE_NTFS
|
||||
else {
|
||||
do *++s; while (istrailinggabage(*s));
|
||||
do ++s; while (istrailinggabage(*s));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -2831,12 +2831,18 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE 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