diff --git a/camlibs/digita/digita.c b/camlibs/digita/digita.c index ed1f4691c..14ffb41f1 100644 --- a/camlibs/digita/digita.c +++ b/camlibs/digita/digita.c @@ -433,6 +433,13 @@ static int delete_file_func(CameraFilesystem *fs, const char *folder, return digita_file_delete(camera, folder, filename, context); } +static CameraFilesystemFuncs fsfuncs = { + .file_list_func = file_list_func, + .folder_list_func = folder_list_func, + .get_file_func = get_file_func, + .del_file_func = delete_file_func +}; + int camera_init(Camera *camera, GPContext *context) { int ret = 0; @@ -446,10 +453,7 @@ int camera_init(Camera *camera, GPContext *context) camera->functions->about = camera_about; /* Set up the CameraFilesystem */ - gp_filesystem_set_list_funcs(camera->fs, file_list_func, - folder_list_func, camera); - gp_filesystem_set_file_funcs(camera->fs, get_file_func, - delete_file_func, camera); + gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera); GP_DEBUG( "Initializing the camera"); diff --git a/camlibs/enigma13/enigma13.c b/camlibs/enigma13/enigma13.c index 94c83b244..8eb79c2fa 100644 --- a/camlibs/enigma13/enigma13.c +++ b/camlibs/enigma13/enigma13.c @@ -416,6 +416,12 @@ camera_id (CameraText *id) return (GP_OK); } +static CameraFilesystemFuncs fsfuncs = { + .file_list_func = file_list_func, + .get_file_func = get_file_func, + .delete_all_func = enigma13_flash_delete_all +}; + int camera_init (Camera *camera, GPContext *context) { @@ -423,14 +429,7 @@ camera_init (Camera *camera, GPContext *context) camera->functions->about = enigma13_about; - CHECK(gp_filesystem_set_list_funcs - (camera->fs, file_list_func, NULL, camera)); - CHECK(gp_filesystem_set_file_funcs - (camera->fs, get_file_func, NULL, camera)); - CHECK(gp_filesystem_set_folder_funcs - (camera->fs,NULL, enigma13_flash_delete_all , NULL, NULL, camera)); - - + CHECK(gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera)); CHECK(gp_port_get_settings( camera->port, &settings)); settings.usb.inep = 0x82; settings.usb.outep = 0x03; @@ -439,7 +438,6 @@ camera_init (Camera *camera, GPContext *context) settings.usb.altsetting = 0; CHECK(gp_port_set_timeout (camera->port, ENIGMA13_USB_TIMEOUT_MS)); CHECK(gp_port_set_settings( camera->port, settings)); - return GP_OK; diff --git a/camlibs/iclick/library.c b/camlibs/iclick/library.c index b91172e00..84d1e2ffa 100644 --- a/camlibs/iclick/library.c +++ b/camlibs/iclick/library.c @@ -324,6 +324,11 @@ camera_exit (Camera *camera, GPContext *context) return GP_OK; } +static CameraFilesystemFuncs fsfuncs = { + .file_list_func = file_list_func, + .get_file_func = get_file_func +}; + int camera_init(Camera *camera, GPContext *context) { @@ -345,11 +350,7 @@ camera_init(Camera *camera, GPContext *context) if (ret < 0) return ret; /* Tell the CameraFilesystem where to get lists from */ - gp_filesystem_set_list_funcs (camera->fs, file_list_func, - NULL, camera); - gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera); - gp_filesystem_set_folder_funcs (camera->fs, NULL, NULL, - NULL, NULL, camera); + gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = malloc (sizeof (CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; @@ -363,8 +364,6 @@ camera_init(Camera *camera, GPContext *context) if (ret != GP_OK) { free(camera->pl); return ret; - }; - - + } return GP_OK; } diff --git a/camlibs/lg_gsm/library.c b/camlibs/lg_gsm/library.c index 82190be36..ae1a12bba 100644 --- a/camlibs/lg_gsm/library.c +++ b/camlibs/lg_gsm/library.c @@ -179,6 +179,11 @@ camera_exit (Camera *camera, GPContext *context) return GP_OK; } +static CameraFilesystemFuncs fsfuncs = { + .file_list_func = file_list_func, + .get_file_func = get_file_func +}; + int camera_init(Camera *camera, GPContext *context) { @@ -218,8 +223,7 @@ camera_init(Camera *camera, GPContext *context) GP_DEBUG("outep = %x\n", settings.usb.outep); /* Tell the CameraFilesystem where to get lists from */ - gp_filesystem_set_list_funcs (camera->fs, file_list_func, NULL, camera); - gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera); + gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = malloc (sizeof (CameraPrivateLibrary)); if (!camera->pl) @@ -228,6 +232,5 @@ camera_init(Camera *camera, GPContext *context) /* Connect to the camera */ lg_gsm_init (camera->port, &camera->pl->model, camera->pl->info); - return GP_OK; }