libtiff: Constify signature of _TIFFsetXXXXArray() functions, and remove unused _TIFFsetString()

https://github.com/libsdl-org/libtiff/commit/9aeb9f836a444411675a4684ca47683cf556722e

From 9aeb9f836a444411675a4684ca47683cf556722e Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Sun, 20 Feb 2022 13:46:23 +0100
Subject: [PATCH] Constify signature of _TIFFsetXXXXArray() functions, and
 remove unused _TIFFsetString()

---
 libtiff/tif_dir.c | 36 +++++++++++++++++-------------------
 libtiff/tiffiop.h | 11 +++++------
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index 9fd2d45a..3afd3142 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -40,7 +40,7 @@
 #define DATATYPE_IEEEFP		3       /* !IEEE floating point data */
 
 static void
-setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
+setByteArray(void** vpp, const void* vp, size_t nmemb, size_t elem_size)
 {
 	if (*vpp) {
 		_TIFFfree(*vpp);
@@ -54,22 +54,20 @@ setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
 			_TIFFmemcpy(*vpp, vp, bytes);
 	}
 }
-void _TIFFsetByteArray(void** vpp, void* vp, uint32_t n)
+void _TIFFsetByteArray(void** vpp, const void* vp, uint32_t n)
     { setByteArray(vpp, vp, n, 1); }
-void _TIFFsetString(char** cpp, char* cp)
-    { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
-static void _TIFFsetNString(char** cpp, char* cp, uint32_t n)
-    { setByteArray((void**) cpp, (void*) cp, n, 1); }
-void _TIFFsetShortArray(uint16_t** wpp, uint16_t* wp, uint32_t n)
-    { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16_t)); }
-void _TIFFsetLongArray(uint32_t** lpp, uint32_t* lp, uint32_t n)
-    { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32_t)); }
-static void _TIFFsetLong8Array(uint64_t** lpp, uint64_t* lp, uint32_t n)
-    { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint64_t)); }
-void _TIFFsetFloatArray(float** fpp, float* fp, uint32_t n)
-    { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
-void _TIFFsetDoubleArray(double** dpp, double* dp, uint32_t n)
-    { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }
+static void _TIFFsetNString(char** cpp, const char* cp, uint32_t n)
+    { setByteArray((void**) cpp, cp, n, 1); }
+void _TIFFsetShortArray(uint16_t** wpp, const uint16_t* wp, uint32_t n)
+    { setByteArray((void**) wpp, wp, n, sizeof (uint16_t)); }
+void _TIFFsetLongArray(uint32_t** lpp, const uint32_t* lp, uint32_t n)
+    { setByteArray((void**) lpp, lp, n, sizeof (uint32_t)); }
+static void _TIFFsetLong8Array(uint64_t** lpp, const uint64_t* lp, uint32_t n)
+    { setByteArray((void**) lpp, lp, n, sizeof (uint64_t)); }
+void _TIFFsetFloatArray(float** fpp, const float* fp, uint32_t n)
+    { setByteArray((void**) fpp, fp, n, sizeof (float)); }
+void _TIFFsetDoubleArray(double** dpp, const double* dp, uint32_t n)
+    { setByteArray((void**) dpp, dp, n, sizeof (double)); }
 
 static void
 setDoubleArrayOneValue(double** vpp, double value, size_t nmemb)
@@ -576,16 +574,16 @@ _TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap)
 		if (fip->field_type == TIFF_ASCII)
 		{
 			uint32_t ma;
-			char* mb;
+			const char* mb;
 			if (fip->field_passcount)
 			{
 				assert(fip->field_writecount==TIFF_VARIABLE2);
 				ma=(uint32_t)va_arg(ap, uint32_t);
-				mb=(char*)va_arg(ap,char*);
+				mb=(const char*)va_arg(ap,const char*);
 			}
 			else
 			{
-				mb=(char*)va_arg(ap,char*);
+				mb=(const char*)va_arg(ap,const char*);
 				size_t len = strlen(mb) + 1;
 				if( len >= 0x80000000U )
 				{
diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h
index d209484a..ce087c60 100644
--- a/libtiff/tiffiop.h
+++ b/libtiff/tiffiop.h
@@ -344,12 +344,11 @@ extern int _TIFFDataSize(TIFFDataType type);
 /*--: Rational2Double: Return size of TIFFSetGetFieldType in bytes. */
 extern int _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype);
 
-extern void _TIFFsetByteArray(void**, void*, uint32_t);
-extern void _TIFFsetString(char**, char*);
-extern void _TIFFsetShortArray(uint16_t**, uint16_t*, uint32_t);
-extern void _TIFFsetLongArray(uint32_t**, uint32_t*, uint32_t);
-extern void _TIFFsetFloatArray(float**, float*, uint32_t);
-extern void _TIFFsetDoubleArray(double**, double*, uint32_t);
+extern void _TIFFsetByteArray(void**, const void*, uint32_t);
+extern void _TIFFsetShortArray(uint16_t**, const uint16_t*, uint32_t);
+extern void _TIFFsetLongArray(uint32_t**, const uint32_t*, uint32_t);
+extern void _TIFFsetFloatArray(float**, const float*, uint32_t);
+extern void _TIFFsetDoubleArray(double**, const double*, uint32_t);
 
 extern void _TIFFprintAscii(FILE*, const char*);
 extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);