Mercurial > hg > audiodb
changeset 381:9742ea0ac33d
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)
author | mas01cr |
---|---|
date | Fri, 21 Nov 2008 14:32:27 +0000 |
parents | 7d6dd067d12e |
children | 8425d05eda33 |
files | audioDB.cpp audioDB_API.h |
diffstat | 2 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);