Make the SQLITE_DEFAULT_SYNCHRONOUS and SQLITE_DEFAULT_WAL_SYNCHRONOUS
values zero-based to agree with PRAGMA synchronous.

FossilOrigin-Name: 592d2104361500e5002783ba329a2609389c57b9
diff --git a/src/attach.c b/src/attach.c
index 30f6739..ea378a4 100644
--- a/src/attach.c
+++ b/src/attach.c
@@ -161,7 +161,7 @@
 #endif
     sqlite3BtreeLeave(aNew->pBt);
   }
-  aNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS;
+  aNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
   aNew->zName = sqlite3DbStrDup(db, zName);
   if( rc==SQLITE_OK && aNew->zName==0 ){
     rc = SQLITE_NOMEM_BKPT;
diff --git a/src/btree.c b/src/btree.c
index bc16cbe..4b9bba5 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -2871,9 +2871,9 @@
         if( (db=pBt->db)!=0 && (pDb=db->aDb)!=0 ){
           while( pDb->pBt==0 || pDb->pBt->pBt!=pBt ){ pDb++; }
           if( pDb->bSyncSet==0
-           && pDb->safety_level==SQLITE_DEFAULT_SYNCHRONOUS
+           && pDb->safety_level==SQLITE_DEFAULT_SYNCHRONOUS+1
           ){
-            pDb->safety_level = SQLITE_DEFAULT_WAL_SYNCHRONOUS;
+            pDb->safety_level = SQLITE_DEFAULT_WAL_SYNCHRONOUS+1;
             sqlite3PagerSetFlags(pBt->pPager,
                pDb->safety_level | (db->flags & PAGER_FLAGS_MASK));
           }
diff --git a/src/main.c b/src/main.c
index fd74c97..70e46a4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2878,7 +2878,7 @@
   ** database it is OFF. This matches the pager layer defaults.  
   */
   db->aDb[0].zName = "main";
-  db->aDb[0].safety_level = SQLITE_DEFAULT_SYNCHRONOUS;
+  db->aDb[0].safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
   db->aDb[1].zName = "temp";
   db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF;
 
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index a49601e..741caec 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1006,10 +1006,23 @@
 #include "mutex.h"
 
 /*
-** Default synchronous levels
+** Default synchronous levels.
+**
+** Note that (for historcal reasons) the PAGER_SYNCHRONOUS_* macros differ
+** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1.
+**
+**           PAGER_SYNCHRONOUS       DEFAULT_SYNCHRONOUS
+**   OFF           1                         0
+**   NORMAL        2                         1
+**   FULL          3                         2
+**   EXTRA         4                         3
+**
+** The "PRAGMA synchronous" statement also uses the zero-based numbers.
+** In other words, the zero-based numbers are used for all external interfaces
+** and the one-based values are used internally.
 */
 #ifndef SQLITE_DEFAULT_SYNCHRONOUS
-# define SQLITE_DEFAULT_SYNCHRONOUS PAGER_SYNCHRONOUS_FULL
+# define SQLITE_DEFAULT_SYNCHRONOUS (PAGER_SYNCHRONOUS_FULL-1)
 #endif
 #ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS
 # define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS