/ Check-in [73c7302c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The amalgamation now compiles cleanly on GCC with options -pedantic-errors -Wno-long-long. (CVS 5991)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 73c7302c5f76a2f61ecd75f8bda69bb500d3119c
User & Date: drh 2008-12-08 18:19:18
Context
2008-12-08
18:27
Fix a bug in win32 command-line client introduced during efforts to reduce the number of harmless compiler warnings (check-in (5982).) (CVS 5992) check-in: 6c0b2e75 user: drh tags: trunk
18:19
The amalgamation now compiles cleanly on GCC with options -pedantic-errors -Wno-long-long. (CVS 5991) check-in: 73c7302c user: drh tags: trunk
16:01
Fix two unused-parameter warnings in the parser. (CVS 5990) check-in: cf419d0b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/global.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains definitions of global variables and contants.
    14     14   **
    15         -** $Id: global.c,v 1.8 2008/09/04 17:17:39 danielk1977 Exp $
           15  +** $Id: global.c,v 1.9 2008/12/08 18:19:18 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /* An array to map all upper-case characters into their corresponding
    21     21   ** lower-case character. 
    22     22   **
................................................................................
    69     69   SQLITE_WSD struct Sqlite3Config sqlite3Config = {
    70     70      SQLITE_DEFAULT_MEMSTATUS,  /* bMemstat */
    71     71      1,                         /* bCoreMutex */
    72     72      SQLITE_THREADSAFE==1,      /* bFullMutex */
    73     73      0x7ffffffe,                /* mxStrlen */
    74     74      100,                       /* szLookaside */
    75     75      500,                       /* nLookaside */
    76         -   /* Other fields all default to zero */
           76  +   {0,0,0,0,0,0,0,0},         /* m */
           77  +   {0,0,0,0,0,0,0,0,0},       /* mutex */
           78  +   {0,0,0,0,0,0,0,0,0,0,0},   /* pcache */
           79  +   (void*)0,                  /* pHeap */
           80  +   0,                         /* nHeap */
           81  +   0, 0,                      /* mnHeap, mxHeap */
           82  +   (void*)0,                  /* pScratch */
           83  +   0,                         /* szScratch */
           84  +   0,                         /* nScratch */
           85  +   (void*)0,                  /* pPage */
           86  +   0,                         /* szPage */
           87  +   0,                         /* nPage */
           88  +   0,                         /* mxParserStack */
           89  +   0,                         /* sharedCacheEnabled */
           90  +   /* All the rest need to always be zero */
           91  +   0,                         /* isInit */
           92  +   0,                         /* inProgress */
           93  +   0,                         /* isMallocInit */
           94  +   0,                         /* pInitMutex */
           95  +   0,                         /* nRefInitMutex */
    77     96   };
    78     97   
    79     98   
    80     99   /*
    81    100   ** Hash table for global functions - functions common to all
    82    101   ** database connections.  After initialization, this table is
    83    102   ** read-only.
    84    103   */
    85    104   SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;

Changes to src/loadext.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to dynamically load extensions into
    13     13   ** the SQLite library.
    14     14   **
    15         -** $Id: loadext.c,v 1.56 2008/10/12 00:27:53 shane Exp $
           15  +** $Id: loadext.c,v 1.57 2008/12/08 18:19:18 drh Exp $
    16     16   */
    17     17   
    18     18   #ifndef SQLITE_CORE
    19     19     #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
    20     20   #endif
    21     21   #include "sqlite3ext.h"
    22     22   #include "sqliteInt.h"
