diff options
author | drh <drh@noemail.net> | 2011-11-18 13:10:51 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-11-18 13:10:51 +0000 |
commit | 5e4461b26150ccf96a19ded631d92a30f92b6711 (patch) | |
tree | 7f74124bd5748a82c3141452a1d005c67b920daa /src | |
parent | 21495ba8a3d6079f55379eefbf8ed0567c51187c (diff) | |
parent | d236b16412aa7f2e6b01798eaa80782705ded691 (diff) | |
download | sqlite-5e4461b26150ccf96a19ded631d92a30f92b6711.tar.gz sqlite-5e4461b26150ccf96a19ded631d92a30f92b6711.zip |
Change the multiplexor to use a 3-digit suffix.
FossilOrigin-Name: 0b7edc44757660c8a5ae3b91cbcc3e6afd419b28
Diffstat (limited to 'src')
-rw-r--r-- | src/test_multiplex.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 5d29607ac..2ca8bf8d5 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -96,26 +96,16 @@ # define SQLITE_MULTIPLEX_CHUNK_SIZE 2147418112 #endif -/* Default limit on number of chunks. Care should be taken -** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT -** format specifier. It may be changed by calling -** the xFileControl() interface. +/* This used to be the default limit on number of chunks, but +** it is no longer enforced. There is currently no limit to the +** number of chunks. +** +** May be changed by calling the xFileControl() interface. */ #ifndef SQLITE_MULTIPLEX_MAX_CHUNKS -# define SQLITE_MULTIPLEX_MAX_CHUNKS 32 +# define SQLITE_MULTIPLEX_MAX_CHUNKS 12 #endif -/* If SQLITE_MULTIPLEX_EXT_OVWR is defined, the -** last SQLITE_MULTIPLEX_EXT_SZ characters of the -** filename will be overwritten, otherwise, the -** multiplex extension is simply appended to the filename. -** Ex. (undefined) test.db -> test.db01 -** (defined) test.db -> test.01 -** Chunk 0 does not have a modified extension. -*/ -#define SQLITE_MULTIPLEX_EXT_FMT "%02d" -#define SQLITE_MULTIPLEX_EXT_SZ 2 - /************************ Object Definitions ******************************/ /* Forward declaration of all object types */ @@ -304,20 +294,18 @@ static int multiplexSubFilename(multiplexGroup *pGroup, int iChunk){ if( pGroup->aReal[iChunk].z==0 ){ char *z; int n = pGroup->nName; - pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+3 ); + pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+4 ); if( z==0 ){ return SQLITE_NOMEM; } memcpy(z, pGroup->zName, n+1); if( iChunk>0 ){ #ifdef SQLITE_ENABLE_8_3_NAMES - if( n>3 && z[n-3]=='.' ){ - n--; - }else if( n>4 && z[n-4]=='.' ){ - n -= 2; - } + int i; + for(i=n-1; i>0 && i>=n-4 && z[i]!='.'; i--){} + if( i>=n-4 ) n = i+1; #endif - sqlite3_snprintf(3,&z[n],"%02d",iChunk); + sqlite3_snprintf(4,&z[n],"%03d",iChunk); } } return SQLITE_OK; |