-C Remove\sa\sharmless\sunused\svariable\sfrom\sthe\sfp-speed-2.c\sbenchmark.
-D 2026-03-28T14:21:53.670
+C In\ssqlite3_str_vappendf(),\swrite\sfloating-point\srenderings\sdirectly\sinto\nthe\soutput\sbuffer,\ssaving\sa\smemcpy().
+D 2026-03-28T20:24:47.134
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd
F src/pragma.c 789ef67117b74b5be0a2db6681f7f0c55e6913791b9da309aefd280de2c8a74d
F src/prepare.c f6a6e28a281bd1d1da12f47d370a81af46159b40f73bf7fa0b276b664f9c8b7d
-F src/printf.c a440c004a3892cc3d334fa90e0ae59720918fe26c16942d4d45e2534640ce786
+F src/printf.c 3dc62b9608e75aabea38f83fa7ce004ce2de0cef957b99e9b70edff56be9a5e0
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/sqlite.h.in e7acbb01518f05c5a342149ec1eeb1afcdccf9b90a6e9770a4893ae9a3c756ae
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 1b7a0ee438bb5c2896d0609c537e917d8057b3340f6ad004d2de44f03e3d3cca
-F src/sqliteInt.h 9716721fb57e32938a1d30a84560ce7633c63860a2209e188c87afad15d4b464
+F src/sqliteInt.h 3ed075ef00be15203ef0560e316b7201c896801abb0c42c3cc444d6fd7c74147
F src/sqliteLimit.h c70656b67ab5b96741a8f1c812bdd80c81f2b1c1e443d0cc3ea8c33bb1f1a092
F src/status.c 7565d63a79aa2f326339a24a0461a60096d0bd2bce711fefb50b5c89335f3592
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 7d81ff4c509d4039ef9e2f1066284ec560131422db0cbffa7e1826d71bb8f8e1
-R f9e8bfd72c320957630f960480c7f849
+P ff9008e7615d877e6cc852c60097777006b274971646d368eaa56b99a7acf6c7
+R 17c8bb5bf63c6fdc308a7448452e8ccb
+T *branch * direct-printf
+T *sym-direct-printf *
+T -sym-trunk *
U drh
-Z 1dff429b17934e0b3d9099df4f195e64
+Z e912b19fcd984317ce0146494ddfd817
# Remove this line to create a well-formed Fossil manifest.
FpDecode s;
int iRound;
int j;
+ i64 szBufNeeded; /* Size needed to hold the output */
if( bArgList ){
realvalue = getDoubleArg(pArgList);
}else{
e2 = s.iDP - 1;
}
- bufpt = buf;
- {
- i64 szBufNeeded; /* Size of a temporary buffer needed */
- szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
- if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
- if( szBufNeeded > etBUFSIZE ){
- bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
- if( bufpt==0 ) return;
- }
+
+ szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+8;
+ if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
+ if( sqlite3StrAccumEnlargeIfNeeded(pAccum, szBufNeeded) ){
+ width = length = 0;
+ break;
}
- zOut = bufpt;
+ bufpt = zOut = pAccum->zText + pAccum->nChar;
+
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
/* The sign in front of the number */
if( prefix ){
*(bufpt++) = (char)(exp/10+'0'); /* 10's digit */
*(bufpt++) = (char)(exp%10+'0'); /* 1's digit */
}
- *bufpt = 0;
- /* The converted number is in buf[] and zero terminated. Output it.
- ** Note that the number is in the usual order, not reversed as with
- ** integer conversions. */
length = (int)(bufpt-zOut);
- bufpt = zOut;
-
- /* Special case: Add leading zeros if the flag_zeropad flag is
- ** set and we are not left justified */
- if( flag_zeropad && !flag_leftjustify && length < width){
- int i;
- int nPad = width - length;
- for(i=width; i>=nPad; i--){
- bufpt[i] = bufpt[i-nPad];
+ assert( length <= szBufNeeded );
+ if( length<width ){
+ i64 nPad = width - length;
+ if( flag_leftjustify ){
+ memset(bufpt, ' ', nPad);
+ }else if( !flag_zeropad ){
+ memmove(zOut+nPad, zOut, length);
+ memset(zOut, ' ', nPad);
+ }else{
+ int adj = prefix!=0;
+ memmove(zOut+nPad+adj, zOut+adj, length-adj);
+ memset(zOut+adj, '0', nPad);
}
- i = prefix!=0;
- while( nPad-- ) bufpt[i++] = '0';
length = width;
}
- break;
+ pAccum->nChar += length;
+ zOut[length] = 0;
+
+ /* Floating point conversions render directly into the output
+ ** buffer. Hence, don't just break out of the switch(). Bypass the
+ ** output buffer writing that occurs after the switch() by continuing
+ ** to the next character in the format string. */
+ continue;
}
case etSIZE:
if( !bArgList ){
i64 nCopyBytes;
if( nPrior > precision-1 ) nPrior = precision - 1;
nCopyBytes = length*nPrior;
- if( nCopyBytes + pAccum->nChar >= pAccum->nAlloc ){
- sqlite3StrAccumEnlarge(pAccum, nCopyBytes);
+ if( sqlite3StrAccumEnlargeIfNeeded(pAccum, nCopyBytes) ){
+ break;
}
- if( pAccum->accError ) break;
- sqlite3_str_append(pAccum,
+ sqlite3_str_append(pAccum,
&pAccum->zText[pAccum->nChar-nCopyBytes], nCopyBytes);
precision -= nPrior;
nPrior *= 2;
return (int)N;
}
+int sqlite3StrAccumEnlargeIfNeeded(StrAccum *p, i64 N){
+ if( N + p->nChar >= p->nAlloc ){
+ sqlite3StrAccumEnlarge(p, N);
+ }
+ return p->accError;
+}
+
/*
** Append N copies of character c to the given string buffer.
*/