OLD | NEW |
1 /** | 1 /** |
2 * \file libmtp.c | 2 * \file libmtp.c |
3 * | 3 * |
4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> | 4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> |
5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> | 5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> |
6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> | 6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> |
7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com> | 7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com> |
8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> | 8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 while (element[i] != '.' && i < strlen(element)) | 1771 while (element[i] != '.' && i < strlen(element)) |
1772 i++; | 1772 i++; |
1773 if (i > majstart && i < strlen(element)) { | 1773 if (i > majstart && i < strlen(element)) { |
1774 LIBMTP_device_extension_t *extension; | 1774 LIBMTP_device_extension_t *extension; |
1775 int major = 0; | 1775 int major = 0; |
1776 int minor = 0; | 1776 int minor = 0; |
1777 char *majorstr = strndup(element + majstart, i - majstart); | 1777 char *majorstr = strndup(element + majstart, i - majstart); |
1778 char *minorstr = strndup(element + i + 1, strlen(element) - i - 1); | 1778 char *minorstr = strndup(element + i + 1, strlen(element) - i - 1); |
1779 major = atoi(majorstr); | 1779 major = atoi(majorstr); |
1780 minor = atoi(minorstr); | 1780 minor = atoi(minorstr); |
| 1781 free(majorstr); |
| 1782 free(minorstr); |
1781 extension = malloc(sizeof(LIBMTP_device_extension_t)); | 1783 extension = malloc(sizeof(LIBMTP_device_extension_t)); |
1782 extension->name = name; | 1784 extension->name = name; |
1783 extension->major = major; | 1785 extension->major = major; |
1784 extension->minor = minor; | 1786 extension->minor = minor; |
1785 extension->next = NULL; | 1787 extension->next = NULL; |
1786 if (mtpdevice->extensions == NULL) { | 1788 if (mtpdevice->extensions == NULL) { |
1787 mtpdevice->extensions = extension; | 1789 mtpdevice->extensions = extension; |
1788 } else { | 1790 } else { |
1789 LIBMTP_device_extension_t *tmp = mtpdevice->extensions; | 1791 LIBMTP_device_extension_t *tmp = mtpdevice->extensions; |
1790 while (tmp->next != NULL) | 1792 while (tmp->next != NULL) |
(...skipping 7153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8944 * @param device the device which may have a cache to which the object should be
updated. | 8946 * @param device the device which may have a cache to which the object should be
updated. |
8945 * @param object_id the object to update. | 8947 * @param object_id the object to update. |
8946 */ | 8948 */ |
8947 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id
) | 8949 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id
) |
8948 { | 8950 { |
8949 PTPParams *params = (PTPParams *)device->params; | 8951 PTPParams *params = (PTPParams *)device->params; |
8950 | 8952 |
8951 ptp_remove_object_from_cache(params, object_id); | 8953 ptp_remove_object_from_cache(params, object_id); |
8952 add_object_to_cache(device, object_id); | 8954 add_object_to_cache(device, object_id); |
8953 } | 8955 } |
OLD | NEW |