diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-02-07 21:00:18 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-02-07 21:00:18 +0000 |
commit | ef726cee6721f4a81951161c3d93347d4362d3d2 (patch) | |
tree | 1f73ade6dcdf4a8ae41a026e261ba58543d4fa45 /utils/MTP/sendfirm.c | |
parent | 7ae9c8d5ced6f9693c8b773f3614249a944f42ad (diff) | |
download | rockbox-ef726cee6721f4a81951161c3d93347d4362d3d2.tar.gz rockbox-ef726cee6721f4a81951161c3d93347d4362d3d2.zip |
Fix compilation of sendfirm with 0.3.x versions of libmtp and keep a (hacky) fallback for building with the older 0.2.x also fix a pair of 64 bit warnings
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19941 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/MTP/sendfirm.c')
-rw-r--r-- | utils/MTP/sendfirm.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/utils/MTP/sendfirm.c b/utils/MTP/sendfirm.c index f06a398696..5fe970797e 100644 --- a/utils/MTP/sendfirm.c +++ b/utils/MTP/sendfirm.c | |||
@@ -31,18 +31,19 @@ | |||
31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | #include <sys/types.h> | 32 | #include <sys/types.h> |
33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
34 | #include <inttypes.h> | ||
34 | #include "libmtp.h" | 35 | #include "libmtp.h" |
35 | 36 | ||
36 | LIBMTP_mtpdevice_t *device; | 37 | LIBMTP_mtpdevice_t *device; |
37 | 38 | ||
38 | static int progress(u_int64_t const sent, u_int64_t const total, | 39 | static int progress(uint64_t const sent, uint64_t const total, |
39 | void const *const data) | 40 | void const *const data) |
40 | { | 41 | { |
41 | int percent = (sent * 100) / total; | 42 | int percent = (sent * 100) / total; |
42 | #ifdef __WIN32__ | 43 | #ifdef __WIN32__ |
43 | printf("Progress: %I64u of %I64u (%d%%)\r", sent, total, percent); | 44 | printf("Progress: %I64u of %I64u (%d%%)\r", sent, total, percent); |
44 | #else | 45 | #else |
45 | printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent); | 46 | printf("Progress: %"PRIu64" of %"PRIu64" (%d%%)\r", sent, total, percent); |
46 | #endif | 47 | #endif |
47 | fflush(stdout); | 48 | fflush(stdout); |
48 | return 0; | 49 | return 0; |
@@ -64,7 +65,6 @@ int sendfile_function(char *from_path) | |||
64 | #endif | 65 | #endif |
65 | LIBMTP_file_t *genfile; | 66 | LIBMTP_file_t *genfile; |
66 | int ret; | 67 | int ret; |
67 | uint32_t parent_id = 0; | ||
68 | 68 | ||
69 | #ifdef __USE_LARGEFILE64 | 69 | #ifdef __USE_LARGEFILE64 |
70 | if (stat64(from_path, &sb) == -1) | 70 | if (stat64(from_path, &sb) == -1) |
@@ -90,8 +90,15 @@ int sendfile_function(char *from_path) | |||
90 | genfile->filetype = LIBMTP_FILETYPE_FIRMWARE; | 90 | genfile->filetype = LIBMTP_FILETYPE_FIRMWARE; |
91 | 91 | ||
92 | printf("Sending file...\n"); | 92 | printf("Sending file...\n"); |
93 | |||
94 | #ifdef OLDMTP | ||
95 | ret = LIBMTP_Send_File_From_File(device, from_path, genfile, progress, | ||
96 | NULL, 0); | ||
97 | #else | ||
93 | ret = LIBMTP_Send_File_From_File(device, from_path, genfile, progress, | 98 | ret = LIBMTP_Send_File_From_File(device, from_path, genfile, progress, |
94 | NULL, parent_id); | 99 | NULL); |
100 | #endif | ||
101 | |||
95 | printf("\n"); | 102 | printf("\n"); |
96 | if (ret != 0) | 103 | if (ret != 0) |
97 | { | 104 | { |