................................................................................
   478    478   /*
   479    479   ** The following object holds the list of automatically loaded
   480    480   ** extensions.
   481    481   **
   482    482   ** This list is shared across threads.  The SQLITE_MUTEX_STATIC_MASTER
   483    483   ** mutex must be held while accessing this list.
   484    484   */
   485         -typedef struct sqlite3ExtType sqlite3ExtType;
   486         -static SQLITE_WSD struct sqlite3ExtType {
   487         -  int nExt;        /* Number of entries in aExt[] */          
   488         -  void **aExt;     /* Pointers to the extension init functions */
          485  +typedef struct sqlite3AutoExtList sqlite3AutoExtList;
          486  +static SQLITE_WSD struct sqlite3AutoExtList {
          487  +  int nExt;              /* Number of entries in aExt[] */          
          488  +  void (**aExt)(void);   /* Pointers to the extension init functions */
   489    489   } sqlite3Autoext = { 0, 0 };
   490    490   
   491    491   /* The "wsdAutoext" macro will resolve to the autoextension
   492    492   ** state vector.  If writable static data is unsupported on the target,
   493    493   ** we have to locate the state vector at run-time.  In the more common
   494    494   ** case where writable static data is supported, wsdStat can refer directly
   495    495   ** to the "sqlite3Autoext" state vector declared above.
   496    496   */
   497    497   #ifdef SQLITE_OMIT_WSD
   498    498   # define wsdAutoextInit \
   499         -  sqlite3ExtType *x = &GLOBAL(sqlite3ExtType,sqlite3Autoext)
          499  +  sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext)
   500    500   # define wsdAutoext x[0]
   501    501   #else
   502    502   # define wsdAutoextInit
   503    503   # define wsdAutoext sqlite3Autoext
   504    504   #endif
   505    505   
   506    506   
   507    507   /*
   508    508   ** Register a statically linked extension that is automatically
   509    509   ** loaded by every new database connection.
   510    510   */
   511         -int sqlite3_auto_extension(void *xInit){
          511  +int sqlite3_auto_extension(void (*xInit)(void)){
   512    512     int rc = SQLITE_OK;
   513    513   #ifndef SQLITE_OMIT_AUTOINIT
   514    514     rc = sqlite3_initialize();
   515    515     if( rc ){
   516    516       return rc;
   517    517     }else
   518    518   #endif
................................................................................
   524    524       wsdAutoextInit;
   525    525       sqlite3_mutex_enter(mutex);
   526    526       for(i=0; i<wsdAutoext.nExt; i++){
   527    527         if( wsdAutoext.aExt[i]==xInit ) break;
   528    528       }
   529    529       if( i==wsdAutoext.nExt ){
   530    530         int nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);
   531         -      void **aNew;
          531  +      void (**aNew)(void);
   532    532         aNew = sqlite3_realloc(wsdAutoext.aExt, nByte);
   533    533         if( aNew==0 ){
   534    534           rc = SQLITE_NOMEM;
   535    535         }else{
   536    536           wsdAutoext.aExt = aNew;
   537    537           wsdAutoext.aExt[wsdAutoext.nExt] = xInit;
   538    538           wsdAutoext.nExt++;

Changes to src/mutex_unix.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains the C functions that implement mutexes for pthreads
    13     13   **
    14         -** $Id: mutex_unix.c,v 1.15 2008/11/17 19:18:55 danielk1977 Exp $
           14  +** $Id: mutex_unix.c,v 1.16 2008/12/08 18:19:18 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /*
    19     19   ** The code in this file is only used if we are compiling threadsafe
    20     20   ** under unix with pthreads.
    21     21   **
................................................................................
   312    312       pthreadMutexFree,
   313    313       pthreadMutexEnter,
   314    314       pthreadMutexTry,
   315    315       pthreadMutexLeave,
   316    316   #ifdef SQLITE_DEBUG
   317    317       pthreadMutexHeld,
   318    318       pthreadMutexNotheld
          319  +#else
          320  +    0,
          321  +    0
   319    322   #endif
   320    323     };
   321    324   
   322    325     return &sMutex;
   323    326   }
   324    327   
   325    328   #endif /* SQLITE_MUTEX_PTHREAD */

Changes to src/mutex_w32.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains the C functions that implement mutexes for win32
    13     13   **
    14         -** $Id: mutex_w32.c,v 1.12 2008/11/10 20:01:41 shane Exp $
           14  +** $Id: mutex_w32.c,v 1.13 2008/12/08 18:19:18 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /*
    19     19   ** The code in this file is only used if we are compiling multithreaded
    20     20   ** on a win32 system.
    21     21   */
................................................................................
   239    239       winMutexFree,
   240    240       winMutexEnter,
   241    241       winMutexTry,
   242    242       winMutexLeave,
   243    243   #ifdef SQLITE_DEBUG
   244    244       winMutexHeld,
   245    245       winMutexNotheld
          246  +#else
          247  +    0,
          248  +    0
   246    249   #endif
   247    250     };
   248    251   
   249    252     return &sMutex;
   250    253   }
   251    254   #endif /* SQLITE_MUTEX_W32 */

Changes to src/os.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   ******************************************************************************
    12     12   **
    13     13   ** This file contains OS interface code that is common to all
    14     14   ** architectures.
    15     15   **
    16         -** $Id: os.c,v 1.124 2008/10/07 15:25:48 drh Exp $
           16  +** $Id: os.c,v 1.125 2008/12/08 18:19:18 drh Exp $
    17     17   */
    18     18   #define _SQLITE_OS_C_ 1
    19     19   #include "sqliteInt.h"
    20     20   #undef _SQLITE_OS_C_
    21     21   
    22     22   /*
    23     23   ** The default SQLite sqlite3_vfs implementations do not allocate
................................................................................
   138    138   #ifndef SQLITE_OMIT_LOAD_EXTENSION
   139    139   void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){
   140    140     return pVfs->xDlOpen(pVfs, zPath);
   141    141   }
   142    142   void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
   143    143     pVfs->xDlError(pVfs, nByte, zBufOut);
   144    144   }
   145         -void *sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
   146         -  return pVfs->xDlSym(pVfs, pHandle, zSymbol);
          145  +void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){
          146  +  return pVfs->xDlSym(pVfs, pHdle, zSym);
   147    147   }
   148    148   void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){
   149    149     pVfs->xDlClose(pVfs, pHandle);
   150    150   }
   151    151   #endif /* SQLITE_OMIT_LOAD_EXTENSION */
   152    152   int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
   153    153     return pVfs->xRandomness(pVfs, nByte, zBufOut);

Changes to src/os.h.

    13     13   ** This header file (together with is companion C source-code file
    14     14   ** "os.c") attempt to abstract the underlying operating system so that
    15     15   ** the SQLite library will work on both POSIX and windows systems.
    16     16   **
    17     17   ** This header file is #include-ed by sqliteInt.h and thus ends up
    18     18   ** being included by every source file.
    19     19   **
    20         -** $Id: os.h,v 1.105 2008/06/26 10:41:19 danielk1977 Exp $
           20  +** $Id: os.h,v 1.106 2008/12/08 18:19:18 drh Exp $
    21     21   */
    22     22   #ifndef _SQLITE_OS_H_
    23     23   #define _SQLITE_OS_H_
    24     24   
    25     25   /*
    26     26   ** Figure out if we are dealing with Unix, Windows, or some other
    27     27   ** operating system.  After the following block of preprocess macros,
................................................................................
   254    254   int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);
   255    255   int sqlite3OsDelete(sqlite3_vfs *, const char *, int);
   256    256   int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);
   257    257   int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);
   258    258   #ifndef SQLITE_OMIT_LOAD_EXTENSION
   259    259   void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);
   260    260   void sqlite3OsDlError(sqlite3_vfs *, int, char *);
   261         -void *sqlite3OsDlSym(sqlite3_vfs *, void *, const char *);
          261  +void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);
   262    262   void sqlite3OsDlClose(sqlite3_vfs *, void *);
   263    263   #endif /* SQLITE_OMIT_LOAD_EXTENSION */
   264    264   int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
   265    265   int sqlite3OsSleep(sqlite3_vfs *, int);
   266    266   int sqlite3OsCurrentTime(sqlite3_vfs *, double*);
   267    267   
   268    268   /*

Changes to src/os_unix.c.

    39     39   **   *  Definitions of sqlite3_io_methods objects for all locking
    40     40   **      methods plus "finder" functions for each locking method.
    41     41   **   *  sqlite3_vfs method implementations.
    42     42   **   *  Locking primitives for the proxy uber-locking-method. (MacOSX only)
    43     43   **   *  Definitions of sqlite3_vfs objects for all locking methods
    44     44   **      plus implementations of sqlite3_os_init() and sqlite3_os_end().
    45     45   **
    46         -** $Id: os_unix.c,v 1.229 2008/12/04 12:34:16 drh Exp $
           46  +** $Id: os_unix.c,v 1.230 2008/12/08 18:19:18 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #if SQLITE_OS_UNIX              /* This file is used on unix only */
    50     50   
    51     51   /*
    52     52   ** There are various methods for file locking used for concurrency
    53     53   ** control:
................................................................................
  2213   2213     int err;
  2214   2214     
  2215   2215     pb.unLockFlag = setLockFlag ? 0 : 1;
  2216   2216     pb.startEndFlag = 0;
  2217   2217     pb.offset = offset;
  2218   2218     pb.length = length; 
  2219   2219     pb.fd = pFile->h;
  2220         -  //SimulateIOErrorBenign(1);
  2221         -  //SimulateIOError( pb.fd=(-1) )
  2222         -  //SimulateIOErrorBenign(0);
  2223   2220     
  2224   2221     OSTRACE6("AFPSETLOCK [%s] for %d%s in range %llx:%llx\n", 
  2225   2222       (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""),
  2226   2223       offset, length);
  2227   2224     err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);
  2228   2225     if ( err==-1 ) {
  2229   2226       int rc;
................................................................................
  3009   3006   ** the correct finder-function for that VFS.
  3010   3007   **
  3011   3008   ** Most finder functions return a pointer to a fixed sqlite3_io_methods
  3012   3009   ** object.  The only interesting finder-function is autolockIoFinder, which
  3013   3010   ** looks at the filesystem type and tries to guess the best locking
  3014   3011   ** strategy from that.
  3015   3012   **
         3013  +** For finder-funtion F, two objects are created:
         3014  +**
         3015  +**    (1) The real finder-function named "FImpt()".
         3016  +**
         3017  +**    (2) A constant pointer to this functio named just "F".
         3018  +**
         3019  +**
         3020  +** A pointer to the F pointer is used as the pAppData value for VFS
         3021  +** objects.  We have to do this instead of letting pAppData point
         3022  +** directly at the finder-function since C90 rules prevent a void*
         3023  +** from be cast into a function pointer.
         3024  +**
  3016   3025   **
  3017   3026   ** Each instance of this macro generates two objects:
  3018   3027   **
  3019   3028   **   *  A constant sqlite3_io_methods object call METHOD that has locking
  3020   3029   **      methods CLOSE, LOCK, UNLOCK, CKRESLOCK.
  3021   3030   **
  3022   3031   **   *  An I/O method finder function called FINDER that returns a pointer
................................................................................
  3034   3043      LOCK,                       /* xLock */                                   \
  3035   3044      UNLOCK,                     /* xUnlock */                                 \
  3036   3045      CKLOCK,                     /* xCheckReservedLock */                      \
  3037   3046      unixFileControl,            /* xFileControl */                            \
  3038   3047      unixSectorSize,             /* xSectorSize */                             \
  3039   3048      unixDeviceCharacteristics   /* xDeviceCapabilities */                     \
  3040   3049   };                                                                           \
  3041         -static const sqlite3_io_methods *FINDER(const char *z, int h){               \
         3050  +static const sqlite3_io_methods *FINDER##Impl(const char *z, int h){         \
  3042   3051     UNUSED_PARAMETER(z); UNUSED_PARAMETER(h);                                  \
  3043   3052     return &METHOD;                                                            \
  3044         -}
         3053  +}                                                                            \
         3054  +static const sqlite3_io_methods *(*const FINDER)(const char*,int)            \
         3055  +    = FINDER##Impl;
  3045   3056   
  3046   3057   /*
  3047   3058   ** Here are all of the sqlite3_io_methods objects for each of the
  3048   3059   ** locking strategies.  Functions that return pointers to these methods
  3049   3060   ** are also created.
  3050   3061   */
  3051   3062   IOMETHODS(
  3052   3063     posixIoFinder,            /* Finder function name */
  3053   3064     posixIoMethods,           /* sqlite3_io_methods object name */
  3054   3065     unixClose,                /* xClose method */
  3055   3066     unixLock,                 /* xLock method */
  3056   3067     unixUnlock,               /* xUnlock method */
  3057   3068     unixCheckReservedLock     /* xCheckReservedLock method */
  3058         -);
         3069  +)
  3059   3070   IOMETHODS(
  3060   3071     nolockIoFinder,           /* Finder function name */
  3061   3072     nolockIoMethods,          /* sqlite3_io_methods object name */
  3062   3073     nolockClose,              /* xClose method */
  3063   3074     nolockLock,               /* xLock method */
  3064   3075     nolockUnlock,             /* xUnlock method */
  3065   3076     nolockCheckReservedLock   /* xCheckReservedLock method */
  3066         -);
         3077  +)
  3067   3078   IOMETHODS(
  3068   3079     dotlockIoFinder,          /* Finder function name */
  3069   3080     dotlockIoMethods,         /* sqlite3_io_methods object name */
  3070   3081     dotlockClose,             /* xClose method */
  3071   3082     dotlockLock,              /* xLock method */
  3072   3083     dotlockUnlock,            /* xUnlock method */
  3073   3084     dotlockCheckReservedLock  /* xCheckReservedLock method */
  3074         -);
         3085  +)
  3075   3086   
  3076   3087   #if SQLITE_ENABLE_LOCKING_STYLE
  3077   3088   IOMETHODS(
  3078   3089     flockIoFinder,            /* Finder function name */
  3079   3090     flockIoMethods,           /* sqlite3_io_methods object name */
  3080   3091     flockClose,               /* xClose method */
  3081   3092     flockLock,                /* xLock method */
  3082   3093     flockUnlock,              /* xUnlock method */
  3083   3094     flockCheckReservedLock    /* xCheckReservedLock method */
  3084         -);
         3095  +)
  3085   3096   #endif
  3086   3097   
  3087   3098   #if OS_VXWORKS
  3088   3099   IOMETHODS(
  3089   3100     semIoFinder,              /* Finder function name */
  3090   3101     semIoMethods,             /* sqlite3_io_methods object name */
  3091   3102     semClose,                 /* xClose method */
  3092   3103     semLock,                  /* xLock method */
  3093   3104     semUnlock,                /* xUnlock method */
  3094   3105     semCheckReservedLock      /* xCheckReservedLock method */
  3095         -);
         3106  +)
  3096   3107   #endif
  3097   3108   
  3098   3109   #if defined(__DARWIN__) && SQLITE_ENABLE_LOCKING_STYLE
  3099   3110   IOMETHODS(
  3100   3111     afpIoFinder,              /* Finder function name */
  3101   3112     afpIoMethods,             /* sqlite3_io_methods object name */
  3102   3113     afpClose,                 /* xClose method */
  3103   3114     afpLock,                  /* xLock method */
  3104   3115     afpUnlock,                /* xUnlock method */
  3105   3116     afpCheckReservedLock      /* xCheckReservedLock method */
  3106         -);
         3117  +)
  3107   3118   #endif
  3108   3119   
  3109   3120   /*
  3110   3121   ** The proxy locking method is a "super-method" in the sense that it
  3111   3122   ** opens secondary file descriptors for the conch and lock files and
  3112   3123   ** it uses proxy, dot-file, AFP, and flock() locking methods on those
  3113   3124   ** secondary files.  For this reason, the division that implements
................................................................................
  3123   3134   IOMETHODS(
  3124   3135     proxyIoFinder,            /* Finder function name */
  3125   3136     proxyIoMethods,           /* sqlite3_io_methods object name */
  3126   3137     proxyClose,               /* xClose method */
  3127   3138     proxyLock,                /* xLock method */
  3128   3139     proxyUnlock,              /* xUnlock method */
  3129   3140     proxyCheckReservedLock    /* xCheckReservedLock method */
  3130         -);
         3141  +)
  3131   3142   #endif
  3132   3143   
  3133   3144   
  3134   3145   #if defined(__DARWIN__) && SQLITE_ENABLE_LOCKING_STYLE
  3135   3146   /* 
  3136   3147   ** This "finder" function attempts to determine the best locking strategy 
  3137   3148   ** for the database file "filePath".  It then returns the sqlite3_io_methods
  3138   3149   ** object that implements that strategy.
  3139   3150   **
  3140   3151   ** This is for MacOSX only.
  3141   3152   */
  3142         -static const sqlite3_io_methods *autolockIoFinder(
         3153  +static const sqlite3_io_methods *autolockIoFinderImpl(
  3143   3154     const char *filePath,    /* name of the database file */
  3144   3155     int fd                   /* file descriptor open on the database file */
  3145   3156   ){
  3146   3157     static const struct Mapping {
  3147   3158       const char *zFilesystem;              /* Filesystem type name */
  3148   3159       const sqlite3_io_methods *pMethods;   /* Appropriate locking method */
  3149   3160     } aMap[] = {
................................................................................
  3188   3199     lockInfo.l_type = F_RDLCK;
  3189   3200     if( fcntl(fd, F_GETLK, &lockInfo)!=-1 ) {
  3190   3201       return &posixIoMethods;
  3191   3202     }else{
  3192   3203       return &dotlockIoMethods;
  3193   3204     }
  3194   3205   }
         3206  +static const sqlite3_io_methods (*const autolockIoFinder)(const char*,int)
         3207  +        = autolockIoFinderImpl;
         3208  +
  3195   3209   #endif /* defined(__DARWIN__) && SQLITE_ENABLE_LOCKING_STYLE */
  3196   3210   
  3197   3211   /*
  3198   3212   ** An abstract type for a pointer to a IO method finder function:
  3199   3213   */
  3200   3214   typedef const sqlite3_io_methods *(*finder_type)(const char*,int);
  3201   3215   
................................................................................
  3246   3260       rc = SQLITE_NOMEM;
  3247   3261     }
  3248   3262   #endif
  3249   3263   
  3250   3264     if( noLock ){
  3251   3265       pLockingStyle = &nolockIoMethods;
  3252   3266     }else{
  3253         -    pLockingStyle = (*(finder_type)pVfs->pAppData)(zFilename, h);
         3267  +    pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, h);
  3254   3268   #if SQLITE_ENABLE_LOCKING_STYLE
  3255   3269       /* Cache zFilename in the locking context (AFP and dotlock override) for
  3256   3270       ** proxyLock activation is possible (remote proxy is based on db name)
  3257   3271       ** zFilename remains valid until file is closed, to support */
  3258   3272       pNew->lockingContext = (void*)zFilename;
  3259   3273   #endif
  3260   3274     }
