libtiff: Merge branch 'Correct_tag_auto-registration_description' into 'master'

https://github.com/libsdl-org/libtiff/commit/e1980072c95e6b01615899f9378c5554372837c0

From 2f549e36157b2bb0ed51b04e55238f8d772ddf90 Mon Sep 17 00:00:00 2001
From: Su Laus <[EMAIL REDACTED]>
Date: Fri, 18 Mar 2022 23:03:56 +0000
Subject: [PATCH] Correct reading description for anonymous tag
 auto-registration in addingtags.html (closes 353)

---
 html/addingtags.html | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/html/addingtags.html b/html/addingtags.html
index 7e197e25..462d1ebf 100644
--- a/html/addingtags.html
+++ b/html/addingtags.html
@@ -32,8 +32,8 @@ <h2>TIFFFieldInfo</h2>
 <pre>
 typedef	struct {
   ttag_t    field_tag;          /* field's tag */
-  short	    field_readcount;    /* read count/TIFF_VARIABLE/TIFF_SPP */
-  short	    field_writecount;   /* write count/TIFF_VARIABLE */
+  short	    field_readcount;    /* read count / TIFF_VARIABLE / TIFF_VARIABLE2 / TIFF_SPP */
+  short	    field_writecount;   /* write count / TIFF_VARIABLE / TIFF_VARIABLE2 */
   TIFFDataType field_type;      /* type of associated data */
   unsigned short field_bit;     /* bit in fieldsset bit vector */
   unsigned char field_oktochange;/* if true, can change while writing */
@@ -51,9 +51,9 @@ <h2>TIFFFieldInfo</h2>
 The special value TIFF_VARIABLE (-1) indicates that a variable number of
 values may be read.  The special value TIFFTAG_SPP (-2) indicates that there
 should be one value for each sample as defined by TIFFTAG_SAMPLESPERPIXEL.  
-The special value TIFF_VARIABLE2 (-3) is presumably similar to TIFF_VARIABLE
-though I am not sure what the distinction in behaviour is.  This field
-is TIFF_VARIABLE for variable length ascii fields.<p>
+The special value TIFF_VARIABLE2 (-3) is similar to TIFF_VARIABLE
+but the required TIFFGetField() count value must be uint32_t* instead of uint16_t* as for TIFF_VARIABLE (-1).  
+For ASCII fields with variable length, this field is TIFF_VARIABLE.<p>
 
 <li> <b>field_writecount</b>: The number of values which should be written.
 Generally the same as field_readcount.  A few built-in exceptions exist, but
@@ -106,10 +106,17 @@ <h2>Default Tag Auto-registration</h2>
 TIFFGetField().<p>
 
 When tags are autodefined like this the <b>field_readcount</b> and
-<b>field_writecount</b> values are always TIFF_VARIABLE.  The 
+<b>field_writecount</b> values are always TIFF_VARIABLE2 (-3).  The 
 <b>field_passcount</b> is always TRUE, and the <b>field_bit</b> is 
 FIELD_CUSTOM.  The field name will be "Tag %d" where the %d is the tag 
-number.<p>  
+number.
+<BR>Thus, to read anonymous auto-registered tags use the following:
+<pre>
+    uint32_t count;
+    void* value;  //has to be a pointer to the expected value type.
+    TIFFGetField(tif, TIFFTAG_UNKNOWN_TO_LIBTIFF, &count, &value);
+
+</pre><p>  
 
 <h2>Defining Application Tags</h2>