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

Some renaming, warnings cured, and more coding convention conformance.

FossilOrigin-Name: 58815f0ad259599a674e7d0fe0d4676a1c4fb8e118c08b619580ff655fb3be40
This commit is contained in:
larrybr
2023-11-06 15:15:58 +00:00
parent 56fba47850
commit eb1898d6f3
5 changed files with 36 additions and 46 deletions

View File

@@ -122,7 +122,7 @@ static ConsoleInfo consoleInfo = {
};
#undef CI_INITIALIZER
INT_LINKAGE ConsoleStdConsStreams
SQLITE_INTERNAL_LINKAGE ConsoleStdConsStreams
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){
ConsoleStdConsStreams rv = CSCS_NoConsole;
FILE *apf[3] = { pfIn, pfOut, pfErr };
@@ -152,7 +152,7 @@ consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){
return rv;
}
INT_LINKAGE void SQLITE_CDECL consoleRestore( void ){
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ){
if( consoleInfo.cscs ){
int ix;
for( ix=0; ix<3; ++ix ){
@@ -199,15 +199,15 @@ static void setModeFlushQ(FILE *pf, short bFlush, int mode){
# define setModeFlushQ(f, b, m) if(isConOut(f)>0||b) fflush(f)
#endif
INT_LINKAGE void setBinaryMode(FILE *pf, short bFlush){
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *pf, short bFlush){
setModeFlushQ(pf, bFlush, _O_BINARY);
}
INT_LINKAGE void setTextMode(FILE *pf, short bFlush){
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *pf, short bFlush){
setModeFlushQ(pf, bFlush, _O_TEXT);
}
#undef setModeFlushQ
INT_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...){
SQLITE_INTERNAL_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...){
va_list ap;
int rv = 0;
#if SHELL_CON_TRANSLATE
@@ -255,7 +255,7 @@ INT_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...){
return rv;
}
INT_LINKAGE int fputsUtf8(const char *z, FILE *pfO){
SQLITE_INTERNAL_LINKAGE int fputsUtf8(const char *z, FILE *pfO){
#if SHELL_CON_TRANSLATE
return fprintfUtf8(pfO, "%s", z);
#else
@@ -263,7 +263,7 @@ INT_LINKAGE int fputsUtf8(const char *z, FILE *pfO){
#endif
}
INT_LINKAGE char* fgetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
SQLITE_INTERNAL_LINKAGE char* fgetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
if( pfIn==0 ) pfIn = stdin;
#if SHELL_CON_TRANSLATE
if( pfIn == consoleInfo.pst[0].pf ){

View File

@@ -24,8 +24,8 @@
** This code may change in tandem with other project code as needed.
*/
#ifndef INT_LINKAGE
# define INT_LINKAGE extern /* Linkage external to translation unit. */
#ifndef SQLITE_INTERNAL_LINKAGE
# define SQLITE_INTERNAL_LINKAGE extern /* external to translation unit */
# include <stdio.h>
# include <stdlib.h>
# include <limits.h>
@@ -71,7 +71,7 @@ typedef enum ConsoleStdConsStreams {
** inherits the same I/O streams may call this function after
** such a process exits to guard against console mode changes.
*/
INT_LINKAGE ConsoleStdConsStreams
SQLITE_INTERNAL_LINKAGE ConsoleStdConsStreams
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr );
/*
@@ -88,7 +88,7 @@ consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr );
** before so that said process will have a console setup
** however users have configured it or come to expect.
*/
INT_LINKAGE void SQLITE_CDECL consoleRestore( void );
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void );
/*
** Render output like fprintf(). If the output is going to the
@@ -97,7 +97,7 @@ INT_LINKAGE void SQLITE_CDECL consoleRestore( void );
** to the provided stream almost as-is, possibly with newline
** translation as specified by set{Binary,Text}Mode().
*/
INT_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...);
SQLITE_INTERNAL_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...);
/*
** Render output like fputs(). If the output is going to the
@@ -106,7 +106,7 @@ INT_LINKAGE int fprintfUtf8(FILE *pfO, const char *zFormat, ...);
** provided stream almost as-is, possibly with newline
** translation as specified by set{Binary,Text}Mode().
*/
INT_LINKAGE int fputsUtf8(const char *z, FILE *pfO);
SQLITE_INTERNAL_LINKAGE int fputsUtf8(const char *z, FILE *pfO);
/*
** Collect input like fgets(...) with special provisions for input
@@ -115,7 +115,7 @@ INT_LINKAGE int fputsUtf8(const char *z, FILE *pfO);
** translation may be done as set by set{Binary,Text}Mode(). As a
** convenience, pfIn==NULL is treated as stdin.
*/
INT_LINKAGE char* fgetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
SQLITE_INTERNAL_LINKAGE char* fgetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
/*
** Set given stream for binary mode, where newline translation is
@@ -130,8 +130,8 @@ INT_LINKAGE char* fgetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
** translation. On all platforms, newline to the console starts
** a new line and CR,LF chars from the console become a newline.
*/
INT_LINKAGE void setBinaryMode(FILE *, short bFlush);
INT_LINKAGE void setTextMode(FILE *, short bFlush);
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *, short bFlush);
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *, short bFlush);
typedef struct Prompts {
int numPrompts;
@@ -177,10 +177,11 @@ typedef struct Prompts {
** This function may call upon services of a line-editing
** library to interactively collect line edited input.
*/
INT_LINKAGE char *
#if 0 /* not yet implemented */
SQLITE_INTERNAL_LINKAGE char *
shellGetLine(FILE *pfIn, char *zBufPrior, int nLen,
short isContinuation, Prompts azPrompt);
#endif
/*
** TBD: Define an interface for application(s) to generate
** completion candidates for use by the line-editor.

View File

@@ -237,7 +237,7 @@ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText);
#endif
#define INT_LINKAGE static
#define SQLITE_INTERNAL_LINKAGE static
INCLUDE console_io.h
INCLUDE console_io.c
@@ -557,7 +557,8 @@ static char *dynamicContinuePrompt(void){
shell_strncpy(dynPrompt.dynamicPrompt, "(x.", 4);
dynPrompt.dynamicPrompt[2] = (char)('0'+dynPrompt.inParenLevel);
}
shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, PROMPT_LEN_MAX-4);
shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3,
PROMPT_LEN_MAX-4);
}
}
return dynPrompt.dynamicPrompt;
@@ -568,7 +569,7 @@ static char *dynamicContinuePrompt(void){
#define fgets(b,n,f) fgetsUtf8(b,n,f)
/* And, (varargs) utf8_printf(f,z,...) is redirected to the same. */
#define utf8_printf fprintfUtf8
/* And, rfprintf(f,z) is redirected to fputsUtf8(z,f) in the library. */
/* And, utf8_print(f,z) is redirected to fputsUtf8(z,f) in the library. */
#define utf8_print(f,z) fputsUtf8(z,f)
/* Indicate out-of-memory and exit. */
@@ -3340,7 +3341,7 @@ static void display_scanstats(
UNUSED_PARAMETER(pArg);
#else
if( pArg->scanstatsOn==3 ){
const char *zSql =
const char *zSql =
" SELECT addr, opcode, p1, p2, p3, p4, p5, comment, nexec,"
" round(ncycle*100.0 / (sum(ncycle) OVER ()), 2)||'%' AS cycles"
" FROM bytecode(?)";
@@ -4026,7 +4027,7 @@ static int expertFinish(
const char *zEQP = sqlite3_expert_report(p, i, EXPERT_REPORT_PLAN);
if( zIdx==0 ) zIdx = "(no new indexes)\n";
if( bVerbose ){
utf8_printf(out, "-- Query %d --------------------------------\n",i+1);
utf8_printf(out,"-- Query %d --------------------------------\n",i+1);
utf8_printf(out, "%s\n\n", zSql);
}
utf8_printf(out, "%s\n", zIdx);
@@ -9990,7 +9991,7 @@ static int do_meta_command(char *zLine, ShellState *p){
}else{
rc = sqlite3session_attach(pSession->p, azCmd[1]);
if( rc ){
utf8_printf(stderr, "ERROR: sqlite3session_attach() returns %d\n", rc);
utf8_printf(stderr, "ERROR: sqlite3session_attach() returns %d\n",rc);
rc = 0;
}
}
@@ -10729,7 +10730,7 @@ static int do_meta_command(char *zLine, ShellState *p){
{"seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
{"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
{"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
{"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"},
{"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"},
};
int testctrl = -1;
int iCtrl = -1;
@@ -11737,9 +11738,6 @@ static const char zOptions[] =
" -multiplex enable the multiplexor VFS\n"
#endif
" -newline SEP set output row separator. Default: '\\n'\n"
#if SHELL_WIN_UTF8_OPT
" -no-utf8 do not try to set up UTF-8 output (for legacy)\n"
#endif
" -nofollow refuse to open symbolic links to database files\n"
" -nonce STRING set the safe-mode escape nonce\n"
" -nullvalue TEXT set text string for NULL values. Default ''\n"
@@ -12177,15 +12175,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
exit(1);
}
}
#if SHELL_WIN_UTF8_OPT
/* Get indicated Windows console setup done before running invocation commands. */
if( in_console || out_console ){
console_prepare_utf8();
}
if( !in_console ){
setBinaryMode(stdin, 0);
}
#endif
if( data.pAuxDb->zDbFilename==0 ){
#ifndef SQLITE_OMIT_MEMORYDB