Minor coding style changes.
FossilOrigin-Name: 481aa3ccf6f12c2c2fd11a1a20d8fb59f4f9b1cd8dcff0586b4f52222463d720
This commit is contained in:
parent
690ebc6908
commit
acb4050cfc
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C When\sCLI\s-utf8\sactive,\sdo\sno\stranslation\sto\sMBCS\sfor\soutput\sto\sWindows\sconsole.
|
||||
D 2023-04-17T21:18:53.516
|
||||
C Minor\scoding\sstyle\schanges.
|
||||
D 2023-04-17T22:28:02.543
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -632,7 +632,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c ad6f48e0953fb0d9dd434a7fcd8bc6bde05beb82500a59fea7a7b02dc0ecfb3b
|
||||
F src/shell.c.in 6269bf25a222099205c25d4e3917493ef076586064fff0c7b2c33395377b3740
|
||||
F src/shell.c.in 2a11419d77d8e4f7b4e3aea6922a9560630889423e3728205d77b4be2511cc89
|
||||
F src/sqlite.h.in 4fff9c6cc5d4cbba9532a668112efb6dc469c425e1a2196664d7c07d508363ef
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
|
||||
@ -2058,8 +2058,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 543594a7277b12d1c58af8e3cba3841667cf924172995536489ce7da704a11d7 394980e4fe12125460ab14da41edae9089a4da332a46f3124bf0b9778793791f 4d3f27ba90aa59837e49ceaae9f36cad426af3a33707d85d1bb848fc1bda6fed
|
||||
R a35a825488de1096cbecfb4e55ef07c0
|
||||
U larrybr
|
||||
Z cc0b8fd4da0e661d2adcb75f4dd54fc5
|
||||
P cc1d4296d71ee6e2ba133edc581385e201c89657911c2ed39108843c776633a4
|
||||
R fffc27f23894cd7d883f97c0e1d18fe7
|
||||
U mistachkin
|
||||
Z 657aeeb381d4d1312977c18f5409a163
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
cc1d4296d71ee6e2ba133edc581385e201c89657911c2ed39108843c776633a4
|
||||
481aa3ccf6f12c2c2fd11a1a20d8fb59f4f9b1cd8dcff0586b4f52222463d720
|
@ -613,20 +613,22 @@ static struct ConsoleState {
|
||||
*/
|
||||
static void console_prepare(void){
|
||||
HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE);
|
||||
DWORD consoleMode = 0;
|
||||
if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR
|
||||
&& GetConsoleMode( hCI, &conState.consoleMode) ){
|
||||
&& GetConsoleMode( hCI, &consoleMode) ){
|
||||
if( !IsValidCodePage(CP_UTF8) ){
|
||||
fprintf(stderr, "Cannot use UTF-8 code page.\n");
|
||||
console_utf8 = 0;
|
||||
return;
|
||||
}
|
||||
conState.hConsoleIn = hCI;
|
||||
conState.consoleMode = consoleMode;
|
||||
conState.inCodePage = GetConsoleCP();
|
||||
conState.outCodePage = GetConsoleOutputCP();
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
SetConsoleMode( conState.hConsoleIn,
|
||||
conState.consoleMode | ENABLE_LINE_INPUT );
|
||||
SetConsoleMode(conState.hConsoleIn,
|
||||
conState.consoleMode | ENABLE_LINE_INPUT);
|
||||
conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
|
||||
console_utf8 = 1;
|
||||
}else{
|
||||
@ -639,13 +641,14 @@ static void console_prepare(void){
|
||||
*/
|
||||
static void SQLITE_CDECL console_restore(void){
|
||||
if( console_utf8 && conState.inCodePage!=0
|
||||
&& conState.hConsoleIn != INVALID_HANDLE_VALUE ){
|
||||
&& conState.hConsoleIn!=INVALID_HANDLE_VALUE ){
|
||||
_setmode(_fileno(stdin), conState.infsMode);
|
||||
SetConsoleCP(conState.inCodePage);
|
||||
SetConsoleOutputCP(conState.outCodePage);
|
||||
SetConsoleMode( conState.hConsoleIn, conState.consoleMode );
|
||||
SetConsoleMode(conState.hConsoleIn, conState.consoleMode);
|
||||
/* Avoid multiple calls. */
|
||||
conState.hConsoleIn = INVALID_HANDLE_VALUE;
|
||||
conState.consoleMode = 0;
|
||||
console_utf8 = 0;
|
||||
}
|
||||
}
|
||||
@ -663,9 +666,9 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){
|
||||
wchar_t wbuf[SQLITE_IALIM];
|
||||
int lend = 0;
|
||||
int noc = 0;
|
||||
if( ncmax == 0 || conState.stdinEof ) return 0;
|
||||
if( ncmax==0 || conState.stdinEof ) return 0;
|
||||
buf[0] = 0;
|
||||
while( noc < ncmax-7-1 && !lend ){
|
||||
while( noc<ncmax-7-1 && !lend ){
|
||||
/* There is room for at least 2 more characters and a 0-terminator. */
|
||||
int na = (ncmax > SQLITE_IALIM*4+1 + noc)
|
||||
? SQLITE_IALIM : (ncmax-1 - noc)/4;
|
||||
@ -674,12 +677,12 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){
|
||||
BOOL bRC = ReadConsoleW(conState.hConsoleIn, wbuf, na, &nbr, 0);
|
||||
if( !bRC || (noc==0 && nbr==0) ) return 0;
|
||||
if( nbr > 0 ){
|
||||
int nmb = WideCharToMultiByte(CP_UTF8, WC_COMPOSITECHECK|WC_DEFAULTCHAR,
|
||||
wbuf,nbr, 0,0, 0, 0);
|
||||
int nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
|
||||
wbuf,nbr,0,0,0,0);
|
||||
if( nmb !=0 && noc+nmb <= ncmax ){
|
||||
int iseg = noc;
|
||||
nmb = WideCharToMultiByte(CP_UTF8, WC_COMPOSITECHECK|WC_DEFAULTCHAR,
|
||||
wbuf,nbr, buf+noc,nmb, 0,0);
|
||||
nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
|
||||
wbuf,nbr,buf+noc,nmb,0,0);
|
||||
noc += nmb;
|
||||
/* Fixup line-ends as coded by Windows for CR (or "Enter".)*/
|
||||
if( noc > 0 ){
|
||||
@ -730,7 +733,7 @@ void utf8_printf(FILE *out, const char *zFormat, ...){
|
||||
# if SHELL_WIN_UTF8_OPT
|
||||
&& !console_utf8
|
||||
# endif
|
||||
){
|
||||
){
|
||||
char *z1 = sqlite3_vmprintf(zFormat, ap);
|
||||
char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0);
|
||||
sqlite3_free(z1);
|
||||
@ -948,7 +951,7 @@ static char *local_getline(char *zLine, FILE *in){
|
||||
# if SHELL_WIN_UTF8_OPT
|
||||
&& !console_utf8
|
||||
# endif /* SHELL_WIN_UTF8_OPT */
|
||||
){
|
||||
){
|
||||
char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
|
||||
if( zTrans ){
|
||||
i64 nTrans = strlen(zTrans)+1;
|
||||
|
Loading…
Reference in New Issue
Block a user