1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix an alignment problem in test_async.c. (CVS 4840)

FossilOrigin-Name: 752d8e21bb250d7df58a3abc945fcd7a3b38ad15
This commit is contained in:
drh
2008-03-07 21:04:02 +00:00
parent 308aa32ffc
commit 5ce88abaa3
3 changed files with 18 additions and 13 deletions

View File

@@ -1011,6 +1011,7 @@ static int asyncOpen(
int nByte;
AsyncFileData *pData;
AsyncLock *pLock = 0;
char *z;
int isExclusive = (flags&SQLITE_OPEN_EXCLUSIVE);
nByte = (
@@ -1018,15 +1019,19 @@ static int asyncOpen(
2 * pVfs->szOsFile + /* AsyncFileData.pBaseRead and pBaseWrite */
nName /* AsyncFileData.zName */
);
pData = sqlite3_malloc(nByte);
if( !pData ){
z = sqlite3_malloc(nByte);
if( !z ){
return SQLITE_NOMEM;
}
memset(pData, 0, nByte);
pData->zName = (char *)&pData[1];
memset(z, 0, nByte);
pData = (AsyncFileData*)z;
z += sizeof(pData[0]);
pData->pBaseRead = (sqlite3_file*)z;
z += pVfs->szOsFile;
pData->pBaseWrite = (sqlite3_file*)z;
z += pVfs->szOsFile;
pData->zName = z;
pData->nName = nName;
pData->pBaseRead = (sqlite3_file *)&pData->zName[nName];
pData->pBaseWrite = (sqlite3_file *)&pData->zName[nName+pVfs->szOsFile];
pData->close.pFileData = pData;
pData->close.op = ASYNC_CLOSE;
memcpy(pData->zName, zName, nName);