Mercurial > octave-libtiff
changeset 31123:0bcb35909ef4
Tiff open: removed support for rh mode and marked r+ as not yet supported
* __tiff__.cc(F__open_tiff__): added checks for supported mode to remove
support for rh mode and mark r+ mode as not yet supported.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Thu, 21 Jul 2022 20:03:43 +0200 |
parents | 1662939a7a49 |
children | e8d1cc309bc9 |
files | libinterp/dldfcn/__tiff__.cc |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/__tiff__.cc Wed Jul 20 03:50:43 2022 +0200 +++ b/libinterp/dldfcn/__tiff__.cc Thu Jul 21 20:03:43 2022 +0200 @@ -706,6 +706,7 @@ validate_tiff_get_field (TIFFGetField (tif, TIFFTAG_COLORMAP, &red, &green, &blue)); + // TODO(maged): use Array<T>::cat Matrix mat_out (count, 3); Matrix red_array (interpret_tag_data (red, @@ -866,6 +867,15 @@ // TODO(maged): check valid mode if (nargin == 2) mode = args (1).string_value (); + + std::vector<std::string> supported_modes {"r", "w", "w8", "a"}; + + if (std::find(supported_modes.begin(), supported_modes.end(), mode) + == supported_modes.end()) + if (mode == "r+") + error ("Openning files in r+ mode is not yet supported"); + else + error ("Invalid mode for openning Tiff file: %s", mode.c_str ()); // TODO(maged): Look into unwind action TIFF *tif = TIFFOpen (filename.c_str (), mode.c_str ());