-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Adds support for Reader to_folder method #31
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
base: main
Are you sure you want to change the base?
Conversation
@@ -465,6 +465,33 @@ pub unsafe extern "C" fn c2pa_reader_resource_to_stream( | |||
} | |||
} | |||
|
|||
/// Writes all the resources in a Reader to a folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Writes all the resources in a Reader to a folder. | |
/// Writes all the resources from a Reader to a folder. |
Your non-native reviewer got confused by the wording, but maybe my grammer is off.
/// Writes all the resources in a Reader to a folder. | ||
/// | ||
/// # Parameters | ||
/// * reader_ptr: pointer to a Reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like to add if the memory pointed to is actually modified or used read-only.
Here it's read-only, so not sure if it's worth adding?
Ok(_) => 0, | ||
Err(err) => { | ||
Error::from_c2pa_error(err).set_last(); | ||
-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not saying we should, but we could return more precise error codes in the future (not for this PR).
@@ -104,7 +104,7 @@ TEST(Builder, SignStream) | |||
dest.seekp(0, std::ios::beg); | |||
auto reader = c2pa::Reader("image/jpeg", dest); | |||
auto json = reader.json(); | |||
ASSERT_TRUE(json.find("c2pa.training-mining") != std::string::npos); | |||
ASSERT_TRUE(json.find("cawg.training-mining") != std::string::npos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack -
But our test cases could also have both during the transition period.
This only works for file paths, there is currently no streaming equivalent.
Writes the manifest.json and all resource, under associated manifest label folders.