1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

sprintf.c: coderange fix

* sprintf.c (ruby__sfvwrite): set buffer length and exclude
  uninitialized garbage to get correct coderange.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-08-15 07:23:38 +00:00
parent e7878d2082
commit bb545e2131
3 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,14 @@
Wed Aug 15 16:23:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (ruby__sfvwrite): set buffer length and exclude
uninitialized garbage to get correct coderange.
* sprintf.c (ruby__sfvextra): the result should be infected by the
given strings.
* sprintf.c (ruby__sfvwrite): set buffer length and exclude
uninitialized garbage to get correct coderange.
Wed Aug 15 16:20:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Aug 15 16:20:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (ID_H_TARGET): make timestamp file of id.h so that the * common.mk (ID_H_TARGET): make timestamp file of id.h so that the

View file

@ -1174,6 +1174,7 @@ ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
len -= n; len -= n;
} }
fp->_p = (unsigned char *)buf; fp->_p = (unsigned char *)buf;
rb_str_set_len(result, buf - RSTRING_PTR(result));
return 0; return 0;
} }

View file

@ -21,4 +21,11 @@ class Test_SPrintf < Test::Unit::TestCase
def test_inspect def test_inspect
assert_equal("{<#{self.class}:#{object_id}>}", Bug::Printf.v(self)) assert_equal("{<#{self.class}:#{object_id}>}", Bug::Printf.v(self))
end end
def test_encoding
def self.to_s
"\u{3042 3044 3046 3048 304a}"
end
assert_equal("<\u{3042 3044 3046 3048 304a}>", Bug::Printf.s(self))
end
end end