diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test_multiplex.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 5d29607ac..334024fc1 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -96,26 +96,14 @@ # 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 +/* Default limit on number of chunks. +** May be changed by calling ** the xFileControl() interface. */ #ifndef SQLITE_MULTIPLEX_MAX_CHUNKS # define SQLITE_MULTIPLEX_MAX_CHUNKS 32 #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 +292,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; |