1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Additional test cases for tkt2822. Fix a related bug in printf(). (CVS 4624)

FossilOrigin-Name: 8f184e40ff79c3c5ef98337615f58a4a6d0249dd
This commit is contained in:
drh
2007-12-13 17:50:22 +00:00
parent 61116ae1ca
commit 43f6e06460
4 changed files with 191 additions and 20 deletions

View File

@@ -414,6 +414,13 @@ static void vxprintf(
}
bufpt = &buf[etBUFSIZE-1];
if( xtype==etORDINAL ){
static const char zOrd[] = "thstndrd";
int x = longvalue % 10;
if( x>=4 || (longvalue/10)%10==1 ){
x = 0;
}
buf[etBUFSIZE-3] = zOrd[x*2];
buf[etBUFSIZE-2] = zOrd[x*2+1];
bufpt -= 2;
}
{
@@ -426,13 +433,6 @@ static void vxprintf(
longvalue = longvalue/base;
}while( longvalue>0 );
}
if( xtype==etORDINAL ){
static const char zOrd[] = "thstndrd";
int x = buf[etBUFSIZE-4] - '0';
if( x>=4 ) x = 0;
buf[etBUFSIZE-3] = zOrd[x*2];
buf[etBUFSIZE-2] = zOrd[x*2+1];
}
length = &buf[etBUFSIZE-1]-bufpt;
for(idx=precision-length; idx>0; idx--){
*(--bufpt) = '0'; /* Zero pad */