From: Hugo van der Sanden Date: Mon, 10 Feb 2003 21:59:34 +0000 (+0000) Subject: Fix for [perl #20339]: "%lf" rejected as invalid by recent sprintf. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=00e17364bade89e3a71981168e34fb6160652b0a;p=p5sagit%2Fp5-mst-13.2.git Fix for [perl #20339]: "%lf" rejected as invalid by recent sprintf. Now allows but ignores the 'l' modifier on floating point formats and adds a couple of tests. p4raw-id: //depot/perl@18689 --- diff --git a/sv.c b/sv.c index 6eef626..37e1492 100644 --- a/sv.c +++ b/sv.c @@ -8813,6 +8813,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV intsize = 'q'; #endif break; +/* [perl #20339] - we should accept and ignore %hf, %lf rather than die */ + case 'l': + /* FALL THROUGH */ default: #if defined(USE_LONG_DOUBLE) intsize = args ? 0 : 'q'; @@ -8825,8 +8828,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV /* FALL THROUGH */ #endif case 'h': - /* FALL THROUGH */ - case 'l': goto unknown; } diff --git a/t/op/sprintf.t b/t/op/sprintf.t index b23978c..2eaa2e4 100755 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -273,6 +273,8 @@ __END__ >%.0f< >-1.6< >-2< >%.0f< >1< >1< >%#.0f< >1< >1.< +>%.0lf< >1< >1< >'l' should have no effect< +>%.0hf< >1< >%.0hf INVALID< >'h' should be rejected< >%g< >12345.6789< >12345.7< >%+g< >12345.6789< >+12345.7< >%#g< >12345.6789< >12345.7<