@@ -1180,10 +1180,11 @@ class OIIO_API ImageInput {
11801180 // /
11811181 // / @returns
11821182 // / `true` if the file was found and opened successfully.
1183- virtual bool open (const std::string& name, ImageSpec &newspec) = 0;
1183+ OIIO_NODISCARD_ERROR virtual bool open (const std::string& name,
1184+ ImageSpec &newspec) = 0;
11841185
11851186 // / Open the ImageInput using a UTF-16 encoded wstring filename.
1186- bool open (const std::wstring& name, ImageSpec &newspec) {
1187+ OIIO_NODISCARD_ERROR bool open (const std::wstring& name, ImageSpec &newspec) {
11871188 return open (Strutil::utf16_to_utf8 (name), newspec);
11881189 }
11891190
@@ -1207,13 +1208,14 @@ class OIIO_API ImageInput {
12071208 // /
12081209 // / @returns
12091210 // / `true` if the file was found and opened successfully.
1210- virtual bool open (const std::string& name, ImageSpec &newspec,
1211- const ImageSpec& config OIIO_MAYBE_UNUSED) {
1211+ OIIO_NODISCARD_ERROR virtual bool open (const std::string& name,
1212+ ImageSpec &newspec,
1213+ const ImageSpec& config OIIO_MAYBE_UNUSED) {
12121214 return open (name,newspec);
12131215 }
12141216 // / Open the ImageInput using a UTF-16 encoded wstring filename.
1215- bool open (const std::wstring& name, ImageSpec &newspec,
1216- const ImageSpec& config OIIO_MAYBE_UNUSED) {
1217+ OIIO_NODISCARD_ERROR bool open (const std::wstring& name, ImageSpec &newspec,
1218+ const ImageSpec& config OIIO_MAYBE_UNUSED) {
12171219 return open (name,newspec);
12181220 }
12191221
@@ -1411,15 +1413,17 @@ class OIIO_API ImageInput {
14111413 // / y, and z).
14121414 // / @returns `true` upon success, or `false` upon failure.
14131415 // /
1414- virtual bool read_image (int subimage, int miplevel, int chbegin, int chend,
1415- TypeDesc format, const image_span<std::byte>& data);
1416+ OIIO_NODISCARD_ERROR virtual bool
1417+ read_image (int subimage, int miplevel, int chbegin, int chend,
1418+ TypeDesc format, const image_span<std::byte>& data);
14161419
14171420 // / A version of `read_image()` taking an `image_span<T>`, where the type
14181421 // / of the underlying data is `T`. This is a convenience wrapper around
14191422 // / the `read_image()` that takes an `image_span<std::byte>`.
14201423 template <typename T>
1421- bool read_image (int subimage, int miplevel, int chbegin, int chend,
1422- const image_span<T>& data)
1424+ OIIO_NODISCARD_ERROR bool read_image (int subimage, int miplevel,
1425+ int chbegin, int chend,
1426+ const image_span<T>& data)
14231427 {
14241428 static_assert (!std::is_const_v<T>,
14251429 " read_image() does not accept image_span<const T>" );
@@ -1432,8 +1436,8 @@ class OIIO_API ImageInput {
14321436 // / contiguous strides in all dimensions. This is a convenience wrapper
14331437 // / around the `read_image()` that takes an `image_span<T>`.
14341438 template <typename T>
1435- bool read_image (int subimage, int miplevel, int chbegin, int chend ,
1436- span<T> data)
1439+ OIIO_NODISCARD_ERROR bool read_image (int subimage, int miplevel,
1440+ int chbegin, int chend, span<T> data)
14371441 {
14381442 static_assert (!std::is_const_v<T>,
14391443 " read_image() does not accept span<const T>" );
@@ -1480,17 +1484,18 @@ class OIIO_API ImageInput {
14801484 // / Added in OIIO 3.1, this is the "safe" preferred alternative to
14811485 // / the version of read_scanlines that takes raw pointers.
14821486 // /
1483- virtual bool read_scanlines ( int subimage, int miplevel, int ybegin,
1484- int yend , int chbegin , int chend ,
1485- TypeDesc format,
1486- const image_span<std::byte>& data);
1487+ OIIO_NODISCARD_ERROR virtual bool
1488+ read_scanlines ( int subimage, int miplevel , int ybegin , int yend ,
1489+ int chbegin, int chend, TypeDesc format,
1490+ const image_span<std::byte>& data);
14871491
14881492 // / A version of `read_scanlines()` taking an `image_span<T>`, where the
14891493 // / type of the underlying data is `T`. This is a convenience wrapper
14901494 // / around the `read_scanlines()` that takes an `image_span<std::byte>`.
14911495 template <typename T>
1492- bool read_scanlines (int subimage, int miplevel, int ybegin, int yend,
1493- int chbegin, int chend, const image_span<T>& data)
1496+ OIIO_NODISCARD_ERROR bool
1497+ read_scanlines (int subimage, int miplevel, int ybegin, int yend,
1498+ int chbegin, int chend, const image_span<T>& data)
14941499 {
14951500 static_assert (!std::is_const_v<T>,
14961501 " read_scanlines() does not accept span<const T>" );
@@ -1504,8 +1509,9 @@ class OIIO_API ImageInput {
15041509 // / contiguous strides in all dimensions. This is a convenience wrapper
15051510 // / around the `read_scanlines()` that takes an `image_span<T>`.
15061511 template <typename T>
1507- bool read_scanlines (int subimage, int miplevel, int ybegin, int yend,
1508- int chbegin, int chend, span<T> data)
1512+ OIIO_NODISCARD_ERROR bool read_scanlines (int subimage, int miplevel,
1513+ int ybegin, int yend, int chbegin,
1514+ int chend, span<T> data)
15091515 {
15101516 static_assert (!std::is_const_v<T>,
15111517 " read_scanlines() does not accept span<const T>" );
@@ -1773,12 +1779,12 @@ class OIIO_API ImageInput {
17731779 // /
17741780 // / @note This call was changed for OpenImageIO 2.0 to include the
17751781 // / explicit subimage and miplevel parameters.
1776- virtual bool read_scanlines (int subimage, int miplevel,
1777- int ybegin, int yend, int z,
1778- int chbegin, int chend,
1779- TypeDesc format, void *data,
1780- stride_t xstride=AutoStride,
1781- stride_t ystride=AutoStride);
1782+ OIIO_NODISCARD_ERROR virtual bool read_scanlines (int subimage, int miplevel,
1783+ int ybegin, int yend, int z,
1784+ int chbegin, int chend,
1785+ TypeDesc format, void *data,
1786+ stride_t xstride=AutoStride,
1787+ stride_t ystride=AutoStride);
17821788
17831789 // / Read the tile whose upper-left origin is (x,y,z) into `data[]`,
17841790 // / converting if necessary from the native data format of the file into
@@ -1904,14 +1910,14 @@ class OIIO_API ImageInput {
19041910 // / @param progress_callback/progress_callback_data
19051911 // / Optional progress callback.
19061912 // / @returns `true` upon success, or `false` upon failure.
1907- virtual bool read_image (int subimage, int miplevel,
1908- int chbegin, int chend,
1909- TypeDesc format, void *data,
1910- stride_t xstride=AutoStride,
1911- stride_t ystride=AutoStride,
1912- stride_t zstride=AutoStride,
1913- ProgressCallback progress_callback=NULL ,
1914- void *progress_callback_data=NULL );
1913+ OIIO_NODISCARD_ERROR virtual bool read_image (int subimage, int miplevel,
1914+ int chbegin, int chend,
1915+ TypeDesc format, void *data,
1916+ stride_t xstride=AutoStride,
1917+ stride_t ystride=AutoStride,
1918+ stride_t zstride=AutoStride,
1919+ ProgressCallback progress_callback=NULL ,
1920+ void *progress_callback_data=NULL );
19151921
19161922 // / @}
19171923
0 commit comments