From ee6b4e3a33804967b71c3749f54cd475440cb8d7 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Mon, 4 Apr 2016 20:27:29 +0900 Subject: [PATCH] fix build warnings Change-Id: I1056a7934c704812e4cee1cb1f61d46ef6373697 Signed-off-by: HyiHong Chae --- examples/albumart.c | 11 +++++++++++ examples/detect.c | 2 ++ examples/thumb.c | 11 +++++++++++ packaging/libmtp.spec | 2 +- src/libmtp.c | 6 +++++- src/libusb1-glue.c | 19 +++++++++++++++++-- src/ptp.c | 3 +++ 7 files changed, 50 insertions(+), 4 deletions(-) diff --git a/examples/albumart.c b/examples/albumart.c index c98b305..6536ea4 100755 --- a/examples/albumart.c +++ b/examples/albumart.c @@ -124,8 +124,19 @@ int main (int argc, char **argv) { return 1; } else { +#ifdef TIZEN_EXT + int rv; + rv = read(fd, imagedata, filesize); + close(fd); + + if (rv < 0) { + printf("Read fail.\n"); + return 0; + } +#else /* TIZEN_EXT */ read(fd, imagedata, filesize); close(fd); +#endif /* TIZEN_EXT */ } LIBMTP_Init(); diff --git a/examples/detect.c b/examples/detect.c index 92e43b8..e155708 100755 --- a/examples/detect.c +++ b/examples/detect.c @@ -134,7 +134,9 @@ int main (int argc, char **argv) char *friendlyname; char *syncpartner; char *sectime; +#ifndef TIZEN_EXT char *devcert; +#endif /* TIZEN_EXT */ uint16_t *filetypes; uint16_t filetypes_len; uint8_t maxbattlevel; diff --git a/examples/thumb.c b/examples/thumb.c index 2718a0c..03f8983 100755 --- a/examples/thumb.c +++ b/examples/thumb.c @@ -93,8 +93,19 @@ int main (int argc, char **argv) { return 1; } else { +#ifdef TIZEN_EXT + int rv; + rv = read(fd, imagedata, filesize); + close(fd); + + if (rv < 0) { + printf("Read fail.\n"); + return 0; + } +#else /* TIZEN_EXT */ read(fd, imagedata, filesize); close(fd); +#endif /* TIZEN_EXT */ } LIBMTP_Init(); diff --git a/packaging/libmtp.spec b/packaging/libmtp.spec index 9deaef7..a28e197 100755 --- a/packaging/libmtp.spec +++ b/packaging/libmtp.spec @@ -3,7 +3,7 @@ Name: libmtp Summary: Library for media transfer protocol (mtp) Version: 1.1.9 -Release: 11 +Release: 12 Group: Network & Connectivity/Other License: LGPL-2.1 Source0: libmtp-%{version}.tar.gz diff --git a/src/libmtp.c b/src/libmtp.c index ab6797a..10bd30f 100755 --- a/src/libmtp.c +++ b/src/libmtp.c @@ -214,6 +214,10 @@ static int set_object_filename(LIBMTP_mtpdevice_t *device, static char *generate_unique_filename(PTPParams* params, char const * const filename); static int check_filename_exists(PTPParams* params, char const * const filename); +#ifdef TIZEN_EXT +int _is_exist_handler(uint32_t **object_list, int size, int current_handler); +#endif /* TIZEN_EXT */ + /** * These are to wrap the get/put handlers to convert from the MTP types to PTP types * in a reliable way @@ -9234,7 +9238,7 @@ static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id } #ifdef TIZEN_EXT -int _is_exist_handler(int **object_list, int size, int current_handler) +int _is_exist_handler(uint32_t **object_list, int size, int current_handler) { int i; diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c index e187420..e2fd45b 100755 --- a/src/libusb1-glue.c +++ b/src/libusb1-glue.c @@ -865,8 +865,8 @@ ptp_read_func ( unsigned char *bytes; int expect_terminator_byte = 0; unsigned long usb_inep_maxpacket_size; - unsigned long context_block_size_1; - unsigned long context_block_size_2; + unsigned long context_block_size_1 = 0; + unsigned long context_block_size_2 = 0; uint16_t ptp_dev_vendor_id = ptp_usb->rawdevice.device_entry.vendor_id; //"iRiver" device special handling @@ -2100,6 +2100,9 @@ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, if (err) { libusb_free_device_list (devs, 0); +#ifdef TIZEN_EXT + free (ptp_usb); +#endif /* TIZEN_EXT */ LIBMTP_ERROR("LIBMTP PANIC: Unable to find interface & endpoints of device\n"); return LIBMTP_ERROR_CONNECTING; } @@ -2111,6 +2114,9 @@ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { LIBMTP_ERROR("LIBMTP PANIC: Unable to initialize device\n"); libusb_free_device_list (devs, 0); +#ifdef TIZEN_EXT + free (ptp_usb); +#endif /* TIZEN_EXT */ return LIBMTP_ERROR_CONNECTING; } @@ -2127,6 +2133,9 @@ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, if(init_ptp_usb(params, ptp_usb, ldevice) <0) { LIBMTP_ERROR("LIBMTP PANIC: Could not init USB on second attempt\n"); libusb_free_device_list (devs, 0); +#ifdef TIZEN_EXT + free (ptp_usb); +#endif /* TIZEN_EXT */ return LIBMTP_ERROR_CONNECTING; } @@ -2134,6 +2143,9 @@ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("LIBMTP PANIC: failed to open session on second attempt\n"); libusb_free_device_list (devs, 0); +#ifdef TIZEN_EXT + free (ptp_usb); +#endif /* TIZEN_EXT */ return LIBMTP_ERROR_CONNECTING; } } @@ -2151,6 +2163,9 @@ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, ret); libusb_release_interface(ptp_usb->handle, ptp_usb->interface); libusb_free_device_list (devs, 0); +#ifdef TIZEN_EXT + free (ptp_usb); +#endif /* TIZEN_EXT */ return LIBMTP_ERROR_CONNECTING; } diff --git a/src/ptp.c b/src/ptp.c index 159b243..0f904a9 100755 --- a/src/ptp.c +++ b/src/ptp.c @@ -22,7 +22,10 @@ * Boston, MA 02110-1301 USA */ +#ifndef TIZEN_EXT #define _BSD_SOURCE +#endif /* TIZEN_EXT */ + #include "config.h" #include "ptp.h" -- 2.7.4