-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object handling #1045
Merged
Merged
Object handling #1045
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>
Improved naming consistency with other find-like functions.
This removes another ptp_object_want() call.
* 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
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().
…adata This function contained basically another implementation of find_object_path, which is now removed.
This removes 3 unnecessary "potential" alterations of the object cache.
...by variable renaming.
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.
This removes the need to filter the list of StorageIDs in several places.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a set of patches mainly working on the reduction of the use of
ptp_object_want()
and especially eliminating it from inside loops over the object cache, which can cause 'problems', since the function may modify said object cache.This should fix the issue discussed here for good.