................................................................................
  3760   3774     unixEnterMutex();
  3761   3775     zErr = dlerror();
  3762   3776     if( zErr ){
  3763   3777       sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
  3764   3778     }
  3765   3779     unixLeaveMutex();
  3766   3780   }
  3767         -static void *unixDlSym(sqlite3_vfs *NotUsed, void *pHandle, const char*zSymbol){
         3781  +static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){
         3782  +  /* 
         3783  +  ** GCC with -pedantic-errors says that C90 does not allow a void* to be
         3784  +  ** cast into a pointer to a function.  And yet the library dlsym() routine
         3785  +  ** returns a void* which is really a pointer to a function.  So how do we
         3786  +  ** use dlsym() with -pedantic-errors?
         3787  +  **
         3788  +  ** Variable x below is defined to be a pointer to a function taking
         3789  +  ** parameters void* and const char* and returning a pointer to a function.
         3790  +  ** We initialize x by assigning it a pointer to the dlsym() function.
         3791  +  ** (That assignment requires a cast.)  Then we call the function that
         3792  +  ** x points to.  
         3793  +  **
         3794  +  ** This work-around is unlikely to work correctly on any system where
         3795  +  ** you really cannot cast a function pointer into void*.  But then, on the
         3796  +  ** other hand, dlsym() will not work on such a system either, so we have
         3797  +  ** not really lost anything.
         3798  +  */
         3799  +  void (*(*x)(void*,const char*))(void);
  3768   3800     UNUSED_PARAMETER(NotUsed);
  3769         -  return dlsym(pHandle, zSymbol);
         3801  +  x = (void(*(*)(void*,const char*))(void))dlsym;
         3802  +  return (*x)(p, zSym);
  3770   3803   }
  3771   3804   static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){
  3772   3805     UNUSED_PARAMETER(NotUsed);
  3773   3806     dlclose(pHandle);
  3774   3807   }
  3775   3808   #else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
  3776   3809     #define unixDlOpen  0
