Mercurial > hg > audiodb
diff dump.cpp @ 334:100cf66a5825
Added command-line and WS methods to (LI)st key-(S)trings and si(Z)es of (T)racks --LISZT --lisztOffset offset --lisztLength len
author | mas01mc |
---|---|
date | Tue, 02 Sep 2008 16:16:59 +0000 |
parents | c93be2f3a674 |
children | 7d6dd067d12e |
line wrap: on
line diff
--- a/dump.cpp Mon Sep 01 15:35:05 2008 +0000 +++ b/dump.cpp Tue Sep 02 16:16:59 2008 +0000 @@ -184,3 +184,36 @@ status(dbName); } + +void audioDB::liszt(const char* dbName, unsigned offset, unsigned numLines, adb__lisztResponse* adbLisztResponse){ + if(!dbH) { + initTables(dbName, 0); + } + + assert(trackTable && fileTable); + + if(offset>dbH->numFiles){ + char tmpStr[MAXSTR]; + sprintf(tmpStr, "numFiles=%u, lisztOffset=%u", dbH->numFiles, offset); + error("listKeys offset out of range", tmpStr); + } + + if(!adbLisztResponse){ + for(Uns32T k=0; k<numLines && offset+k<dbH->numFiles; k++){ + fprintf(stdout, "[%d] %s (%d)\n", offset+k, fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE, trackTable[offset+k]); + } + } + else{ + adbLisztResponse->result.Rkey = new char*[numLines]; + adbLisztResponse->result.Rlen = new unsigned int[numLines]; + Uns32T k = 0; + for( ; k<numLines && offset+k<dbH->numFiles; k++){ + adbLisztResponse->result.Rkey[k] = new char[MAXSTR]; + snprintf(adbLisztResponse->result.Rkey[k], O2_MAXFILESTR, "%s", fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE); + adbLisztResponse->result.Rlen[k] = trackTable[offset+k]; + } + adbLisztResponse->result.__sizeRkey = k; + adbLisztResponse->result.__sizeRlen = k; + } + +}