1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Enable the RBU extension to compile cleanly on Windows using MSVC.

FossilOrigin-Name: cca79fdc3dff65907c2a59369057265b4512058f
This commit is contained in:
mistachkin
2015-07-24 21:19:25 +00:00
parent 9895f73526
commit 24fa5435ee
4 changed files with 21 additions and 14 deletions

View File

@ -65,6 +65,7 @@ int main(int argc, char **argv){
int i;
const char *zTarget; /* Target database to apply RBU to */
const char *zRbu; /* Database containing RBU */
char zBuf[200]; /* Buffer for printf() */
char *zErrmsg; /* Error message, if any */
sqlite3rbu *pRbu; /* RBU handle */
int nStep = 0; /* Maximum number of step() calls */
@ -98,17 +99,19 @@ int main(int argc, char **argv){
/* Let the user know what happened. */
switch( rc ){
case SQLITE_OK:
fprintf(stdout,
sqlite3_snprintf(sizeof(zBuf), zBuf,
"SQLITE_OK: rbu update incomplete (%lld operations so far)\n",
nProgress
);
fprintf(stdout, zBuf);
break;
case SQLITE_DONE:
fprintf(stdout,
sqlite3_snprintf(sizeof(zBuf), zBuf,
"SQLITE_DONE: rbu update completed (%lld operations)\n",
nProgress
);
fprintf(stdout, zBuf);
break;
default:

View File

@ -83,7 +83,10 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#if !defined(_WIN32)
# include <unistd.h>
#endif
#include "sqlite3.h"
@ -620,8 +623,9 @@ static char *rbuMPrintf(sqlite3rbu *p, const char *zFmt, ...){
*/
static int rbuMPrintfExec(sqlite3rbu *p, sqlite3 *db, const char *zFmt, ...){
va_list ap;
char *zSql;
va_start(ap, zFmt);
char *zSql = sqlite3_vmprintf(zFmt, ap);
zSql = sqlite3_vmprintf(zFmt, ap);
if( p->rc==SQLITE_OK ){
if( zSql==0 ){
p->rc = SQLITE_NOMEM;
@ -2640,7 +2644,7 @@ static void rbuCreateVfs(sqlite3rbu *p){
assert( p->rc==SQLITE_OK );
sqlite3_randomness(sizeof(int), (void*)&rnd);
sprintf(zRnd, "rbu_vfs_%d", rnd);
sqlite3_snprintf(sizeof(zRnd), zRnd, "rbu_vfs_%d", rnd);
p->rc = sqlite3rbu_create_vfs(zRnd, 0);
if( p->rc==SQLITE_OK ){
sqlite3_vfs *pVfs = sqlite3_vfs_find(zRnd);
@ -3525,7 +3529,7 @@ static void (*rbuVfsDlSym(
*/
static void rbuVfsDlClose(sqlite3_vfs *pVfs, void *pHandle){
sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;
return pRealVfs->xDlClose(pRealVfs, pHandle);
pRealVfs->xDlClose(pRealVfs, pHandle);
}
#endif /* SQLITE_OMIT_LOAD_EXTENSION */