# HG changeset patch # User mas01cr # Date 1227277947 0 # Node ID 9742ea0ac33d3cd901af241110a1357ea0fa8cf9 # Parent 7d6dd067d12ee443e9ea294bfa3a45d2dc071d20 API const correctness. The char *path arguments to audiodb_open() and audiodb_create() should be const; make it so. Also arrange for the datasize, ntracks and datadim arguments to audiodb_create() to be unsigned to match the fields in the internal audioDB class. Technically this is an ABI change, but since nothing is calling this function with anything other than zero arguments yet (correct me if I'm wrong) no-one should notice. (If you notice, shout) diff -r 7d6dd067d12e -r 9742ea0ac33d audioDB.cpp --- a/audioDB.cpp Fri Nov 21 12:23:08 2008 +0000 +++ b/audioDB.cpp Fri Nov 21 14:32:27 2008 +0000 @@ -907,9 +907,7 @@ #include "audioDB_API.h" - - //adb_ptr audiodb_create(char * path,long ntracks, long datadim) { - adb_ptr audiodb_create(char * path,long datasize,long ntracks, long datadim) { + adb_ptr audiodb_create(const char *path, unsigned datasize, unsigned ntracks, unsigned datadim) { const char *argv[12]; int argvctr=0; char tempstr1[200]; @@ -925,19 +923,19 @@ if (datasize >0){ argv[argvctr++]="--datasize"; - snprintf(tempstr1,sizeof(tempstr1),"%ld",datasize); + snprintf(tempstr1,sizeof(tempstr1),"%u",datasize); argv[argvctr++]=tempstr1; } if (ntracks >0){ argv[argvctr++]="--ntracks"; - snprintf(tempstr2,sizeof(tempstr2),"%ld",ntracks); + snprintf(tempstr2,sizeof(tempstr2),"%u",ntracks); argv[argvctr++]=tempstr2; } if (datadim > 0){ argv[argvctr++]="--datadim"; - snprintf(tempstr3,sizeof(tempstr3),"%ld",datadim); + snprintf(tempstr3,sizeof(tempstr3),"%u",datadim); argv[argvctr++]=tempstr3; } @@ -1310,7 +1308,7 @@ return apierror; } - adb_ptr audiodb_open(char * path){ + adb_ptr audiodb_open(const char *path){ adb_ptr mydbp; adbstatus mystatus; diff -r 7d6dd067d12e -r 9742ea0ac33d audioDB_API.h --- a/audioDB_API.h Fri Nov 21 12:23:08 2008 +0000 +++ b/audioDB_API.h Fri Nov 21 14:32:27 2008 +0000 @@ -86,12 +86,11 @@ /* open an existing database */ /* returns a struct or NULL on failure */ -adb_ptr audiodb_open(char * path); +adb_ptr audiodb_open(const char *path); /* create a new database */ /* returns a struct or NULL on failure */ -//adb_ptr audiodb_create(char * path,long ntracks, long datadim); -adb_ptr audiodb_create(char * path,long datasize, long ntracks, long datadim); +adb_ptr audiodb_create(const char *path, unsigned datasize, unsigned ntracks, unsigned datadim); /* close a database */ void audiodb_close(adb_ptr db);