More API changes
diff --git a/examples/filetree.c b/examples/filetree.c
index 09e5bf3..880369f 100644
--- a/examples/filetree.c
+++ b/examples/filetree.c
@@ -42,7 +42,7 @@
LIBMTP_file_t *file;
files = LIBMTP_Get_Files_And_Folders(device,
- storage,
+ storage->id,
leaf);
if (files == NULL) {
return;
diff --git a/examples/folders.c b/examples/folders.c
index ee63709..5aeaee0 100644
--- a/examples/folders.c
+++ b/examples/folders.c
@@ -1,8 +1,8 @@
-/**
+/**
* \file folders.c
* Example program that lists all folders on a device.
*
- * Copyright (C) 2005-2007 Linus Walleij <[email protected]>
+ * Copyright (C) 2005-2011 Linus Walleij <[email protected]>
* Copyright (C) 2007 Ted Bullock <[email protected]>
*
* This library is free software; you can redistribute it and/or
@@ -45,12 +45,12 @@
LIBMTP_folder_t *folders;
LIBMTP_Init();
- fprintf(stdout, "Attempting to connect device(s)\n");
+ printf("Attempting to connect device(s)\n");
switch(LIBMTP_Get_Connected_Devices(&device))
{
case LIBMTP_ERROR_NO_DEVICE_ATTACHED:
- fprintf(stdout, "mtp-folders: No Devices have been found\n");
+ printf("mtp-folders: No Devices have been found\n");
return 0;
case LIBMTP_ERROR_CONNECTING:
fprintf(stderr, "mtp-folders: There has been an error connecting. Exit\n");
@@ -58,7 +58,7 @@
case LIBMTP_ERROR_MEMORY_ALLOCATION:
fprintf(stderr, "mtp-folders: Memory Allocation Error. Exit\n");
return 1;
-
+
/* Unknown general errors - This should never execute */
case LIBMTP_ERROR_GENERAL:
default:
@@ -68,14 +68,14 @@
/* Successfully connected at least one device, so continue */
case LIBMTP_ERROR_NONE:
- fprintf(stdout, "mtp-folders: Successfully connected\n");
- fflush(stdout);
+ printf("mtp-folders: Successfully connected\n");
}
-
+
/* iterate through connected MTP devices */
for(iter = device; iter != NULL; iter = iter->next)
{
- char *friendlyname;
+ char *friendlyname;
+
/* Echo the friendly name so we know which device we are working with */
friendlyname = LIBMTP_Get_Friendlyname(iter);
if (friendlyname == NULL) {
@@ -84,12 +84,12 @@
printf("Friendly name: %s\n", friendlyname);
free(friendlyname);
}
-
+
LIBMTP_Dump_Errorstack(iter);
LIBMTP_Clear_Errorstack(iter); /* Get folder listing */
folders = LIBMTP_Get_Folder_List(iter);
-
+
if (folders == NULL) {
fprintf(stdout, "No folders found\n");
LIBMTP_Dump_Errorstack(iter);
@@ -101,7 +101,6 @@
LIBMTP_destroy_folder_t(folders);
}
-
LIBMTP_Release_Device_List(device);
printf("OK.\n");
diff --git a/src/libmtp.c b/src/libmtp.c
index 4876f2f..7f30025 100644
--- a/src/libmtp.c
+++ b/src/libmtp.c
@@ -4060,7 +4060,7 @@
* @param parent the parent folder id.
*/
LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *device,
- LIBMTP_devicestorage_t const * const storage,
+ uint32_t const storage,
uint32_t const parent)
{
PTPParams *params = (PTPParams *) device->params;
@@ -4082,7 +4082,7 @@
if (storage == NULL)
storageid = PTP_GOH_ALL_STORAGE;
else
- storageid = storage->id;
+ storageid = storage;
ret = ptp_getobjecthandles(params,
storageid,
diff --git a/src/libmtp.h.in b/src/libmtp.h.in
index 013ac57..5520ab7 100644
--- a/src/libmtp.h.in
+++ b/src/libmtp.h.in
@@ -863,7 +863,7 @@
LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *,
LIBMTP_progressfunc_t const, void const * const);
LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *,
- LIBMTP_devicestorage_t const * const,
+ uint32_t const,
uint32_t const);
LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const);
int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const,