Mercurial > hg > audiodb
diff audioDB.cpp @ 508:23c47e118bc6
Better soap memory correctness.
Pass the struct soap down through audioDB::query into Reporter::report
methods.
We go through the audioDB constructor and do everything on the stack.
We'll eventually also need to add a pointer member within the audioDB
object, so that non-local transfers of control (particularly
audioDB::error) can still allocate soap-specific memory.
Then use soap_malloc() not new[] for memory allocation of
adbQueryResponse data structures.
author | mas01cr |
---|---|
date | Tue, 13 Jan 2009 21:37:14 +0000 |
parents | e7fd50483311 |
children | cc2b97d020b1 |
line wrap: on
line diff
--- a/audioDB.cpp Tue Jan 13 21:37:10 2009 +0000 +++ b/audioDB.cpp Tue Jan 13 21:37:14 2009 +0000 @@ -83,7 +83,7 @@ error("Unrecognized command",command); } -audioDB::audioDB(const unsigned argc, const char *argv[], adb__queryResponse *adbQueryResponse): O2_AUDIODB_INITIALIZERS +audioDB::audioDB(const unsigned argc, const char *argv[], struct soap *soap, adb__queryResponse *adbQueryResponse): O2_AUDIODB_INITIALIZERS { try { isServer = 1; // Set to make errors report over SOAP @@ -92,7 +92,7 @@ if(dbName && adb_root) prefix_name((char** const)&dbName, adb_root); assert(O2_ACTION(COM_QUERY)); - query(dbName, inFile, adbQueryResponse); + query(dbName, inFile, soap, adbQueryResponse); } catch(char *err) { cleanup(); throw(err); @@ -757,7 +757,7 @@ status(dbName); } -void audioDB::query(const char* dbName, const char* inFile, adb__queryResponse *adbQueryResponse) { +void audioDB::query(const char* dbName, const char* inFile, struct soap *soap, adb__queryResponse *adbQueryResponse) { if(!adb) { if(!(adb = audiodb_open(dbName, O_RDWR))) { @@ -951,7 +951,7 @@ } audiodb_query_free_results(adb, &qspec, rs); - reporter->report(adb, adbQueryResponse); + reporter->report(adb, soap, adbQueryResponse); } // This entry point is visited once per instance