Skip to content

api: add OIIO_NODISCARD_ERROR to tiffutils.h#5215

Open
rose413 wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
rose413:nodiscard-tiffutils-h
Open

api: add OIIO_NODISCARD_ERROR to tiffutils.h#5215
rose413 wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
rose413:nodiscard-tiffutils-h

Conversation

@rose413
Copy link
Copy Markdown
Contributor

@rose413 rose413 commented May 27, 2026

Description

Add OIIO_NODISCARD_ERROR to the following functions in tiffutils.h to enforce that callers check their bool return values:

  • decode_exif
  • decode_iptc_iim
  • encode_iptc_iim
  • decode_xmp
  • decode_icc_profile

Fix callers in tiffoutput.cpp, png_pvt.h, and webpinput.cpp that were previously ignoring return values.

Tests

  • No new testsuite case added; the annotations are enforced at compile time.

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • [] I have updated the documentation if my PR adds features or changes
    behavior.
  • [] I am sure that this PR's changes are tested in the testsuite.
  • [] I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.
  • [] If I added or modified a public C++ API call, I have also amended the
    corresponding Python bindings. If altering ImageBufAlgo functions, I also
    exposed the new functionality as oiiotool options.

rose413 added 2 commits May 27, 2026 13:00
Add OIIO_NODISCARD_ERROR to the following functions in tiffutils.h to
enforce that callers check their bool return values:
  - decode_exif
  - decode_iptc_iim
  - encode_iptc_iim
  - decode_xmp
  - decode_icc_profile

Fix callers in tiffoutput.cpp, png_pvt.h, and webpinput.cpp that were
previously ignoring return values.
- Assisted-by: Claude Sonnet 4.6

Signed-off-by: rose413 <116857309+rose413@users.noreply.github.com>
/// plugin. Note that IIM is actually considered obsolete and is
/// replaced by an XML scheme called XMP.
OIIO_API bool decode_iptc_iim (string_view iptc, ImageSpec &spec);
OIIO_NODISCARD_ERROR OIIO_API bool decode_iptc_iim (string_view iptc, ImageSpec &spec);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is fine, sorry, GitHub won't let me comment on lines that you don't change, so I have to put this here!

But another 4 lines down, there is a function that could use an OIIO_NODISCARD_ERROR that you didn't add.

Also somewhat above, the exif_tag_lookup and gps_tag_lookup functions.

… tiffutils.h

- Annotate decode_exif, decode_iptc_iim, exif_tag_lookup , and gps_tag_lookup with OIIO_NODISCARD_ERROR.
- Fix all call sites in png_pvt.h, tiffinput.cpp, and jpeginput.cpp
- Assisted-by: Claude Sonnet 4.6
Signed-off-by: rose413 <116857309+rose413@users.noreply.github.com>
@lgritz
Copy link
Copy Markdown
Collaborator

lgritz commented May 28, 2026

This seems to be failing most of the CI jobs. Is your GitHub fork set up with the option that allows ordinary pushes to your own fork (prior to submitting a PR) to trigger running the CI workflows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants