Commit Graph

12530 Commits

Author SHA1 Message Date
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
axxel
c8bcf7f0bf ci: fix CI build by add missing libltdl-dev on ubuntu
Looks like they changed the build image...
2024-10-10 20:13:07 +02:00
axxel
0525436901 ptp2: next stop introduce ARRAY_OF(MTPObjectProp) for PTPObject::mtp_props 2024-10-10 20:13:07 +02:00
axxel
42a0a370c5 ptp2: replace PTPObjectHandles and PTPStorageIDs with generic array
This adds a set of macros implementing a generic array or list of TYPE.
This is basically a TYPE* pointer and a length integer. This structure
together with the typical use-cases repeats regularly throughout the
codebase. It raises the level of abstraction and improves code
readabilty. I'm a c++ developer and miss my STL ;).

I'm starting here with PTPObjectHandles and PTPStorageIDs as those were
already modeling an array abstraction. There are other arrays of stuff
that can benefit from this later.
2024-10-10 20:13:07 +02:00
axxel
f4313fdb74 ptp2: fix some potential memory leaks of PTPObjectInfo::Filename
This should better be fixed once and for all by replacing the heap
allocated `char* Filename` with a statically sized buffer. If only I
knew the 'correct' size for that.

See also here: 20fb75a086 (r147761481)
2024-10-10 20:13:07 +02:00
axxel
63dc01effb ptp2: use calloc to zero-initialize CameraFilePath objects 2024-10-10 20:13:07 +02:00
axxel
3696ba9594 ptp2: disable some unused canon functions 2024-10-10 20:13:07 +02:00
axxel
b67ac166ad ptp2: replace (most) oid/object_id symbols with handle
See last commit for reasoning of choosing this terminology.

TLDR: consistency spec / other API
2024-10-10 20:13:07 +02:00
axxel
381243104c ptp2: move 'oid' variable into PTPObjectInfo as (Object) 'Handle'
The (Object) Handle member is not part of the "ObjectInfo dataset" in the
specification but added here to avoid having to carry it around by
separate means throughout the code base, as it is regularly required in
combination. While the spec always refers to this item as "ObjectHandle",
the term "Handle" is only used in this context, so we omit the
"Object"-prefix for brevity.

Switching from oid/ObjectID, which is nowere to be found the spec,
increases consistency with the spec and the rest of the code base.

This allows to remove the struct _PTPCanon_New_Object from the codebase.

@msmeissn I added 2 TODO comments for you take a close look, pointing out:
 * a memory leak that I did not want to touch because I can't test it
 * a presumed bug fix where newobject was 0 when passed to ptp_getobject
2024-10-10 20:13:07 +02:00
Marcus Meissner
48e4b4910d rename event -> canonevent to avoid shadow variable warning 2024-10-09 10:10:36 +02:00
Marcus Meissner
f7b97ab75f added fuji gfx100 ii 2024-10-09 10:08:06 +02:00
Marcus Meissner
2231d211bb updated NEWS 2024-10-09 09:20:54 +02:00
axxel
0720269772 ptp2: rename PTPParams::uilocked -> eos_uilocked to make scope clearer 2024-10-08 09:47:44 +02:00
axxel
2eed98a494 ptp2: comment out currently unused MTPObjectFormat 2024-10-08 09:47:44 +02:00
axxel
af6cc96530 ptp2: rename MTPProperties struct and members...
... to be consistent with specification and also with the names of
similar symbols in the rest of the code.
2024-10-08 09:47:44 +02:00
axxel
eef6369669 ptp2: replace nrofsomearray pattern with somearray_len pattern
The "_len"-suffix to denote the length of an array of values is more
readable than the "nrof"-prefix and also used 3 times more often in the
rest of the code base.

Also replace the params->deviceproperties name with params->dpd_cache to
make it clearer what it actually is: an array of cached DevicePropDesc
structs.
2024-10-08 09:47:44 +02:00
axxel
8863c68c05 ptp2: replace "sizeof(a) / sizeof(a[0])"-pattern with ARRAYSIZE() macro 2024-10-08 09:47:44 +02:00
axxel
47b8f612e5 ptp2: drop the "Supported" string in some PTPDeviceInfo members
The PTPDeviceInfo struct contains information about the Operations, Events,
DeviceProperties, ImageFormats and CaptureFormats. With 3 of those 5 the
variables contained the additional "Supported" string, which does not add
any discriminating value and only makes for very long and therefore less
readable code lines and it is inconsistent.

Also use the term "DeviceProps" here as well for brevity and consistency.
2024-10-08 09:47:44 +02:00
axxel
06b7643b8d ptp2: rename DevicePropertyCode -> DevicePropCode for consistency 2024-10-08 09:47:44 +02:00
axxel
873185f734 ptp2: rename ObjectPropertyCode -> ObjectPropCode for consistency 2024-10-08 09:47:44 +02:00
axxel
4550a87355 ptp2: rename PTPPropertyValue to PTPPropValue for consistency
There are lots of other symbols like GetDevicePropValue that use the short
version "PropValue" already. Also the variables of this type are also most
often called "propval".
2024-10-08 09:47:44 +02:00
axxel
0a06af0e1d ptp2: rename (Object|Thumb)CompressedSize -> (Object|Thumb)Size
The terms ObjectCompressedSize and ThumbCompressedSize come from the PTP
specification. But I find them to be overly verbose because there is no
other size than this "compressed" size.

Other places like the CameraFileInfoFile struct also use the term "size"
instead of "compressed_size" for the same thing.
2024-10-08 09:47:44 +02:00
axxel
9bf1d49a4b ptp2: rename Maximum/MinimumValue -> Max/MinValue for better readability 2024-10-08 09:47:44 +02:00
axxel
8f19f80178 ptp2: rename FactoryDefaultValue -> DefaultValue for better readability 2024-10-08 09:47:44 +02:00
axxel
a0c45bd4e3 ptp: tune EOS_FocusInfoEx, FocusInfo event related code
With the re-enabled FocusInfoEx, the 5Ds spams the log and the
--wait-event console output with a 64 entry long focus info list.
Assuming no tooling is dependent on the particular string format of the
FocusInfoEx value, since it seems to only ever contain a no-empty
set of selected AF-points at the beginning of the capture process, where
the event is 'swollowed' by the focus detection code. This changeset
strips it down to only contain the list of selected AF-points, meaning
without focus, we now get a simple "{}".

Furthermore, the olcmask 0x0100 (FocusInfo) data of the 5Ds, R8 and R5m2
has been analyzed and the in-focus detection code during trigger_capture
has been improved. See code comments for details.
2024-10-07 09:13:10 +02:00