Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix two mismatched uses of malloc() and sqlite3_free() in sqlite3_stdio.c, as reported in forum post 7dd7c70038. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
af0a345b3b287f82b54249cfa574ef3c |
User & Date: | stephan 2024-11-04 13:57:20 |
Context
2024-11-04
| ||
16:59 | Avoid loading the entire record into memory for an sqlite3_preupdate_old() call that retrieves an IPK value. (check-in: 7f4de437 user: dan tags: trunk) | |
13:59 | Fix two mismatched uses of malloc() and sqlite3_free() in sqlite3_stdio.c, as reported in forum post 7dd7c70038. (check-in: 5238959d user: stephan tags: branch-3.47) | |
13:57 | Fix two mismatched uses of malloc() and sqlite3_free() in sqlite3_stdio.c, as reported in forum post 7dd7c70038. (check-in: af0a345b user: stephan tags: trunk) | |
12:11 | Fix typo of --libexec ==> --libexecdir, discovered via audit of a downstream build script. Unrelated doc touchups. (check-in: a60e5d76 user: stephan tags: trunk) | |
Changes
Changes to ext/misc/sqlite3_stdio.c.
︙ | ︙ | |||
142 143 144 145 146 147 148 | char *sqlite3_fgets(char *buf, int sz, FILE *in){ if( UseWtextForInput(in) ){ /* When reading from the command-prompt in Windows, it is necessary ** to use _O_WTEXT input mode to read UTF-16 characters, then translate ** that into UTF-8. Otherwise, non-ASCII characters all get translated ** into '?'. */ | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | char *sqlite3_fgets(char *buf, int sz, FILE *in){ if( UseWtextForInput(in) ){ /* When reading from the command-prompt in Windows, it is necessary ** to use _O_WTEXT input mode to read UTF-16 characters, then translate ** that into UTF-8. Otherwise, non-ASCII characters all get translated ** into '?'. */ wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) ); if( b1==0 ) return 0; _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT); if( fgetws(b1, sz/4, in)==0 ){ sqlite3_free(b1); return 0; } WideCharToMultiByte(CP_UTF8, 0, b1, -1, buf, sz, 0, 0); |
︙ | ︙ | |||
208 209 210 211 212 213 214 | return fputs(z, out); }else{ /* When writing to the command-prompt in Windows, it is necessary ** to use O_U8TEXT to render Unicode U+0080 and greater. Go ahead ** use O_U8TEXT for everything in text mode. */ int sz = (int)strlen(z); | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | return fputs(z, out); }else{ /* When writing to the command-prompt in Windows, it is necessary ** to use O_U8TEXT to render Unicode U+0080 and greater. Go ahead ** use O_U8TEXT for everything in text mode. */ int sz = (int)strlen(z); wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) ); if( b1==0 ) return 0; sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz); b1[sz] = 0; _setmode(_fileno(out), _O_U8TEXT); if( UseBinaryWText(out) ){ piecemealOutput(b1, sz, out); }else{ |
︙ | ︙ |