................................................................................
  4279   4312     pNew = (unixFile *)sqlite3_malloc(sizeof(unixFile));
  4280   4313     if( pNew==NULL ){
  4281   4314       rc = SQLITE_NOMEM;
  4282   4315       goto end_create_proxy;
  4283   4316     }
  4284   4317     memset(pNew, 0, sizeof(unixFile));
  4285   4318   
  4286         -  dummyVfs.pAppData = (void*)autolockIoFinder;  
         4319  +  dummyVfs.pAppData = (void*)&autolockIoFinder;
  4287   4320     rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0);
  4288   4321     if( rc==SQLITE_OK ){
  4289   4322       *ppFile = pNew;
  4290   4323       return SQLITE_OK;
  4291   4324     }
  4292   4325   end_create_proxy:    
  4293   4326     close(fd); /* silently leak fd if error, we're already in error */
................................................................................
  4318   4351   
  4319   4352       OSTRACE4("TAKECONCH  %d for %s pid=%d\n", conchFile->h,
  4320   4353                (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"), getpid());
  4321   4354   
  4322   4355       rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK);
  4323   4356       if( rc==SQLITE_OK ){
  4324   4357         int pError = 0;
  4325         -      memset(testValue, 0, CONCHLEN); // conch is fixed size
         4358  +      memset(testValue, 0, CONCHLEN); /* conch is fixed size */
  4326   4359         rc = proxyGetHostID(testValue, &pError);
  4327   4360         if( (rc&0xff)==SQLITE_IOERR ){
  4328   4361           pFile->lastErrno = pError;
  4329   4362         }
  4330   4363         if( pCtx->lockProxyPath ){
  4331   4364           strlcpy(&testValue[HOSTIDLEN], pCtx->lockProxyPath, MAXPATHLEN);
  4332   4365         }
................................................................................
  4419   4452         pFile->h = -1;
  4420   4453         int fd = open(pCtx->dbPath, pFile->openFlags,
  4421   4454                       SQLITE_DEFAULT_FILE_PERMISSIONS);
  4422   4455         OSTRACE2("TRANSPROXY: OPEN  %d\n", fd);
  4423   4456         if( fd>=0 ){
  4424   4457           pFile->h = fd;
  4425   4458         }else{
  4426         -        rc=SQLITE_CANTOPEN; // SQLITE_BUSY? proxyTakeConch called during locking
         4459  +        rc=SQLITE_CANTOPEN; /* SQLITE_BUSY? proxyTakeConch called
         4460  +                               during locking */
  4427   4461         }
  4428   4462       }
  4429   4463       if( rc==SQLITE_OK && !pCtx->lockProxy ){
  4430   4464         char *path = tLockPath ? tLockPath : pCtx->lockProxyPath;
  4431         -      // ACS: Need to make a copy of path sometimes
         4465  +      /* ACS: Need to make a copy of path sometimes */
  4432   4466         rc = proxyCreateUnixFile(path, &pCtx->lockProxy);
  4433   4467       }
  4434   4468       if( rc==SQLITE_OK ){
  4435   4469         pCtx->conchHeld = 1;
  4436   4470   
  4437   4471         if( tLockPath ){
  4438   4472           pCtx->lockProxyPath = sqlite3DbStrDup(0, tLockPath);
................................................................................
  4845   4879   ** single thread.  The memory allocation and mutex subsystems have not
  4846   4880   ** necessarily been initialized when this routine is called, and so they
  4847   4881   ** should not be used.
  4848   4882   */
  4849   4883   int sqlite3_os_init(void){ 
  4850   4884     /* 
  4851   4885     ** The following macro defines an initializer for an sqlite3_vfs object.
  4852         -  ** The name of the VFS is NAME.  The pAppData is a pointer to a "finder"
  4853         -  ** function.  The FINDER parameter to this macro is the name of the
         4886  +  ** The name of the VFS is NAME.  The pAppData is a pointer to a pointer
         4887  +  ** to the "finder" function.  (pAppData is a pointer to a pointer because
         4888  +  ** silly C90 rules prohibit a void* from being cast to a function pointer
         4889  +  ** and so we have to go through the intermediate pointer to avoid problems
         4890  +  ** when compiling with -pedantic-errors on GCC.)
         4891  +  **
         4892  +  ** The FINDER parameter to this macro is the name of the pointer to the
  4854   4893     ** finder-function.  The finder-function returns a pointer to the
  4855   4894     ** sqlite_io_methods object that implements the desired locking
  4856   4895     ** behaviors.  See the division above that contains the IOMETHODS
  4857   4896     ** macro for addition information on finder-functions.
  4858   4897     **
  4859   4898     ** Most finders simply return a pointer to a fixed sqlite3_io_methods
  4860   4899     ** object.  But the "autolockIoFinder" available on MacOSX does a little
................................................................................
  4864   4903     */
  4865   4904     #define UNIXVFS(VFSNAME, FINDER) {                        \
  4866   4905       1,                    /* iVersion */                    \
  4867   4906       sizeof(unixFile),     /* szOsFile */                    \
  4868   4907       MAX_PATHNAME,         /* mxPathname */                  \
  4869   4908       0,                    /* pNext */                       \
  4870   4909       VFSNAME,              /* zName */                       \
  4871         -    (void*)FINDER,        /* pAppData */                    \
         4910  +    (void*)&FINDER,       /* pAppData */                    \
  4872   4911       unixOpen,             /* xOpen */                       \
  4873   4912       unixDelete,           /* xDelete */                     \
  4874   4913       unixAccess,           /* xAccess */                     \
  4875   4914       unixFullPathname,     /* xFullPathname */               \
  4876   4915       unixDlOpen,           /* xDlOpen */                     \
  4877   4916       unixDlError,          /* xDlError */                    \
  4878   4917       unixDlSym,            /* xDlSym */                      \

Changes to src/os_win.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   ******************************************************************************
    12     12   **
    13     13   ** This file contains code that is specific to windows.
    14     14   **
    15         -** $Id: os_win.c,v 1.140 2008/11/19 21:35:47 shane Exp $
           15  +** $Id: os_win.c,v 1.141 2008/12/08 18:19:18 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #if SQLITE_OS_WIN               /* This file is used for windows only */
    19     19   
    20     20   
    21     21   /*
    22     22   ** A Note About Memory Allocation:
................................................................................
  1523   1523     }
  1524   1524     free(zConverted);
  1525   1525     return (void*)h;
  1526   1526   }
  1527   1527   static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
  1528   1528     getLastErrorMsg(nBuf, zBufOut);
  1529   1529   }
  1530         -void *winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
         1530  +void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
  1531   1531   #if SQLITE_OS_WINCE
  1532   1532     /* The GetProcAddressA() routine is only available on wince. */
  1533         -  return GetProcAddressA((HANDLE)pHandle, zSymbol);
         1533  +  return (void(*)(void))GetProcAddressA((HANDLE)pHandle, zSymbol);
  1534   1534   #else
  1535   1535     /* All other windows platforms expect GetProcAddress() to take
  1536   1536     ** an Ansi string regardless of the _UNICODE setting */
  1537         -  return GetProcAddress((HANDLE)pHandle, zSymbol);
         1537  +  return (void(*)(void))GetProcAddress((HANDLE)pHandle, zSymbol);
  1538   1538   #endif
  1539   1539   }
  1540   1540   void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
  1541   1541     FreeLibrary((HANDLE)pHandle);
  1542   1542   }
  1543   1543   #else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
  1544   1544     #define winDlOpen  0

Changes to src/random.c.

    11     11   *************************************************************************
    12     12   ** This file contains code to implement a pseudo-random number
    13     13   ** generator (PRNG) for SQLite.
    14     14   **
    15     15   ** Random numbers are used by some of the database backends in order
    16     16   ** to generate random integer keys for tables or random filenames.
    17     17   **
    18         -** $Id: random.c,v 1.27 2008/10/07 15:25:48 drh Exp $
           18  +** $Id: random.c,v 1.28 2008/12/08 18:19:18 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   
    22     22   
    23     23   /* All threads share a single random number generator.
    24     24   ** This structure is the current state of the generator.
    25     25   */
    26     26   static SQLITE_WSD struct sqlite3PrngType {
    27     27     unsigned char isInit;          /* True if initialized */
    28     28     unsigned char i, j;            /* State variables */
    29     29     unsigned char s[256];          /* State variables */
    30         -} sqlite3Prng = { 0, };
           30  +} sqlite3Prng;
    31     31   
    32     32   /*
    33     33   ** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
    34     34   ** must be held while executing this routine.
    35     35   **
    36     36   ** Why not just use a library random generator like lrand48() for this?
    37     37   ** Because the OP_NewRowid opcode in the VDBE depends on having a very
................................................................................
   122    122   ** PRNG and restore the PRNG to its saved state at a later time, or
   123    123   ** to reset the PRNG to its initial state.  These routines accomplish
   124    124   ** those tasks.
   125    125   **
   126    126   ** The sqlite3_test_control() interface calls these routines to
   127    127   ** control the PRNG.
   128    128   */
   129         -static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng = { 0, };
          129  +static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng;
   130    130   void sqlite3PrngSaveState(void){
   131    131     memcpy(
   132    132       &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),
   133    133       &GLOBAL(struct sqlite3PrngType, sqlite3Prng),
   134    134       sizeof(sqlite3Prng)
   135    135     );
   136    136   }

