Commit Graph

12554 Commits

Author SHA1 Message Date
Marcus Meissner
f930df02e7 ci: disable -q for doxygen
some older distros do not like doxygen -q

https://github.com/gphoto/libgphoto2/issues/1046
2024-10-23 10:01:07 +02:00
axxel
202ad5112a ptp2: make ptp_getstorageids() return only valid ids
This removes the need to filter the list of StorageIDs in several places.
2024-10-22 14:35:14 +02:00
axxel
6a1a3fa672 ptp2: cleanup of find_child() and [folder|file]_list_func() functions
Those 3 functions were calling ptp_list_folder to update the object cache
and then iterating over the object cache to find the children of some
specific handle, thereby calling ptp_object_want() which could potentially
remove objects from the list they were iterating over. This was explicitly
marked as "DANGEROUS", which it was.

This patch introduces a return parameter to ptp_list_folder, to let the
caller know, which handles it found. This does two things: a) it is a
potential performance improvement and b) the caller can iterate over a
fixed list of handles, instead of a potentially changing list of objects.
This also did away with the 'retry' logic that tried to deal with this
situation.

I further removed the special fetching of the root folder entries from
the camera_init function and other places and I removed the code
duplication between file_list_func and folder_list_func.
2024-10-22 14:35:14 +02:00
axxel
72f9d46cb2 ptp2: fix readability and debug output in folder_to_handle ...
...by variable renaming.
2024-10-22 14:35:14 +02:00
axxel
d9f1a8b23b ptp2: replace calls to ptp_object_want with ptp_find_object_in_cache
This removes 3 unnecessary "potential" alterations of the object cache.
2024-10-22 14:35:14 +02:00
axxel
5f56e3a003 ptp2: remove call to ptp_object_want that had zero effect 2024-10-22 14:35:14 +02:00
axxel
5f01cb8c24 ptp2: use array abstraction and find_object_path in ptp_mtp_parse_metadata
This function contained basically another implementation of
find_object_path, which is now removed.
2024-10-22 14:35:14 +02:00
axxel
ba102842ba ptp2: fix usability issue with array_push_back
Having an implicit "move" that zeros out the source led to a painful
debugging session. This hidden behavior was a bad idea.

Adding array_init() for future use and minor fix of for_each().
2024-10-22 14:35:14 +02:00
axxel
5ceddf377c log: make gp_filesystem_list_files less verbose in debug log 2024-10-22 14:35:14 +02:00
axxel
37985b5e66 ptp2: make sure the returned mtp_get_playlist_string is null-terminated 2024-10-22 14:35:14 +02:00
axxel
47395d5af1 ptp2: use array abstraction for static special_files array 2024-10-22 14:35:14 +02:00
axxel
bd10adb926 ptp2: reduce code duplication near object path handling
* remove add_object()
* replace folder_to_storage() + find_folder_handle() macros with
  find_storage_and_handle_from_path() function
* introduce find_object_path() helper
* make find_child be const-correct w.r.t to 'const char*' path parameter
* handle EOSEvent_OjectInfoChanged together with
  PTP_EOSEvent_ObjectContentChanged
2024-10-22 14:35:14 +02:00
axxel
9a4bd6bf1e ptp2: reorder ptp_list_folder_eos call, reducing code duplication
This removes another ptp_object_want() call.
2024-10-22 14:35:14 +02:00
axxel
1f2557f39f ptp2: rename ptp_object_find* -> ptp_find_*object_in_cache
Improved naming consistency with other find-like functions.
2024-10-22 14:35:14 +02:00
axxel
df174be2bc ptp2: set fs mtime to oi.ModificationDate instead of local time on the host 2024-10-22 14:35:14 +02:00
axxel
b82ab905cb ptp2: Canon cameras are (potentially) mtp capable
This enables to get some info from `gphoto2 --get-metadata` for Canons,
e.g.

