changeset 31096:c581ec211b45

Fixed bug for string tags. Multivalued and special case tags are still not working
author magedrifaat <magedrifaat@gmail.com>
date Fri, 24 Jun 2022 17:45:00 +0200
parents edfedae9972a
children 75ab26f147a5
files libinterp/dldfcn/__tiff__.cc
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__tiff__.cc	Fri Jun 24 04:13:33 2022 +0200
+++ b/libinterp/dldfcn/__tiff__.cc	Fri Jun 24 17:45:00 2022 +0200
@@ -25,7 +25,7 @@
             break;
 
         case TIFF_ASCII:
-            ov_data(0) = octave_value((char *)data);
+            ov_data(0) = octave_value(*(char **)data);
             break;
 
         case TIFF_SHORT:
@@ -35,7 +35,9 @@
             }
             break;
         
+        // TODO(maged): why is the data type 64-bit for non-bigtiff images?
         case TIFF_LONG:
+        case TIFF_LONG8:
             for (uint32_t i = 0; i < count; i++)
             {
                 ov_data(i) = octave_value(((uint32_t *)data)[i]);
@@ -64,6 +66,7 @@
             break;
 
         case TIFF_SLONG:
+        case TIFF_SLONG8:
             for (uint32_t i = 0; i < count; i++)
             {
                 ov_data(i) = octave_value(((int32_t *)data)[i]);
@@ -92,6 +95,7 @@
             break;
 
         case TIFF_IFD:
+        case TIFF_IFD8:
             // TODO(maged): implement IFD datatype
             error("Unimplemented IFFD data type");
             break;
@@ -189,8 +193,11 @@
 
 
     octave_value tag_data_ov;
+    // TIFFFieldReadCount returns VARIABLE for some scalar tags (e.g. Compression)
+    // But TIFFFieldPassCount seems consistent
     if (!TIFFFieldPassCount(fip))
     {
+        // TODO(maged): test this function vs actual data type size
         int type_size = TIFFDataWidth(TIFFFieldDataType(fip));
         void *data = _TIFFmalloc(type_size);
         // TODO(maged): This won't always work, e.g. string exepcts char **