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

Side by Side Diff: examples/filetree.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 unified diff | Download patch
« no previous file with comments | « examples/files.c ('k') | examples/folders.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * \file filetree.c 2 * \file filetree.c
3 * List all files and folders of all storages recursively 3 * List all files and folders of all storages recursively
4 * 4 *
5 * Copyright (C) 2011 Linus Walleij <triad@df.lth.se> 5 * Copyright (C) 2011 Linus Walleij <triad@df.lth.se>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 LIBMTP_file_t *file; 42 LIBMTP_file_t *file;
43 43
44 files = LIBMTP_Get_Files_And_Folders(device, 44 files = LIBMTP_Get_Files_And_Folders(device,
45 storage->id, 45 storage->id,
46 leaf); 46 leaf);
47 if (files == NULL) { 47 if (files == NULL) {
48 return; 48 return;
49 } 49 }
50 50
51 /* Iterate over the filelisting */ 51 /* Iterate over the filelisting */
52 file = files; 52 for (file = files; file != NULL; file = file->next) {
53 while (file != NULL) {
54 int i; 53 int i;
55 LIBMTP_file_t *oldfile;
56 54
57 /* Indent */ 55 /* Indent */
58 for (i = 0; i < depth; i++) { 56 for (i = 0; i < depth; i++) {
59 printf(" "); 57 printf(" ");
60 } 58 }
61 printf("%u %s\n", file->item_id, file->filename); 59 printf("%u %s\n", file->item_id, file->filename);
62 if (file->filetype == LIBMTP_FILETYPE_FOLDER) { 60 if (file->filetype == LIBMTP_FILETYPE_FOLDER) {
63 recursive_file_tree(device, storage, file->item_id, depth+2); 61 recursive_file_tree(device, storage, file->item_id, depth+2);
64 } 62 }
65
66 oldfile = file;
67 file = file->next;
68 LIBMTP_destroy_file_t(oldfile);
69 } 63 }
70 } 64 }
71 65
72 int main (int argc, char **argv) 66 int main (int argc, char **argv)
73 { 67 {
74 LIBMTP_raw_device_t * rawdevices; 68 LIBMTP_raw_device_t * rawdevices;
75 int numrawdevices; 69 int numrawdevices;
76 LIBMTP_error_number_t err; 70 LIBMTP_error_number_t err;
77 int i; 71 int i;
78 72
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 bailout: 147 bailout:
154 LIBMTP_Release_Device(device); 148 LIBMTP_Release_Device(device);
155 } /* End For Loop */ 149 } /* End For Loop */
156 150
157 free(rawdevices); 151 free(rawdevices);
158 152
159 printf("OK.\n"); 153 printf("OK.\n");
160 154
161 return 0; 155 return 0;
162 } 156 }
OLDNEW
« no previous file with comments | « examples/files.c ('k') | examples/folders.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698