aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <>2025-02-25 11:47:34 +0000
committerdrh <>2025-02-25 11:47:34 +0000
commita357a90f12e927ec169168cd89e54dc4fa905717 (patch)
tree17d1145c01c157b77094b27a4ae59765ed9b6b2d /src/printf.c
parentc46fbec350c4a0a71410bd32384e59ac27a799d5 (diff)
downloadsqlite-a357a90f12e927ec169168cd89e54dc4fa905717.tar.gz
sqlite-a357a90f12e927ec169168cd89e54dc4fa905717.zip
Consolidate two different UTF8 encoders into a single subroutine.
FossilOrigin-Name: 6208e494858b9d362efc7db4e8aac6f8e93fe51d2e038c94dfa97c55a74688a0
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/printf.c b/src/printf.c
index 2b4ccf259..30c4ec605 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -673,25 +673,7 @@ void sqlite3_str_vappendf(
}
}else{
unsigned int ch = va_arg(ap,unsigned int);
- if( ch<0x00080 ){
- buf[0] = ch & 0xff;
- length = 1;
- }else if( ch<0x00800 ){
- buf[0] = 0xc0 + (u8)((ch>>6)&0x1f);
- buf[1] = 0x80 + (u8)(ch & 0x3f);
- length = 2;
- }else if( ch<0x10000 ){
- buf[0] = 0xe0 + (u8)((ch>>12)&0x0f);
- buf[1] = 0x80 + (u8)((ch>>6) & 0x3f);
- buf[2] = 0x80 + (u8)(ch & 0x3f);
- length = 3;
- }else{
- buf[0] = 0xf0 + (u8)((ch>>18) & 0x07);
- buf[1] = 0x80 + (u8)((ch>>12) & 0x3f);
- buf[2] = 0x80 + (u8)((ch>>6) & 0x3f);
- buf[3] = 0x80 + (u8)(ch & 0x3f);
- length = 4;
- }
+ length = sqlite3AppendOneUtf8Character(buf, ch);
}
if( precision>1 ){
i64 nPrior = 1;