<ObjectFileName>LZQ_0530.JPG</ObjectFileName>
<PersistantUniqueObjectIdentifier>Unknown type 10</PersistantUniqueObjectIdentifier>
<Name>LZQ_0530.JPG</Name>
<DateCreated>20241002T163923.0</DateCreated>
<DateModified>20241002T163922.0</DateModified>
<Width>1920</Width>
<Height>1280</Height>
<ImageBitDepth>24</ImageBitDepth>
2024-10-22 14:35:14 +02:00
axxel
26927621d0 ptp2: code cosmetic and disabling of unused code 2024-10-22 14:35:14 +02:00
Marcus Meissner
9e01719f6b avoid duplicatge entry addition. 2024-10-21 16:13:05 +02:00
Marcus Meissner
b2f20526cb fetch the Sony ptp properties again
fixes https://github.com/gphoto/libgphoto2/pull/1044
2024-10-21 10:06:41 +02:00
Marcus Meissner
6a1a3f9924 adjust boundary check in for_each for non-standard cases (found by afl) 2024-10-19 12:14:20 +02:00
Marcus Meissner
2ba162af91 fixed another not always accepted syntax 2024-10-19 12:11:39 +02:00
Marcus Meissner
be357ed42f fix syntax 2024-10-19 12:04:43 +02:00
Marcus Meissner
d2f904ffec adjusted some TODOs 2024-10-19 12:02:21 +02:00
Marcus Meissner
1459b54b64 fixed incorrect pointer passed to free (afl) 2024-10-17 10:48:30 +02:00
dependabot[bot]
e1b2daff68 build(deps): bump actions/checkout from 2 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-15 14:10:50 +02:00
dependabot[bot]
8e8bfa8b1e build(deps): bump github/codeql-action from 1 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-15 14:10:30 +02:00
Marcus Meissner
7aee12749a try dependabot 2024-10-15 14:09:16 +02:00
axxel
adafc6137f ptp2: fix ci build failure by adding new array.h to Makefile-files 2024-10-14 14:54:15 +02:00
axxel
d2c5d86b46 ptp2: updated copyright info 2024-10-14 14:54:15 +02:00
axxel
2991ad4caa ptp2: move array abstraction macros to new array.h for potential 2024-10-14 14:54:15 +02:00
axxel
74baaf30e7 ptp2: use array abstraction for params->objects 2024-10-14 14:54:15 +02:00
axxel
f4ed45aca3 ptp2: fix bug in array_extend usage
Make it more obvious that array_extend (now array_extend_capacity) only
increases the allocated memory but does not change the len parameter.
2024-10-14 14:54:15 +02:00
axxel
b5516fd329 ptp2: ptp_object_want readability improvements and dead code removal 2024-10-14 14:54:15 +02:00
axxel
082ce439dd ptp2: use array abstraction for params->events
This also fixes a likely memcopy out of bounds error, see TODO comment.
2024-10-14 14:54:15 +02:00
axxel
665ce0391c ptp2: use array abstraction for dpd_cache 2024-10-14 14:54:15 +02:00
axxel
7f0cd33368 ptp2: reduce sizeof(PTPDevicePropDesc) by 4 bytes via member reordering 2024-10-14 14:54:15 +02:00
axxel
12872f0f76 ptp2: use ARRAY abstraction for PTPParams::canon_props 2024-10-14 14:54:15 +02:00
axxel
6ae9eec4de ptp2: introduce array_free_recursive(array, destructor) macro
This reduces code bloat and hopefully helps with not forgetting to call
the destructor of freed objects before freeing the array.
2024-10-14 14:54:15 +02:00
axxel
0f8b0d2416 ptp2: another round of memory leak fixes of PTPCanonEOSEvent
See f4313fdb74
2024-10-14 14:54:15 +02:00
axxel
d8eb297571 ptp2: replace PTPCanon_Property with single member PTPDevicePropDesc
Now dpd_cache and canon_props have the same type and can be merged.
2024-10-14 14:54:15 +02:00
axxel
c645d6f08b ptp2: move timestamp into PTPDevicePropDesc, remove PTPDeviceProperty
This prepares the merging of the dpd_cache and the canon_props members of
PTPParams.
2024-10-14 14:54:15 +02:00
axxel
7522853090 ptp2: add #include "ptp.h" in ptp-pack.c to help IDE find the symbols 2024-10-14 14:54:15 +02:00
axxel
1ee0cac49a ptp2: remove code duplication in parse_9301_value 2024-10-14 14:54:15 +02:00
axxel
c9782e9599 ptp2: free_propval naming cleanup, dead code removal and fixed 2 mem-leaks
ptp_free_object was leaking the memory of the mtp_props member and
ptp_ptp_free_devicepropvalue was leaking array memory of certain types.
2024-10-14 14:54:15 +02:00
axxel
67de966310 ptp2: make a failed realloc in array_extend() return GP_ERROR_NO_MEMORY
To be able to use the array macros in PTP and GP error "contexts", this
makes translate_ptp_result() tolerate both "types" of errors.

I added a comment regarding the use of the GP_ERROR_NO_MEMORY use. This is
related to #1008.
2024-10-14 14:54:15 +02:00
axxel
84e14fe1a3 ptp2: use new array abstraction for PTPParams->eos_events 2024-10-14 14:54:15 +02:00
Marcus Meissner
b4430364f7 fixed two use after free (gcc14) 2024-10-12 16:32:33 +02:00
axxel
e6af170121 ci: libltdl-dev was of course also missing in the CodeQL workflow 2024-10-10 20:13:07 +02:00
axxel
78c5f1b4a2 ptp2: fix build failures on macos...
* apparently reallocarray() is not supported
 * the compiler seems to have an issue with a goto label position
2024-10-10 20:13:07 +02:00
axxel
4cf33cd49e ptp2: fix -Wshadow warning 2024-10-10 20:13:07 +02:00