]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Formatting changes on the multiplexor code - make sure no lines exceed 80
authordrh <drh@noemail.net>
Tue, 19 Jul 2011 18:29:00 +0000 (18:29 +0000)
committerdrh <drh@noemail.net>
Tue, 19 Jul 2011 18:29:00 +0000 (18:29 +0000)
characters.  No logical changes.

FossilOrigin-Name: ed5f0aad6b21066bacd01521e82c22e96991f400

manifest
manifest.uuid
src/test_multiplex.c

index cb88bfa144308f8fbb38f2327e0916ca971fab7f..dc0a0982a21eac9cfe6d330981d1c2acdcdfc582 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Increase\sthe\sversion\snumber\sto\s3.7.8.
-D 2011-07-19T15:27:59.774
+C Formatting\schanges\son\sthe\smultiplexor\scode\s-\smake\ssure\sno\slines\sexceed\s80\ncharacters.\s\sNo\slogical\schanges.
+D 2011-07-19T18:29:00.027
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
 F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
 F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6
-F src/test_multiplex.c 0585bb12a98521795344f67d17d77e258ea7b57f
+F src/test_multiplex.c d1b43de1209bd1bc207b694a738fdb84a162f65b
 F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
 F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
 F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
@@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
-P 87017410f2fc3f2ae15ef06714563ba9ad4350c7
-R 6dbb7226fc6df92a6d1fc7b30a91d1b6
+P 4355bf2908b923e844907c1e3c09be3bf469f833
+R 33ae39ed3129fdb3c8dbf2c830ddcfd5
 U drh
-Z 6ea6097405e5ac181fe822d84336e434
+Z 60f009445613def050e13415b0c93faf
index ee31564b146483a786d678316e13fcc963f07262..a91085ca7cc7e9fcdcb733a543fb0ceb55b693db 100644 (file)
@@ -1 +1 @@
-4355bf2908b923e844907c1e3c09be3bf469f833
\ No newline at end of file
+ed5f0aad6b21066bacd01521e82c22e96991f400
\ No newline at end of file
index 60ccbcc35f8adc866ef2105b7c7ab8b7aad2a612..2203c60b5473d2ca6078f89e82cf081067a282cd 100644 (file)
@@ -272,7 +272,8 @@ static int multiplexGetTempname(sqlite3_vfs *pOrigVfs, int nBuf, char *zBuf){
         attempts++;
         sqlite3_randomness(8, &zBuf[j]);
         for(i=0; i<8; i++){
-          zBuf[j+i] = (char)zChars[ ((unsigned char)zBuf[j+i])%(sizeof(zChars)-1) ];
+          unsigned char uc = (unsigned char)zBuf[j+i];
+          zBuf[j+i] = (char)zChars[uc%(sizeof(zChars)-1)];
         }
         memcpy(&zBuf[j+i], ".tmp", 5);
         rc = pOrigVfs->xAccess(pOrigVfs, zBuf, SQLITE_ACCESS_EXISTS, &exists);
@@ -289,21 +290,31 @@ static int multiplexGetTempname(sqlite3_vfs *pOrigVfs, int nBuf, char *zBuf){
 /* Translate an sqlite3_file* that is really a multiplexGroup* into
 ** the sqlite3_file* for the underlying original VFS.
 */
-static sqlite3_file *multiplexSubOpen(multiplexConn *pConn, int iChunk, int *rc, int *pOutFlags){
+static sqlite3_file *multiplexSubOpen(
+  multiplexConn *pConn,
+  int iChunk,
+  int *rc,
+  int *pOutFlags
+){
   multiplexGroup *pGroup = pConn->pGroup;
   sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;        /* Real VFS */
   if( iChunk<pGroup->nMaxChunks ){
-    sqlite3_file *pSubOpen = pGroup->pReal[iChunk];    /* Real file descriptor */
+    sqlite3_file *pSubOpen = pGroup->pReal[iChunk];   /* Real file descriptor */
     if( !pGroup->bOpen[iChunk] ){
       memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1);
       if( iChunk ){
 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
-        sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, SQLITE_MULTIPLEX_EXT_FMT, iChunk);
+        sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
+             gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ,
+             SQLITE_MULTIPLEX_EXT_FMT, iChunk);
 #else
-        sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName, SQLITE_MULTIPLEX_EXT_FMT, iChunk);
+        sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
+             gMultiplex.zName+pGroup->nName,
+             SQLITE_MULTIPLEX_EXT_FMT, iChunk);
 #endif
       }
-      *rc = pOrigVfs->xOpen(pOrigVfs, gMultiplex.zName, pSubOpen, pGroup->flags, pOutFlags);
+      *rc = pOrigVfs->xOpen(pOrigVfs, gMultiplex.zName, pSubOpen,
+                            pGroup->flags, pOutFlags);
       if( *rc==SQLITE_OK ){
         pGroup->bOpen[iChunk] = -1;
         return pSubOpen;
@@ -389,9 +400,9 @@ static int multiplexOpen(
   int flags,                 /* Flags to control the opening */
   int *pOutFlags             /* Flags showing results of opening */
 ){
-  int rc = SQLITE_OK;                            /* Result code */
-  multiplexConn *pMultiplexOpen;                 /* The new multiplex file descriptor */
-  multiplexGroup *pGroup;                        /* Corresponding multiplexGroup object */
+  int rc = SQLITE_OK;                  /* Result code */
+  multiplexConn *pMultiplexOpen;       /* The new multiplex file descriptor */
+  multiplexGroup *pGroup;              /* Corresponding multiplexGroup object */
   sqlite3_file *pSubOpen;                        /* Real file descriptor */
   sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;   /* Real VFS */
   int nName;
@@ -419,7 +430,7 @@ static int multiplexOpen(
   if( rc==SQLITE_OK ){
     /* allocate space for group */
     nName = multiplexStrlen30(zName);
-    sz = sizeof(multiplexGroup)                                /* multiplexGroup */
+    sz = sizeof(multiplexGroup)                             /* multiplexGroup */
        + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS)  /* pReal[] */
        + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS)      /* *pReal */
        + SQLITE_MULTIPLEX_MAX_CHUNKS                           /* bOpen[] */
@@ -624,16 +635,22 @@ static int multiplexRead(
   multiplexEnter();
   if( !pGroup->bEnabled ){
     sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL);
-    rc = ( !pSubOpen ) ? SQLITE_IOERR_READ : pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst);
+    if( !pSubOpen ){
+      rc = SQLITE_IOERR_READ;
+    }else{
+      rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst);
+    }
   }else{
     while( iAmt > 0 ){
       int i = (int)(iOfst / pGroup->nChunkSize);
       sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL);
       if( pSubOpen ){
-        int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize;
+        int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) -
+                                                        pGroup->nChunkSize;
         if( extra<0 ) extra = 0;
         iAmt -= extra;
-        rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst % pGroup->nChunkSize);
+        rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt,
+                                       iOfst % pGroup->nChunkSize);
         if( rc!=SQLITE_OK ) break;
         pBuf = (char *)pBuf + iAmt;
         iOfst += iAmt;
