Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: examples/folders.c

Issue 2364793002: Revert "Uprev libmtp to 1.1.12" (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libmtp@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/filetree.c ('k') | examples/sendtr.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/folders.c
diff --git a/examples/folders.c b/examples/folders.c
index 34ea9ce30f7e3b1ac49fdc919a9ccf31f031b1be..f139343474d10be20f1e3c22b559522711884b79 100644
--- a/examples/folders.c
+++ b/examples/folders.c
@@ -41,14 +41,13 @@ static void dump_folder_list(LIBMTP_folder_t *folderlist, int level)
int main (int argc, char **argv)
{
- LIBMTP_raw_device_t *rawdevices;
- int numrawdevices;
- int i;
+ LIBMTP_mtpdevice_t *device_list, *device;
LIBMTP_Init();
printf("Attempting to connect device(s)\n");
- switch (LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices)) {
+ switch(LIBMTP_Get_Connected_Devices(&device_list))
+ {
case LIBMTP_ERROR_NO_DEVICE_ATTACHED:
printf("mtp-folders: no devices found\n");
return 0;
@@ -64,7 +63,7 @@ int main (int argc, char **argv)
default:
fprintf(stderr, "mtp-folders: Unknown error, please report "
"this to the libmtp developers\n");
- return 1;
+ return 1;
/* Successfully connected at least one device, so continue */
case LIBMTP_ERROR_NONE:
@@ -72,18 +71,12 @@ int main (int argc, char **argv)
}
/* iterate through connected MTP devices */
- for (i = 0; i < numrawdevices; i++) {
- LIBMTP_mtpdevice_t *device;
+ for(device = device_list; device != NULL; device = device->next)
+ {
LIBMTP_devicestorage_t *storage;
char *friendlyname;
int ret;
- device = LIBMTP_Open_Raw_Device(&rawdevices[i]);
- if (device == NULL) {
- fprintf(stderr, "Unable to open raw device %d\n", i);
- continue;
- }
-
/* Echo the friendly name so we know which device we are working with */
friendlyname = LIBMTP_Get_Friendlyname(device);
if (friendlyname == NULL) {
@@ -121,10 +114,9 @@ int main (int argc, char **argv)
}
LIBMTP_destroy_folder_t(folders);
}
- LIBMTP_Release_Device(device);
}
- free(rawdevices);
+ LIBMTP_Release_Device_List(device_list);
printf("OK.\n");
return 0;
« no previous file with comments | « examples/filetree.c ('k') | examples/sendtr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698