annotate liszt.cpp @ 386:4ded52b104e6 api-inversion

Move "liszt" command into its own file.
author mas01cr
date Mon, 24 Nov 2008 09:38:35 +0000
parents
children e18843dc0aea
rev   line source
mas01cr@386 1 #include "audioDB.h"
mas01cr@386 2
mas01cr@386 3 void audioDB::liszt(const char* dbName, unsigned offset, unsigned numLines, adb__lisztResponse* adbLisztResponse){
mas01cr@386 4 if(!dbH) {
mas01cr@386 5 initTables(dbName, 0);
mas01cr@386 6 }
mas01cr@386 7
mas01cr@386 8 assert(trackTable && fileTable);
mas01cr@386 9
mas01cr@386 10 if(offset>dbH->numFiles){
mas01cr@386 11 char tmpStr[MAXSTR];
mas01cr@386 12 sprintf(tmpStr, "numFiles=%u, lisztOffset=%u", dbH->numFiles, offset);
mas01cr@386 13 error("listKeys offset out of range", tmpStr);
mas01cr@386 14 }
mas01cr@386 15
mas01cr@386 16 if(!adbLisztResponse){
mas01cr@386 17 for(Uns32T k=0; k<numLines && offset+k<dbH->numFiles; k++){
mas01cr@386 18 fprintf(stdout, "[%d] %s (%d)\n", offset+k, fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE, trackTable[offset+k]);
mas01cr@386 19 }
mas01cr@386 20 }
mas01cr@386 21 else{
mas01cr@386 22 adbLisztResponse->result.Rkey = new char*[numLines];
mas01cr@386 23 adbLisztResponse->result.Rlen = new unsigned int[numLines];
mas01cr@386 24 Uns32T k = 0;
mas01cr@386 25 for( ; k<numLines && offset+k<dbH->numFiles; k++){
mas01cr@386 26 adbLisztResponse->result.Rkey[k] = new char[MAXSTR];
mas01cr@386 27 snprintf(adbLisztResponse->result.Rkey[k], O2_MAXFILESTR, "%s", fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE);
mas01cr@386 28 adbLisztResponse->result.Rlen[k] = trackTable[offset+k];
mas01cr@386 29 }
mas01cr@386 30 adbLisztResponse->result.__sizeRkey = k;
mas01cr@386 31 adbLisztResponse->result.__sizeRlen = k;
mas01cr@386 32 }
mas01cr@386 33
mas01cr@386 34 }