@@ -664,16 +681,22 @@ static int multiplexWrite(
   multiplexEnter();
   if( !pGroup->bEnabled ){
     sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL);
-    rc = ( !pSubOpen ) ? SQLITE_IOERR_WRITE : pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst);
+    if( pSubOpen==0 ){
+      rc = SQLITE_IOERR_WRITE;
+    }else{
+      rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst);
+    }
   }else{
     while( iAmt > 0 ){
       int i = (int)(iOfst / pGroup->nChunkSize);
       sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL);
       if( pSubOpen ){
-        int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize;
+        int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) -
+                    pGroup->nChunkSize;
         if( extra<0 ) extra = 0;
         iAmt -= extra;
-        rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst % pGroup->nChunkSize);
+        rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt,
+                                        iOfst % pGroup->nChunkSize);
         if( rc!=SQLITE_OK ) break;
         pBuf = (char *)pBuf + iAmt;
         iOfst += iAmt;
@@ -699,7 +722,11 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){
   multiplexEnter();
   if( !pGroup->bEnabled ){
     sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL);
-    rc = ( !pSubOpen ) ? SQLITE_IOERR_TRUNCATE : pSubOpen->pMethods->xTruncate(pSubOpen, size);
+    if( pSubOpen==0 ){
+      rc = SQLITE_IOERR_TRUNCATE;
+    }else{
+      rc = pSubOpen->pMethods->xTruncate(pSubOpen, size);
+    }
   }else{
     int rc2;
     int i;
@@ -727,7 +754,7 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){
       rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0);
       if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE;
     }
-    pSubOpen = multiplexSubOpen(p, (int)(size / pGroup->nChunkSize), &rc2, NULL);
+    pSubOpen = multiplexSubOpen(p, (int)(size/pGroup->nChunkSize), &rc2, NULL);
     if( pSubOpen ){
       rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->nChunkSize);
       if( rc2!=SQLITE_OK ) rc = rc2;
@@ -771,7 +798,11 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){
   multiplexEnter();
   if( !pGroup->bEnabled ){
     sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL);
-    rc = ( !pSubOpen ) ? SQLITE_IOERR_FSTAT : pSubOpen->pMethods->xFileSize(pSubOpen, pSize);
+    if( pSubOpen==0 ){
+      rc = SQLITE_IOERR_FSTAT;
+    }else{
+      rc = pSubOpen->pMethods->xFileSize(pSubOpen, pSize);
+    }
   }else{
     *pSize = 0;
     for(i=0; i<pGroup->nMaxChunks; i++){
@@ -955,7 +986,7 @@ static int multiplexShmMap(
   int rc;
   sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL);
   if( pSubOpen ){
-    return pSubOpen->pMethods->xShmMap(pSubOpen, iRegion, szRegion, bExtend, pp);
+    return pSubOpen->pMethods->xShmMap(pSubOpen, iRegion, szRegion, bExtend,pp);
   }
   return SQLITE_IOERR;
 }
@@ -1060,7 +1091,8 @@ int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault){
   gMultiplex.sIoMethodsV1.xCheckReservedLock = multiplexCheckReservedLock;
   gMultiplex.sIoMethodsV1.xFileControl = multiplexFileControl;
   gMultiplex.sIoMethodsV1.xSectorSize = multiplexSectorSize;
-  gMultiplex.sIoMethodsV1.xDeviceCharacteristics = multiplexDeviceCharacteristics;
+  gMultiplex.sIoMethodsV1.xDeviceCharacteristics =
+                                            multiplexDeviceCharacteristics;
   gMultiplex.sIoMethodsV2 = gMultiplex.sIoMethodsV1;
   gMultiplex.sIoMethodsV2.iVersion = 2;
   gMultiplex.sIoMethodsV2.xShmMap = multiplexShmMap;