Skip to content

Commit 0bec319

Browse files
committed
merge revision(s) 16618:
* file.c (BUFCHECK): wrong condition. [ruby-core:16921] * file.c (file_expand_buf): shouldn't use buflen for length of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent dc2d035 commit 0bec319

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Sun Jun 15 23:21:48 2008 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* file.c (BUFCHECK): wrong condition. [ruby-core:16921]
4+
5+
* file.c (file_expand_buf): shouldn't use buflen for length of string.
6+
17
Sun Jun 15 23:20:37 2008 Akinori MUSHA <knu@iDaemons.org>
28

39
* marshal.c (r_object0, Init_marshal): Fix the garbled s_call

file.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,8 +2520,12 @@ ntfs_tail(const char *path)
25202520

25212521
#define BUFCHECK(cond) do {\
25222522
long bdiff = p - buf;\
2523-
while (cond) {\
2524-
buflen *= 2;\
2523+
if (cond) {\
2524+
do {buflen *= 2;} while (cond);\
2525+
rb_str_resize(result, buflen);\
2526+
buf = RSTRING(result)->ptr;\
2527+
p = buf + bdiff;\
2528+
pend = buf + buflen;\
25252529
}\
25262530
rb_str_resize(result, buflen);\
25272531
buf = RSTRING(result)->ptr;\
@@ -2762,7 +2766,6 @@ file_expand_path(fname, dname, result)
27622766
p += s-b;
27632767
}
27642768
if (p == skiproot(buf) - 1) p++;
2765-
buflen = p - buf;
27662769

27672770
#if USE_NTFS
27682771
*p = '\0';
@@ -2811,13 +2814,14 @@ file_expand_path(fname, dname, result)
28112814
buflen = ++p - buf + len;
28122815
rb_str_resize(result, buflen);
28132816
memcpy(p, wfd.cFileName, len + 1);
2817+
p += len;
28142818
}
28152819
}
28162820
#endif
28172821

28182822
if (tainted) OBJ_TAINT(result);
2819-
RSTRING(result)->len = buflen;
2820-
RSTRING(result)->ptr[buflen] = '\0';
2823+
RSTRING(result)->len = p - buf;
2824+
RSTRING(result)->ptr[p - buf] = '\0';
28212825
return result;
28222826
}
28232827

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2008-06-15"
33
#define RUBY_VERSION_CODE 185
44
#define RUBY_RELEASE_CODE 20080615
5-
#define RUBY_PATCHLEVEL 216
5+
#define RUBY_PATCHLEVEL 217
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)