diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2010-03-26 21:24:37 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2010-03-26 21:24:37 +0000 |
commit | f39d48a5093455600d705c638b71156e353f843f (patch) | |
tree | 8b90e56e5c1fee003947e8939479beec90a52747 /tests | |
parent | df417243abc1e5f8c424aeffdbd7ff3ba33ab20e (diff) | |
download | libgphoto2-f39d48a5093455600d705c638b71156e353f843f.tar.gz |
use the new functions, fix logging
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12847 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-filesys.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/tests/test-filesys.c b/tests/test-filesys.c index 88c37ac78..dfe4dad1f 100644 --- a/tests/test-filesys.c +++ b/tests/test-filesys.c @@ -42,18 +42,15 @@ static void log_func (GPLogLevel __unused__ level, const char __unused__ *domain, - const char *format, va_list args, void __unused__ *data) + const char *str, void __unused__ *data) { - vprintf (format, args); - printf ("\n"); + printf ("%s\n", str); } static void -error_func (GPContext __unused__ *context, const char *format, va_list args, void __unused__ *data) +error_func (GPContext __unused__ *context, const char *str, void __unused__ *data) { - printf ("### "); - vprintf (format, args); - printf ("\n"); + printf ("### %s\n", str); } static int @@ -133,6 +130,13 @@ delete_file_func (CameraFilesystem __unused__ *fs, const char *folder, return (GP_OK); } +static CameraFilesystemFuncs fsfuncs = { + .get_info_func = get_info_func, + .set_info_func = set_info_func, + .del_file_func = delete_file_func, + .file_list_func = file_list_func, + .folder_list_func = folder_list_func, +}; int main () { @@ -157,10 +161,7 @@ main () CHECK (gp_filesystem_new (&fs)); printf ("*** Setting the callbacks...\n"); - CHECK (gp_filesystem_set_info_funcs (fs, get_info_func, set_info_func, - NULL)); - CHECK (gp_filesystem_set_file_funcs (fs, NULL, delete_file_func, - NULL)); + CHECK (gp_filesystem_set_funcs (fs, &fsfuncs, NULL)); printf ("*** Adding a file...\n"); CHECK (gp_filesystem_append (fs, "/", "my.file", context)); @@ -246,10 +247,6 @@ main () printf ("*** Resetting the filesystem...\n"); CHECK (gp_filesystem_reset (fs)); - printf ("*** Setting the listing callbacks...\n"); - CHECK (gp_filesystem_set_list_funcs (fs, file_list_func, - folder_list_func, NULL)); - gp_filesystem_dump (fs); printf ("*** Getting file list for folder '/whatever/directory'...\n"); |