Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit206b1e5

Browse files
committed
Fix our printf implementation to follow spec: if a star parameter
value for a precision is negative, act as though precision weren'tspecified at all, that is the whole .* part of the format spec shouldbe ignored. Our previous coding took it as .0 which is certainlywrong. Per report from Kris Jurka and local testing.Possibly this should be back-patched, but it would be good to getsome more testing first; in any case there are no known cases wherethere's really a problem on the backend side.
1 parent9706f54 commit206b1e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/port/snprintf.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2828
* SUCH DAMAGE.
2929
*
30-
* $PostgreSQL: pgsql/src/port/snprintf.c,v 1.34 2007/03/26 21:44:11 momjian Exp $
30+
* $PostgreSQL: pgsql/src/port/snprintf.c,v 1.35 2008/03/18 01:49:44 tgl Exp $
3131
*/
3232

3333
#include"c.h"
@@ -565,7 +565,10 @@ dopr(PrintfTarget *target, const char *format, va_list args)
565565
{
566566
precision=starval;
567567
if (precision<0)
568+
{
568569
precision=0;
570+
pointflag=0;
571+
}
569572
}
570573
else
571574
{
@@ -590,7 +593,10 @@ dopr(PrintfTarget *target, const char *format, va_list args)
590593
{
591594
precision=starval;
592595
if (precision<0)
596+
{
593597
precision=0;
598+
pointflag=0;
599+
}
594600
}
595601
else
596602
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp