/ Check-in [ad25127b]
Login

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

Overview
Comment:Fix overlapping read logic in the test_async.c demonstration. (CVS 3086)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ad25127b067b3135694ddb0de552aad981640669
User & Date: drh 2006-02-13 13:30:19
Context
2006-02-13
13:50
I/O errors shut down all processing on the same file in test_async.c. (CVS 3087) check-in: 4366e712 user: drh tags: trunk
13:30
Fix overlapping read logic in the test_async.c demonstration. (CVS 3086) check-in: ad25127b user: drh tags: trunk
13:23
Fix a memory leak in test_async.c. (CVS 3085) check-in: 904ffa4d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/test_async.c.

470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

  if( rc==SQLITE_OK ){
    AsyncWrite *p;
    i64 iOffset = pFile->iOffset;           /* Current seek offset */

    for(p=async.pQueueFirst; p; p = p->pNext){
      if( p->pFile==pFile && p->op==ASYNC_WRITE ){
        int iBeginIn = (p->iOffset - iOffset);
        int iBeginOut = (iOffset - p->iOffset);
        int nCopy;

        if( iBeginIn<0 ) iBeginIn = 0;
        if( iBeginOut<0 ) iBeginOut = 0;
        nCopy = MIN(p->nByte-iBeginIn, amt-iBeginOut);

        if( nCopy>0 ){







|
|







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

  if( rc==SQLITE_OK ){
    AsyncWrite *p;
    i64 iOffset = pFile->iOffset;           /* Current seek offset */

    for(p=async.pQueueFirst; p; p = p->pNext){
      if( p->pFile==pFile && p->op==ASYNC_WRITE ){
        int iBeginOut = (p->iOffset - iOffset);
        int iBeginIn = -iBeginOut;
        int nCopy;

        if( iBeginIn<0 ) iBeginIn = 0;
        if( iBeginOut<0 ) iBeginOut = 0;
        nCopy = MIN(p->nByte-iBeginIn, amt-iBeginOut);

        if( nCopy>0 ){