mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
158
third_party/sqlite3/vdbeapi.c
vendored
158
third_party/sqlite3/vdbeapi.c
vendored
|
@ -356,7 +356,7 @@ sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){
|
|||
void sqlite3_value_free(sqlite3_value *pOld){
|
||||
sqlite3ValueFree(pOld);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************** sqlite3_result_ *******************************
|
||||
** The following routines are used by user-defined functions to specify
|
||||
|
@ -397,9 +397,9 @@ static int invokeValueDestructor(
|
|||
return SQLITE_TOOBIG;
|
||||
}
|
||||
void sqlite3_result_blob(
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
assert( n>=0 );
|
||||
|
@ -407,8 +407,8 @@ void sqlite3_result_blob(
|
|||
setResultStrOrError(pCtx, z, n, 0, xDel);
|
||||
}
|
||||
void sqlite3_result_blob64(
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
sqlite3_uint64 n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
|
@ -467,8 +467,8 @@ void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
|
|||
pOut->flags |= MEM_Subtype;
|
||||
}
|
||||
void sqlite3_result_text(
|
||||
sqlite3_context *pCtx,
|
||||
const char *z,
|
||||
sqlite3_context *pCtx,
|
||||
const char *z,
|
||||
int n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
|
@ -476,8 +476,8 @@ void sqlite3_result_text(
|
|||
setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
|
||||
}
|
||||
void sqlite3_result_text64(
|
||||
sqlite3_context *pCtx,
|
||||
const char *z,
|
||||
sqlite3_context *pCtx,
|
||||
const char *z,
|
||||
sqlite3_uint64 n,
|
||||
void (*xDel)(void *),
|
||||
unsigned char enc
|
||||
|
@ -493,27 +493,27 @@ void sqlite3_result_text64(
|
|||
}
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
void sqlite3_result_text16(
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);
|
||||
}
|
||||
void sqlite3_result_text16be(
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);
|
||||
}
|
||||
void sqlite3_result_text16le(
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
sqlite3_context *pCtx,
|
||||
const void *z,
|
||||
int n,
|
||||
void (*xDel)(void *)
|
||||
){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
|
@ -543,7 +543,7 @@ void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
|||
if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
|
||||
#endif
|
||||
if( pCtx->pOut->flags & MEM_Null ){
|
||||
sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1,
|
||||
sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1,
|
||||
SQLITE_UTF8, SQLITE_STATIC);
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
|||
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
pCtx->isError = SQLITE_TOOBIG;
|
||||
sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1,
|
||||
sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1,
|
||||
SQLITE_UTF8, SQLITE_STATIC);
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ void sqlite3_result_error_nomem(sqlite3_context *pCtx){
|
|||
** a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL
|
||||
** test-control.
|
||||
*/
|
||||
void sqlite3ResultIntReal(sqlite3_context *pCtx){
|
||||
void sqlite3ResultIntReal(sqlite3_context *pCtx){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
if( pCtx->pOut->flags & MEM_Int ){
|
||||
pCtx->pOut->flags &= ~MEM_Int;
|
||||
|
@ -580,7 +580,7 @@ void sqlite3ResultIntReal(sqlite3_context *pCtx){
|
|||
|
||||
|
||||
/*
|
||||
** This function is called after a transaction has been committed. It
|
||||
** This function is called after a transaction has been committed. It
|
||||
** invokes callbacks registered with sqlite3_wal_hook() as required.
|
||||
*/
|
||||
static int doWalCallbacks(sqlite3 *db){
|
||||
|
@ -609,7 +609,7 @@ static int doWalCallbacks(sqlite3 *db){
|
|||
** statement is completely executed or an error occurs.
|
||||
**
|
||||
** This routine implements the bulk of the logic behind the sqlite_step()
|
||||
** API. The only thing omitted is the automatic recompile if a
|
||||
** API. The only thing omitted is the automatic recompile if a
|
||||
** schema change has occurred. That detail is handled by the
|
||||
** outer sqlite3_step() wrapper procedure.
|
||||
*/
|
||||
|
@ -623,15 +623,15 @@ static int sqlite3Step(Vdbe *p){
|
|||
** sqlite3_step() after any error or after SQLITE_DONE. But beginning
|
||||
** with version 3.7.0, we changed this so that sqlite3_reset() would
|
||||
** be called automatically instead of throwing the SQLITE_MISUSE error.
|
||||
** This "automatic-reset" change is not technically an incompatibility,
|
||||
** This "automatic-reset" change is not technically an incompatibility,
|
||||
** since any application that receives an SQLITE_MISUSE is broken by
|
||||
** definition.
|
||||
**
|
||||
** Nevertheless, some published applications that were originally written
|
||||
** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
|
||||
** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
|
||||
** returns, and those were broken by the automatic-reset change. As a
|
||||
** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
|
||||
** legacy behavior of returning SQLITE_MISUSE for cases where the
|
||||
** legacy behavior of returning SQLITE_MISUSE for cases where the
|
||||
** previous sqlite3_step() returned something other than a SQLITE_LOCKED
|
||||
** or SQLITE_BUSY error.
|
||||
*/
|
||||
|
@ -657,10 +657,10 @@ static int sqlite3Step(Vdbe *p){
|
|||
p->rc = SQLITE_SCHEMA;
|
||||
rc = SQLITE_ERROR;
|
||||
if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
|
||||
/* If this statement was prepared using saved SQL and an
|
||||
/* If this statement was prepared using saved SQL and an
|
||||
** error has occurred, then return the error code in p->rc to the
|
||||
** caller. Set the error code in the database handle to the same value.
|
||||
*/
|
||||
*/
|
||||
rc = sqlite3VdbeTransferError(p);
|
||||
}
|
||||
goto end_of_step;
|
||||
|
@ -674,7 +674,7 @@ static int sqlite3Step(Vdbe *p){
|
|||
AtomicStore(&db->u1.isInterrupted, 0);
|
||||
}
|
||||
|
||||
assert( db->nVdbeWrite>0 || db->autoCommit==0
|
||||
assert( db->nVdbeWrite>0 || db->autoCommit==0
|
||||
|| (db->nDeferredCons==0 && db->nDeferredImmCons==0)
|
||||
);
|
||||
|
||||
|
@ -719,10 +719,10 @@ static int sqlite3Step(Vdbe *p){
|
|||
rc = SQLITE_ERROR;
|
||||
}
|
||||
}else if( rc!=SQLITE_DONE && (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
|
||||
/* If this statement was prepared using saved SQL and an
|
||||
/* If this statement was prepared using saved SQL and an
|
||||
** error has occurred, then return the error code in p->rc to the
|
||||
** caller. Set the error code in the database handle to the same value.
|
||||
*/
|
||||
*/
|
||||
rc = sqlite3VdbeTransferError(p);
|
||||
}
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ end_of_step:
|
|||
/* There are only a limited number of result codes allowed from the
|
||||
** statements prepared using the legacy sqlite3_prepare() interface */
|
||||
assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0
|
||||
|| rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR
|
||||
|| rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR
|
||||
|| (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE
|
||||
);
|
||||
return (rc&db->errMask);
|
||||
|
@ -764,15 +764,15 @@ int sqlite3_step(sqlite3_stmt *pStmt){
|
|||
int savedPc = v->pc;
|
||||
rc = sqlite3Reprepare(v);
|
||||
if( rc!=SQLITE_OK ){
|
||||
/* This case occurs after failing to recompile an sql statement.
|
||||
** The error message from the SQL compiler has already been loaded
|
||||
** into the database handle. This block copies the error message
|
||||
/* This case occurs after failing to recompile an sql statement.
|
||||
** The error message from the SQL compiler has already been loaded
|
||||
** into the database handle. This block copies the error message
|
||||
** from the database handle into the statement and sets the statement
|
||||
** program counter to 0 to ensure that when the statement is
|
||||
** program counter to 0 to ensure that when the statement is
|
||||
** finalized or reset the parser error message is available via
|
||||
** sqlite3_errmsg() and sqlite3_errcode().
|
||||
*/
|
||||
const char *zErr = (const char *)sqlite3_value_text(db->pErr);
|
||||
const char *zErr = (const char *)sqlite3_value_text(db->pErr);
|
||||
sqlite3DbFree(db, v->zErrMsg);
|
||||
if( !db->mallocFailed ){
|
||||
v->zErrMsg = sqlite3DbStrDup(db, zErr);
|
||||
|
@ -934,9 +934,9 @@ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
|||
** access code.
|
||||
*/
|
||||
void sqlite3_set_auxdata(
|
||||
sqlite3_context *pCtx,
|
||||
int iArg,
|
||||
void *pAux,
|
||||
sqlite3_context *pCtx,
|
||||
int iArg,
|
||||
void *pAux,
|
||||
void (*xDelete)(void*)
|
||||
){
|
||||
AuxData *pAuxData;
|
||||
|
@ -978,7 +978,7 @@ failed:
|
|||
|
||||
#ifndef SQLITE_OMIT_DEPRECATED
|
||||
/*
|
||||
** Return the number of times the Step function of an aggregate has been
|
||||
** Return the number of times the Step function of an aggregate has been
|
||||
** called.
|
||||
**
|
||||
** This function is deprecated. Do not use it for new code. It is
|
||||
|
@ -1023,9 +1023,9 @@ static const Mem *columnNullValue(void){
|
|||
** these assert()s from failing, when building with SQLITE_DEBUG defined
|
||||
** using gcc, we force nullMem to be 8-byte aligned using the magical
|
||||
** __attribute__((aligned(8))) macro. */
|
||||
static const Mem nullMem
|
||||
static const Mem nullMem
|
||||
#if defined(SQLITE_DEBUG) && defined(__GNUC__)
|
||||
__attribute__((aligned(8)))
|
||||
__attribute__((aligned(8)))
|
||||
#endif
|
||||
= {
|
||||
/* .u = */ {0},
|
||||
|
@ -1071,9 +1071,9 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
|
|||
}
|
||||
|
||||
/*
|
||||
** This function is called after invoking an sqlite3_value_XXX function on a
|
||||
** This function is called after invoking an sqlite3_value_XXX function on a
|
||||
** column value (i.e. a value returned by evaluating an SQL expression in the
|
||||
** select list of a SELECT statement) that may cause a malloc() failure. If
|
||||
** select list of a SELECT statement) that may cause a malloc() failure. If
|
||||
** malloc() has failed, the threads mallocFailed flag is cleared and the result
|
||||
** code of statement pStmt set to SQLITE_NOMEM.
|
||||
**
|
||||
|
@ -1112,8 +1112,8 @@ const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
|
|||
const void *val;
|
||||
val = sqlite3_value_blob( columnMem(pStmt,i) );
|
||||
/* Even though there is no encoding conversion, value_blob() might
|
||||
** need to call malloc() to expand the result of a zeroblob()
|
||||
** expression.
|
||||
** need to call malloc() to expand the result of a zeroblob()
|
||||
** expression.
|
||||
*/
|
||||
columnMallocFailure(pStmt);
|
||||
return val;
|
||||
|
@ -1314,11 +1314,11 @@ const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
|
|||
|
||||
|
||||
/******************************* sqlite3_bind_ ***************************
|
||||
**
|
||||
**
|
||||
** Routines used to attach values to wildcards in a compiled SQL statement.
|
||||
*/
|
||||
/*
|
||||
** Unbind the value bound to variable i in virtual machine p. This is the
|
||||
** Unbind the value bound to variable i in virtual machine p. This is the
|
||||
** the same as binding a NULL value to the column. If the "i" parameter is
|
||||
** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.
|
||||
**
|
||||
|
@ -1337,7 +1337,7 @@ static int vdbeUnbind(Vdbe *p, int i){
|
|||
if( p->iVdbeMagic!=VDBE_MAGIC_RUN || p->pc>=0 ){
|
||||
sqlite3Error(p->db, SQLITE_MISUSE);
|
||||
sqlite3_mutex_leave(p->db->mutex);
|
||||
sqlite3_log(SQLITE_MISUSE,
|
||||
sqlite3_log(SQLITE_MISUSE,
|
||||
"bind on a busy prepared statement: [%s]", p->zSql);
|
||||
return SQLITE_MISUSE_BKPT;
|
||||
}
|
||||
|
@ -1352,7 +1352,7 @@ static int vdbeUnbind(Vdbe *p, int i){
|
|||
pVar->flags = MEM_Null;
|
||||
p->db->errCode = SQLITE_OK;
|
||||
|
||||
/* If the bit corresponding to this variable in Vdbe.expmask is set, then
|
||||
/* If the bit corresponding to this variable in Vdbe.expmask is set, then
|
||||
** binding a new value to this variable invalidates the current query plan.
|
||||
**
|
||||
** IMPLEMENTATION-OF: R-57496-20354 If the specific value bound to a host
|
||||
|
@ -1408,10 +1408,10 @@ static int bindText(
|
|||
** Bind a blob value to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_blob(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
int nData,
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
int nData,
|
||||
void (*xDel)(void*)
|
||||
){
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
|
@ -1420,10 +1420,10 @@ int sqlite3_bind_blob(
|
|||
return bindText(pStmt, i, zData, nData, xDel, 0);
|
||||
}
|
||||
int sqlite3_bind_blob64(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
sqlite3_uint64 nData,
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
sqlite3_uint64 nData,
|
||||
void (*xDel)(void*)
|
||||
){
|
||||
assert( xDel!=SQLITE_DYNAMIC );
|
||||
|
@ -1483,20 +1483,20 @@ int sqlite3_bind_pointer(
|
|||
}
|
||||
return rc;
|
||||
}
|
||||
int sqlite3_bind_text(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const char *zData,
|
||||
int nData,
|
||||
int sqlite3_bind_text(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const char *zData,
|
||||
int nData,
|
||||
void (*xDel)(void*)
|
||||
){
|
||||
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
|
||||
}
|
||||
int sqlite3_bind_text64(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const char *zData,
|
||||
sqlite3_uint64 nData,
|
||||
int sqlite3_bind_text64(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const char *zData,
|
||||
sqlite3_uint64 nData,
|
||||
void (*xDel)(void*),
|
||||
unsigned char enc
|
||||
){
|
||||
|
@ -1510,10 +1510,10 @@ int sqlite3_bind_text64(
|
|||
}
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
int sqlite3_bind_text16(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
int nData,
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const void *zData,
|
||||
int nData,
|
||||
void (*xDel)(void*)
|
||||
){
|
||||
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
|
||||
|
@ -1577,7 +1577,7 @@ int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){
|
|||
|
||||
/*
|
||||
** Return the number of wildcards that can be potentially bound to.
|
||||
** This routine is added to support DBD::SQLite.
|
||||
** This routine is added to support DBD::SQLite.
|
||||
*/
|
||||
int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
|
||||
Vdbe *p = (Vdbe*)pStmt;
|
||||
|
@ -1722,7 +1722,7 @@ int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
|
|||
Vdbe *pVdbe = (Vdbe*)pStmt;
|
||||
u32 v;
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
if( !pStmt
|
||||
if( !pStmt
|
||||
|| (op!=SQLITE_STMTSTATUS_MEMUSED && (op<0||op>=ArraySize(pVdbe->aCounter)))
|
||||
){
|
||||
(void)SQLITE_MISUSE_BKPT;
|
||||
|
@ -1801,8 +1801,8 @@ const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt){
|
|||
** if successful, or a NULL pointer if an OOM error is encountered.
|
||||
*/
|
||||
static UnpackedRecord *vdbeUnpackRecord(
|
||||
KeyInfo *pKeyInfo,
|
||||
int nKey,
|
||||
KeyInfo *pKeyInfo,
|
||||
int nKey,
|
||||
const void *pKey
|
||||
){
|
||||
UnpackedRecord *pRet; /* Return value */
|
||||
|
@ -1894,7 +1894,7 @@ int sqlite3_preupdate_count(sqlite3 *db){
|
|||
** only. It returns zero if the change that caused the callback was made
|
||||
** immediately by a user SQL statement. Or, if the change was made by a
|
||||
** trigger program, it returns the number of trigger programs currently
|
||||
** on the stack (1 for a top-level trigger, 2 for a trigger fired by a
|
||||
** on the stack (1 for a top-level trigger, 2 for a trigger fired by a
|
||||
** top-level trigger etc.).
|
||||
**
|
||||
** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue