I made a safe_sqlite3_open function like this:

                /* From sqlite.c --> query_and_populate function */
                int safe_sqlite3_open(char *tablename, sqlite3 *db)
                {
                   int retval;

                   retval = sqlite3_open(tablename, db);

                   if(retval != SQLITE_OK)
                      HandleError(retval, "sqlite3_open", "Can't open database: 
%s", sqlite3_errmsg(db));

                   return retval;
                 }

        In normal usage, I call the function like this:

                /* From safecalls.c --> safe_sqlite3_open */
                sqlite3 *db;

                rc = safe_sqlite3_open(tablename, &db);

        When I run make, though, I get these errors:

                gcc -g -c cursedj.c -o cursedj.o 
                gcc -g -c musicinfo.c -o musicinfo.o 
                gcc -g -c sqlite.c -o sqlite.o
                sqlite.c: In function ‘query_and_populate’:
                sqlite.c:14: warning: passing argument 2 of ‘safe_sqlite3_open’ 
from incompatible pointer type
                gcc -g -c winmanip.c -o winmanip.o 
                gcc -g -c output.c -o output.o 
                gcc -g -c dhandler.c -o dhandler.o
                gcc -g -c help.c -o help.o 
                gcc -g -c file.c -o file.o
                gcc -g -c safecalls.c -o safecalls.o
                safecalls.c: In function ‘safe_sqlite3_open’:
                safecalls.c:152: warning: passing argument 2 of ‘sqlite3_open’ 
from incompatible pointer type
                gcc -Wall -g -lm -lncurses -lsqlite3 -o cursedj cursedj.o 
musicinfo.o sqlite.o winmanip.o \
                        output.o dhandler.o help.o file.o safecalls.o

        I know that they're just warnings, but, how can I pass the sqlite3 
pointer to my safe function 
without getting any errors?  I've tried making the function parameters "*&", 
"&", passing the "address of" 
to the function...all to no avail, except what I have now, but I get those 
warnings, BUT, the code does 
work and my program runs the way it is above.

-- 
VR~
        TW
        Email: twilliams...@elp.rr.com
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to