** Advance an ZipfileCsr to its next row of output. */
| 6770 | ** Advance an ZipfileCsr to its next row of output. |
| 6771 | */ |
| 6772 | static int zipfileNext(sqlite3_vtab_cursor *cur){ |
| 6773 | ZipfileCsr *pCsr = (ZipfileCsr*)cur; |
| 6774 | int rc = SQLITE_OK; |
| 6775 | |
| 6776 | if( pCsr->pFile ){ |
| 6777 | i64 iEof = pCsr->eocd.iOffset + pCsr->eocd.nSize; |
| 6778 | zipfileEntryFree(pCsr->pCurrent); |
| 6779 | pCsr->pCurrent = 0; |
| 6780 | if( pCsr->iNextOff>=iEof ){ |
| 6781 | pCsr->bEof = 1; |
| 6782 | }else{ |
| 6783 | ZipfileEntry *p = 0; |
| 6784 | ZipfileTab *pTab = (ZipfileTab*)(cur->pVtab); |
| 6785 | rc = zipfileGetEntry(pTab, 0, 0, pCsr->pFile, pCsr->iNextOff, &p); |
| 6786 | if( rc==SQLITE_OK ){ |
| 6787 | pCsr->iNextOff += ZIPFILE_CDS_FIXED_SZ; |
| 6788 | pCsr->iNextOff += (int)p->cds.nExtra + p->cds.nFile + p->cds.nComment; |
| 6789 | } |
| 6790 | pCsr->pCurrent = p; |
| 6791 | } |
| 6792 | }else{ |
| 6793 | if( !pCsr->bNoop ){ |
| 6794 | pCsr->pCurrent = pCsr->pCurrent->pNext; |
| 6795 | } |
| 6796 | if( pCsr->pCurrent==0 ){ |
| 6797 | pCsr->bEof = 1; |
| 6798 | } |
| 6799 | } |
| 6800 | |
| 6801 | pCsr->bNoop = 0; |
| 6802 | return rc; |
| 6803 | } |
| 6804 | |
| 6805 | static void zipfileFree(void *p) { |
| 6806 | sqlite3_free(p); |
no test coverage detected