ruby-changes:17582
From: nobu <ko1@a...>
Date: Mon, 25 Oct 2010 06:27:54 +0900 (JST)
Subject: [ruby-changes:17582] Ruby:r29587 (trunk): * vsnprintf.c (BSD_vfprintf): prec digits fractal part should be
nobu 2010-10-25 06:21:40 +0900 (Mon, 25 Oct 2010) New Revision: 29587 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29587 Log: * vsnprintf.c (BSD_vfprintf): prec digits fractal part should be appended to 0 if prec is given. [ruby-dev:42453] #3979 Modified files: trunk/ChangeLog trunk/test/ruby/test_sprintf.rb trunk/vsnprintf.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29586) +++ ChangeLog (revision 29587) @@ -1,3 +1,8 @@ +Mon Oct 25 06:21:35 2010 Nobuyoshi Nakada <nobu@r...> + + * vsnprintf.c (BSD_vfprintf): prec digits fractal part should be + appended to 0 if prec is given. [ruby-dev:42453] #3979 + Mon Oct 25 02:57:21 2010 Koichi Sasada <ko1@a...> * common.mk (run.gdb): Quit gdb on 'make gdb' when Index: vsnprintf.c =================================================================== --- vsnprintf.c (revision 29586) +++ vsnprintf.c (revision 29587) @@ -784,8 +784,10 @@ #ifdef FLOATING_POINT case 'a': case 'A': - if (prec >= 0) + if (prec >= 0) { + flags |= ALT; prec++; + } goto fp_begin; case 'e': /* anomalous precision */ case 'E': Index: test/ruby/test_sprintf.rb =================================================================== --- test/ruby/test_sprintf.rb (revision 29586) +++ test/ruby/test_sprintf.rb (revision 29587) @@ -230,6 +230,10 @@ assert_equal("0x1.p+0", sprintf("%#.0a", 1), bug3965) assert_equal("0x00000000000000.p+0", sprintf("%#020a", 0), bug3965) assert_equal("0x0000.0000000000p+0", sprintf("%#020.10a", 0), bug3965) + + bug3979 = '[ruby-dev:42453]' + assert_equal(" 0x0.000p+0", sprintf("%20.3a", 0), bug3979) + assert_equal(" 0x1.000p+0", sprintf("%20.3a", 1), bug3979) end BSIZ = 120 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/