/ Check-in [5a3140e4]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Memory reallocation fix for the Win32 VFS for lsm1.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5a3140e4dedace6de4366a3c52e41b818b6d19f356fdab738c6605afc1b674fa
User & Date: mistachkin 2017-07-07 16:06:30
Context
2017-07-07
16:09
In lsmtest, use an empty string instead of ":memory:" when requesting a temporary database from SQLite. This prevents other test code from trying to unlink() ":memory:", which fails on win32. check-in: 281ad505 user: dan tags: trunk
16:07
Remove a block from the Win32 VFS for lsm1 that is now superfluous. check-in: db4a4140 user: mistachkin tags: trunk
16:06
Memory reallocation fix for the Win32 VFS for lsm1. check-in: 5a3140e4 user: mistachkin tags: trunk
16:00
Enhance the sqlite3VdbeMultiLoad() interface to automatically generate the OP_ResultRow opcode on PRAGMA implementations, for a small reduction in the library footprint. check-in: c46f0f07 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/lsm1/lsm_win32.c.

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689


690
691
692
693

694

695
696
697
698
699
700
701
  int rc = LSM_OK;
  Win32File *pWin32File;

  pWin32File = lsmMallocZero(pEnv, sizeof(Win32File));
  if( pWin32File==0 ){
    rc = LSM_NOMEM_BKPT;
  }else{
    HANDLE hFile;

    rc = win32Open(pEnv, zFile, flags, &hFile);
    if( rc==LSM_OK ){
      memset(&pWin32File->sysInfo, 0, sizeof(SYSTEM_INFO));
      GetSystemInfo(&pWin32File->sysInfo);
      pWin32File->pEnv = pEnv;
      pWin32File->zName = zFile;
................................................................................
    if( fileSize.QuadPart<nReq ){
      rc = win32Truncate(pWin32File->hShmFile, nReq);
      if( rc!=LSM_OK ){
        return rc;
      }
    }

    ahNew = (LPHANDLE)lsmRealloc(pWin32File->pEnv, pWin32File->ahShm,
                                 sizeof(LPHANDLE) * nNew);
    if( !ahNew ) return LSM_NOMEM_BKPT;
    apNew = (LPVOID *)lsmRealloc(pWin32File->pEnv, pWin32File->apShm,
                                 sizeof(LPVOID) * nNew);
    if( !apNew ){
      lsmFree(pWin32File->pEnv, ahNew);
      return LSM_NOMEM_BKPT;
    }


    for(i=pWin32File->nShm; i<nNew; i++){
      ahNew[i] = NULL;
      apNew[i] = NULL;
    }

    pWin32File->ahShm = ahNew;

    pWin32File->apShm = apNew;
    pWin32File->nShm = nNew;
  }

  if( pWin32File->ahShm[iChunk]==NULL ){
    HANDLE hMap;
    assert( nReq<=0xFFFFFFFF );







|







 







<
|

<
|




>
>




>

>







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
674
675
676
677
678
679
680

681
682

683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
  int rc = LSM_OK;
  Win32File *pWin32File;

  pWin32File = lsmMallocZero(pEnv, sizeof(Win32File));
  if( pWin32File==0 ){
    rc = LSM_NOMEM_BKPT;
  }else{
    HANDLE hFile = NULL;

    rc = win32Open(pEnv, zFile, flags, &hFile);
    if( rc==LSM_OK ){
      memset(&pWin32File->sysInfo, 0, sizeof(SYSTEM_INFO));
      GetSystemInfo(&pWin32File->sysInfo);
      pWin32File->pEnv = pEnv;
      pWin32File->zName = zFile;
................................................................................
    if( fileSize.QuadPart<nReq ){
      rc = win32Truncate(pWin32File->hShmFile, nReq);
      if( rc!=LSM_OK ){
        return rc;
      }
    }


    ahNew = (LPHANDLE)lsmMallocZero(pWin32File->pEnv, sizeof(LPHANDLE) * nNew);
    if( !ahNew ) return LSM_NOMEM_BKPT;

    apNew = (LPVOID *)lsmMallocZero(pWin32File->pEnv, sizeof(LPVOID) * nNew);
    if( !apNew ){
      lsmFree(pWin32File->pEnv, ahNew);
      return LSM_NOMEM_BKPT;
    }
    memcpy(ahNew, pWin32File->ahShm, pWin32File->nShm);
    memcpy(apNew, pWin32File->apShm, pWin32File->nShm);
    for(i=pWin32File->nShm; i<nNew; i++){
      ahNew[i] = NULL;
      apNew[i] = NULL;
    }
    lsmFree(pWin32File->pEnv, pWin32File->ahShm);
    pWin32File->ahShm = ahNew;
    lsmFree(pWin32File->pEnv, pWin32File->apShm);
    pWin32File->apShm = apNew;
    pWin32File->nShm = nNew;
  }

  if( pWin32File->ahShm[iChunk]==NULL ){
    HANDLE hMap;
    assert( nReq<=0xFFFFFFFF );