Changes to src/sqlite.h.in.

    26     26   ** on how SQLite interfaces are suppose to operate.
    27     27   **
    28     28   ** The name of this file under configuration management is "sqlite.h.in".
    29     29   ** The makefile makes some minor changes to this file (such as inserting
    30     30   ** the version number) and changes its name to "sqlite3.h" as
    31     31   ** part of the build process.
    32     32   **
    33         -** @(#) $Id: sqlite.h.in,v 1.416 2008/11/21 00:10:35 aswift Exp $
           33  +** @(#) $Id: sqlite.h.in,v 1.417 2008/12/08 18:19:18 drh Exp $
    34     34   */
    35     35   #ifndef _SQLITE3_H_
    36     36   #define _SQLITE3_H_
    37     37   #include <stdarg.h>     /* Needed for the definition of va_list */
    38     38   
    39     39   /*
    40     40   ** Make sure we can call this stuff from C++.
................................................................................
   870    870     int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
   871    871                  int flags, int *pOutFlags);
   872    872     int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
   873    873     int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
   874    874     int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
   875    875     void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
   876    876     void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
   877         -  void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol);
          877  +  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
   878    878     void (*xDlClose)(sqlite3_vfs*, void*);
   879    879     int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
   880    880     int (*xSleep)(sqlite3_vfs*, int microseconds);
   881    881     int (*xCurrentTime)(sqlite3_vfs*, double*);
   882    882     int (*xGetLastError)(sqlite3_vfs*, int, char *);
   883    883     /* New fields may be appended in figure versions.  The iVersion
   884    884     ** value will increment whenever this happens. */
................................................................................
  5444   5444   **          multiple times with the same extension is harmless.
  5445   5445   **
  5446   5446   ** {H12643} This routine stores a pointer to the extension in an array
  5447   5447   **          that is obtained from [sqlite3_malloc()].
  5448   5448   **
  5449   5449   ** {H12644} Automatic extensions apply across all threads.
  5450   5450   */
  5451         -int sqlite3_auto_extension(void *xEntryPoint);
         5451  +int sqlite3_auto_extension(void (*xEntryPoint)(void));
  5452   5452   
  5453   5453   /*
  5454   5454   ** CAPI3REF: Reset Automatic Extension Loading {H12660} <S20500>
  5455   5455   **
  5456   5456   ** This function disables all previously registered automatic
  5457   5457   ** extensions. {END}  It undoes the effect of all prior
  5458   5458   ** [sqlite3_auto_extension()] calls.

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.803 2008/12/08 13:42:36 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.804 2008/12/08 18:19:18 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Include the configuration header output by 'configure' if we're using the
    21     21   ** autoconf-based build
................................................................................
  1990   1990     int mnReq, mxReq;                 /* Min and max heap requests sizes */
  1991   1991     void *pScratch;                   /* Scratch memory */
  1992   1992     int szScratch;                    /* Size of each scratch buffer */
  1993   1993     int nScratch;                     /* Number of scratch buffers */
  1994   1994     void *pPage;                      /* Page cache memory */
  1995   1995     int szPage;                       /* Size of each page in pPage[] */
  1996   1996     int nPage;                        /* Number of pages in pPage[] */
         1997  +  int mxParserStack;                /* maximum depth of the parser stack */
         1998  +  int sharedCacheEnabled;           /* true if shared-cache mode enabled */
         1999  +  /* The above might be initialized to non-zero.  The following need to always
         2000  +  ** initially be zero, however. */
  1997   2001     int isInit;                       /* True after initialization has finished */
  1998   2002     int inProgress;                   /* True while initialization in progress */
  1999   2003     int isMallocInit;                 /* True after malloc is initialized */
  2000   2004     sqlite3_mutex *pInitMutex;        /* Mutex used by sqlite3_initialize() */
  2001   2005     int nRefInitMutex;                /* Number of users of pInitMutex */
  2002         -  int mxParserStack;                /* maximum depth of the parser stack */
  2003         -  int sharedCacheEnabled;           /* true if shared-cache mode enabled */
  2004   2006   };
  2005   2007   
  2006   2008   /*
  2007   2009   ** Context pointer passed down through the tree-walk.
  2008   2010   */
  2009   2011   struct Walker {
  2010   2012     int (*xExprCallback)(Walker*, Expr*);     /* Callback for expressions */

Changes to tool/mkkeywordhash.c.

    11     11   ** A header comment placed at the beginning of generated code.
    12     12   */
    13     13   static const char zHdr[] = 
    14     14     "/***** This file contains automatically generated code ******\n"
    15     15     "**\n"
    16     16     "** The code in this file has been automatically generated by\n"
    17     17     "**\n"
    18         -  "**     $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.32 2008/10/06 05:32:19 danielk1977 Exp $\n"
           18  +  "**     $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.33 2008/12/08 18:19:18 drh Exp $\n"
    19     19     "**\n"
    20     20     "** The code in this file implements a function that determines whether\n"
    21     21     "** or not a given identifier is really an SQL keyword.  The same thing\n"
    22     22     "** might be implemented more directly using a hand-written hash table.\n"
    23     23     "** But by using this automatically generated code, the size of the code\n"
    24     24     "** is substantially reduced.  This is important for embedded applications\n"
    25     25     "** on platforms with limited memory.\n"
................................................................................
   331    331   int main(int argc, char **argv){
   332    332     int i, j, k, h;
   333    333     int bestSize, bestCount;
   334    334     int count;
   335    335     int nChar;
   336    336     int totalLen = 0;
   337    337     int aHash[1000];  /* 1000 is much bigger than nKeyword */
          338  +  char zText[2000];
   338    339   
   339    340     /* Remove entries from the list of keywords that have mask==0 */
   340    341     for(i=j=0; i<nKeyword; i++){
   341    342       if( aKeywordTable[i].mask==0 ) continue;
   342    343       if( j<i ){
   343    344         aKeywordTable[j] = aKeywordTable[i];
   344    345       }
................................................................................
   459    460   
   460    461     /* Begin generating code */
   461    462     printf("%s", zHdr);
   462    463     printf("/* Hash score: %d */\n", bestCount);
   463    464     printf("static int keywordCode(const char *z, int n){\n");
   464    465     printf("  /* zText[] encodes %d bytes of keywords in %d bytes */\n",
   465    466             totalLen + nKeyword, nChar+1 );
   466         -
   467         -  printf("  static const char zText[%d] =\n", nChar+1);
   468         -  for(i=j=0; i<nKeyword; i++){
          467  +  for(i=j=k=0; i<nKeyword; i++){
   469    468       Keyword *p = &aKeywordTable[i];
   470    469       if( p->substrId ) continue;
   471         -    if( j==0 ) printf("    \"");
          470  +    memcpy(&zText[k], p->zName, p->len);
          471  +    k += p->len;
          472  +    if( j+p->len>70 ){
          473  +      printf("%*s */\n", 74-j, "");
          474  +      j = 0;
          475  +    }
          476  +    if( j==0 ){
          477  +      printf("  /*   ");
          478  +      j = 8;
          479  +    }
   472    480       printf("%s", p->zName);
   473    481       j += p->len;
   474         -    if( j>60 ){
   475         -      printf("\"\n");
          482  +  }
          483  +  if( j>0 ){
          484  +    printf("%*s */\n", 74-j, "");
          485  +  }
          486  +  printf("  static const char zText[%d] = {\n", nChar+1);
          487  +  for(i=j=0; i<=k; i++){
          488  +    if( j==0 ){
          489  +      printf("    ");
          490  +    }
          491  +    if( zText[i]==0 ){
          492  +      printf("0");
          493  +    }else{
          494  +      printf("'%c',", zText[i]);
          495  +    }
          496  +    j += 4;
          497  +    if( j>68 ){
          498  +      printf("\n");
   476    499         j = 0;
   477    500       }
   478    501     }
   479         -  printf("%s;\n", j>0 ? "\"" : "  ");
          502  +  if( j>0 ) printf("\n");
          503  +  printf("  };\n");
   480    504   
   481    505     printf("  static const unsigned char aHash[%d] = {\n", bestSize);
   482    506     for(i=j=0; i<bestSize; i++){
   483    507       if( j==0 ) printf("    ");
   484    508       printf(" %3d,", aHash[i]);
   485    509       j++;
   486    510       if( j>12 ){