Mercurial > hg > audiodb
comparison 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 |
comparison
equal
deleted
inserted
replaced
385:4e68f7d4d524 | 386:4ded52b104e6 |
---|---|
1 #include "audioDB.h" | |
2 | |
3 void audioDB::liszt(const char* dbName, unsigned offset, unsigned numLines, adb__lisztResponse* adbLisztResponse){ | |
4 if(!dbH) { | |
5 initTables(dbName, 0); | |
6 } | |
7 | |
8 assert(trackTable && fileTable); | |
9 | |
10 if(offset>dbH->numFiles){ | |
11 char tmpStr[MAXSTR]; | |
12 sprintf(tmpStr, "numFiles=%u, lisztOffset=%u", dbH->numFiles, offset); | |
13 error("listKeys offset out of range", tmpStr); | |
14 } | |
15 | |
16 if(!adbLisztResponse){ | |
17 for(Uns32T k=0; k<numLines && offset+k<dbH->numFiles; k++){ | |
18 fprintf(stdout, "[%d] %s (%d)\n", offset+k, fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE, trackTable[offset+k]); | |
19 } | |
20 } | |
21 else{ | |
22 adbLisztResponse->result.Rkey = new char*[numLines]; | |
23 adbLisztResponse->result.Rlen = new unsigned int[numLines]; | |
24 Uns32T k = 0; | |
25 for( ; k<numLines && offset+k<dbH->numFiles; k++){ | |
26 adbLisztResponse->result.Rkey[k] = new char[MAXSTR]; | |
27 snprintf(adbLisztResponse->result.Rkey[k], O2_MAXFILESTR, "%s", fileTable+(offset+k)*O2_FILETABLE_ENTRY_SIZE); | |
28 adbLisztResponse->result.Rlen[k] = trackTable[offset+k]; | |
29 } | |
30 adbLisztResponse->result.__sizeRkey = k; | |
31 adbLisztResponse->result.__sizeRlen = k; | |
32 } | |
33 | |
34 } |