Blame SOURCES/0034-Try-to-deal-with-some-signof-char-signof-uint8_t-mad.patch

b15ea1
From ba165d1482558005a16f4b44abaa1df5169727d1 Mon Sep 17 00:00:00 2001
b15ea1
From: Peter Jones <pjones@redhat.com>
b15ea1
Date: Mon, 17 Jun 2019 14:47:24 -0400
b15ea1
Subject: [PATCH 34/86] Try to deal with some signof(char) != signof(uint8_t)
b15ea1
 madness.
b15ea1
b15ea1
The 3-sign "char" type in C is so so painful sometimes.  This attempts
b15ea1
to use -funsigned-char to avoid type-casting between (uint8_t *) and
b15ea1
(char *) quite so much.  I'm not sure it'll pay off.  The fact that
b15ea1
"char" is something that's not ever actually the same type as "unsigned
b15ea1
char" or "signed char" is still the absolute worst thing.
b15ea1
b15ea1
Why do we need signed char at all again?
b15ea1
b15ea1
Signed-off-by: Peter Jones <pjones@redhat.com>
b15ea1
---
b15ea1
 Make.defaults                  |  4 +++-
b15ea1
 gcc.specs                      |  4 ++--
b15ea1
 src/dp-acpi.c                  | 11 ++++++-----
b15ea1
 src/dp-hw.c                    |  5 +++--
b15ea1
 src/dp-media.c                 |  2 +-
b15ea1
 src/dp-message.c               | 22 +++++++++++-----------
b15ea1
 src/dp.c                       |  8 +++++---
b15ea1
 src/dp.h                       | 18 ++++++++++--------
b15ea1
 src/export.c                   | 12 ++++++------
b15ea1
 src/include/efivar/efivar-dp.h | 10 ++++++----
b15ea1
 src/include/efivar/efivar.h    |  4 ++--
b15ea1
 src/ucs2.h                     |  6 +++---
b15ea1
 12 files changed, 58 insertions(+), 48 deletions(-)
b15ea1
b15ea1
diff --git a/Make.defaults b/Make.defaults
b15ea1
index 80fd99eba71..36e922f5ba7 100644
b15ea1
--- a/Make.defaults
b15ea1
+++ b/Make.defaults
b15ea1
@@ -31,7 +31,9 @@ PKGS	=
b15ea1
 
b15ea1
 CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION)
b15ea1
 
b15ea1
-clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member
b15ea1
+clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member \
b15ea1
+	       -funsigned-char -Wall -Wno-nonnull-compare \
b15ea1
+	       -Werror -Wno-error=cpp
b15ea1
 gcc_cflags = -specs=$(TOPDIR)/gcc.specs
b15ea1
 cflags	= $(CFLAGS) -I${TOPDIR}/src/include/ \
b15ea1
 	$(if $(findstring clang,$(CC)),$(clang_cflags),) \
b15ea1
diff --git a/gcc.specs b/gcc.specs
b15ea1
index d06a8e096fc..9d2b145ee6e 100644
b15ea1
--- a/gcc.specs
b15ea1
+++ b/gcc.specs
b15ea1
@@ -2,13 +2,13 @@
b15ea1
 + -D_GNU_SOURCE
b15ea1
 
b15ea1
 *efivar_cpp_options:
b15ea1
- -Werror -Wall -std=gnu11 -Wextra
b15ea1
+ -Wall -Wno-nonnull-compare -Werror -Wno-error=cpp -std=gnu11 -Wextra -funsigned-char
b15ea1
 
b15ea1
 *cpp_options:
b15ea1
 + %(efivar_cpp_options)
b15ea1
 
b15ea1
 *cc1_options:
b15ea1
-+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
b15ea1
++ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -funsigned-char -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
b15ea1
 
b15ea1
 *self_spec:
b15ea1
 + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
b15ea1
diff --git a/src/dp-acpi.c b/src/dp-acpi.c
b15ea1
index 2525fdfd073..02ec70eec7a 100644
b15ea1
--- a/src/dp-acpi.c
b15ea1
+++ b/src/dp-acpi.c
b15ea1
@@ -28,7 +28,7 @@
b15ea1
 #include "efivar.h"
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-_format_acpi_adr(char *buf, size_t size,
b15ea1
+_format_acpi_adr(unsigned char *buf, size_t size,
b15ea1
 		 const char *dp_type UNUSED,
b15ea1
 		 const_efidp dp)
b15ea1
 {
b15ea1
@@ -45,9 +45,10 @@ _format_acpi_adr(char *buf, size_t size,
b15ea1
 	format_helper(_format_acpi_adr, buf, size, off, "AcpiAdr", dp)
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-_format_acpi_hid_ex(char *buf, size_t size, const char *dp_type UNUSED,
b15ea1
-		    const_efidp dp,
b15ea1
-		    const char *hidstr, const char *cidstr, const char *uidstr)
b15ea1
+_format_acpi_hid_ex(unsigned char *buf, size_t size,
b15ea1
+		    const char *dp_type UNUSED, const_efidp dp,
b15ea1
+		    const char *hidstr, const char *cidstr,
b15ea1
+		    const char *uidstr)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 
b15ea1
@@ -98,7 +99,7 @@ _format_acpi_hid_ex(char *buf, size_t size, const char *dp_type UNUSED,
b15ea1
 		      hidstr, cidstr, uidstr)
b15ea1
 
b15ea1
 ssize_t
b15ea1
-_format_acpi_dn(char *buf, size_t size, const_efidp dp)
b15ea1
+_format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	const char *hidstr = NULL;
b15ea1
diff --git a/src/dp-hw.c b/src/dp-hw.c
b15ea1
index 1fe0f66e871..28998316d9d 100644
b15ea1
--- a/src/dp-hw.c
b15ea1
+++ b/src/dp-hw.c
b15ea1
@@ -26,7 +26,8 @@
b15ea1
 #include "efivar.h"
b15ea1
 
b15ea1
 ssize_t
b15ea1
-format_edd10_guid(char *buf, size_t size, const char *dp_type, const_efidp dp)
b15ea1
+format_edd10_guid(unsigned char *buf, size_t size,
b15ea1
+		  const char *dp_type, const_efidp dp)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	efidp_edd10 const *edd_dp = (efidp_edd10 *)dp;
b15ea1
@@ -36,7 +37,7 @@ format_edd10_guid(char *buf, size_t size, const char *dp_type, const_efidp dp)
b15ea1
 }
b15ea1
 
b15ea1
 ssize_t
b15ea1
-_format_hw_dn(char *buf, size_t size, const_efidp dp)
b15ea1
+_format_hw_dn(unsigned char *buf, size_t size, const_efidp dp)
b15ea1
 {
b15ea1
 	efi_guid_t edd10_guid = EDD10_HARDWARE_VENDOR_PATH_GUID;
b15ea1
 	ssize_t off = 0;
b15ea1
diff --git a/src/dp-media.c b/src/dp-media.c
b15ea1
index 4728c326100..7f5d1c678ce 100644
b15ea1
--- a/src/dp-media.c
b15ea1
+++ b/src/dp-media.c
b15ea1
@@ -28,7 +28,7 @@
b15ea1
 #include "efivar.h"
b15ea1
 
b15ea1
 ssize_t
b15ea1
-_format_media_dn(char *buf, size_t size, const_efidp dp)
b15ea1
+_format_media_dn(unsigned char *buf, size_t size, const_efidp dp)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	switch (dp->subtype) {
b15ea1
diff --git a/src/dp-message.c b/src/dp-message.c
b15ea1
index b88f17fb712..d00b2ad5d67 100644
b15ea1
--- a/src/dp-message.c
b15ea1
+++ b/src/dp-message.c
b15ea1
@@ -28,7 +28,7 @@
b15ea1
 #include "efivar.h"
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
b15ea1
+format_ipv4_addr_helper(unsigned char *buf, size_t size, const char *dp_type,
b15ea1
 			const uint8_t *ipaddr, int32_t port)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
@@ -40,7 +40,7 @@ format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
b15ea1
 }
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_ipv6_addr_helper(char *buf, size_t size, const char *dp_type,
b15ea1
+format_ipv6_addr_helper(unsigned char *buf, size_t size, const char *dp_type,
b15ea1
 			const uint8_t *ipaddr, int32_t port)
b15ea1
 {
b15ea1
 	uint16_t *ip = (uint16_t *)ipaddr;
b15ea1
@@ -123,7 +123,7 @@ format_ipv6_addr_helper(char *buf, size_t size, const char *dp_type,
b15ea1
 		      "IPv6", addr, port)
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_ip_addr_helper(char *buf, size_t size,
b15ea1
+format_ip_addr_helper(unsigned char *buf, size_t size,
b15ea1
 		      const char *dp_type UNUSED,
b15ea1
 		      int is_ipv6, const efi_ip_addr_t *addr)
b15ea1
 {
b15ea1
@@ -142,7 +142,7 @@ format_ip_addr_helper(char *buf, size_t size,
b15ea1
 		      dp_type, is_ipv6, addr)
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_uart(char *buf, size_t size,
b15ea1
+format_uart(unsigned char *buf, size_t size,
b15ea1
 	    const char *dp_type UNUSED,
b15ea1
 	    const_efidp dp)
b15ea1
 {
b15ea1
@@ -162,7 +162,7 @@ format_uart(char *buf, size_t size,
b15ea1
 }
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_sas(char *buf, size_t size,
b15ea1
+format_sas(unsigned char *buf, size_t size,
b15ea1
 	   const char *dp_type UNUSED,
b15ea1
 	   const_efidp dp)
b15ea1
 {
b15ea1
@@ -232,7 +232,7 @@ format_sas(char *buf, size_t size,
b15ea1
 	       dp->usb_class.device_protocol)
b15ea1
 
b15ea1
 static ssize_t
b15ea1
-format_usb_class(char *buf, size_t size,
b15ea1
+format_usb_class(unsigned char *buf, size_t size,
b15ea1
 		 const char *dp_type UNUSED,
b15ea1
 		 const_efidp dp)
b15ea1
 {
b15ea1
@@ -312,7 +312,7 @@ format_usb_class(char *buf, size_t size,
b15ea1
 }
b15ea1
 
b15ea1
 ssize_t
b15ea1
-_format_message_dn(char *buf, size_t size, const_efidp dp)
b15ea1
+_format_message_dn(unsigned char *buf, size_t size, const_efidp dp)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	switch (dp->subtype) {
b15ea1
@@ -393,7 +393,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
b15ea1
 		struct {
b15ea1
 			efi_guid_t guid;
b15ea1
 			char label[40];
b15ea1
-			ssize_t (*formatter)(char *buf, size_t size,
b15ea1
+			ssize_t (*formatter)(unsigned char *buf, size_t size,
b15ea1
 				const char *dp_type UNUSED,
b15ea1
 				const_efidp dp);
b15ea1
 		} subtypes[] = {
b15ea1
@@ -417,7 +417,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
b15ea1
 			  .label = "" }
b15ea1
 		};
b15ea1
 		char *label = NULL;
b15ea1
-		ssize_t (*formatter)(char *buf, size_t size,
b15ea1
+		ssize_t (*formatter)(unsigned char *buf, size_t size,
b15ea1
 			const char *dp_type UNUSED,
b15ea1
 			const_efidp dp) = NULL;
b15ea1
 
b15ea1
@@ -455,8 +455,8 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
b15ea1
 			       }
b15ea1
 	case EFIDP_MSG_IPv6: {
b15ea1
 		efidp_ipv6_addr const *a = &dp->ipv6_addr;
b15ea1
-		char *addr0 = NULL;
b15ea1
-		char *addr1 = NULL;
b15ea1
+		unsigned char *addr0 = NULL;
b15ea1
+		unsigned char *addr1 = NULL;
b15ea1
 		ssize_t tmpoff = 0;
b15ea1
 		ssize_t sz;
b15ea1
 
b15ea1
diff --git a/src/dp.c b/src/dp.c
b15ea1
index b6eea74878c..f6a4b2ddafa 100644
b15ea1
--- a/src/dp.c
b15ea1
+++ b/src/dp.c
b15ea1
@@ -298,7 +298,8 @@ efidp_append_instance(const_efidp dp, const_efidp dpi, efidp *out)
b15ea1
 }
b15ea1
 
b15ea1
 ssize_t PUBLIC
b15ea1
-efidp_format_device_path(char *buf, size_t size, const_efidp dp, ssize_t limit)
b15ea1
+efidp_format_device_path(unsigned char *buf, size_t size, const_efidp dp,
b15ea1
+			 ssize_t limit)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	int first = 1;
b15ea1
@@ -402,7 +403,8 @@ efidp_format_device_path(char *buf, size_t size, const_efidp dp, ssize_t limit)
b15ea1
 }
b15ea1
 
b15ea1
 ssize_t PUBLIC
b15ea1
-efidp_parse_device_node(char *path UNUSED, efidp out UNUSED, size_t size UNUSED)
b15ea1
+efidp_parse_device_node(unsigned char *path UNUSED,
b15ea1
+			efidp out UNUSED, size_t size UNUSED)
b15ea1
 {
b15ea1
 	efi_error("not implented");
b15ea1
 	errno = -ENOSYS;
b15ea1
@@ -410,7 +412,7 @@ efidp_parse_device_node(char *path UNUSED, efidp out UNUSED, size_t size UNUSED)
b15ea1
 }
b15ea1
 
b15ea1
 ssize_t PUBLIC
b15ea1
-efidp_parse_device_path(char *path UNUSED, efidp out UNUSED,
b15ea1
+efidp_parse_device_path(unsigned char *path UNUSED, efidp out UNUSED,
b15ea1
 			size_t size UNUSED)
b15ea1
 {
b15ea1
 	efi_error("not implented");
b15ea1
diff --git a/src/dp.h b/src/dp.h
b15ea1
index 33a29db0d5d..6609b0d827e 100644
b15ea1
--- a/src/dp.h
b15ea1
+++ b/src/dp.h
b15ea1
@@ -88,8 +88,9 @@
b15ea1
 	})
b15ea1
 
b15ea1
 static inline ssize_t UNUSED
b15ea1
-format_hex_helper(char *buf, size_t size, const char *dp_type, char *separator,
b15ea1
-		  int stride, const void * const addr, const size_t len)
b15ea1
+format_hex_helper(unsigned char *buf, size_t size, const char *dp_type,
b15ea1
+		  char *separator, int stride, const void * const addr,
b15ea1
+		  const size_t len)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	for (size_t i = 0; i < len; i++) {
b15ea1
@@ -110,7 +111,8 @@ format_hex_helper(char *buf, size_t size, const char *dp_type, char *separator,
b15ea1
 		      addr, len)
b15ea1
 
b15ea1
 static inline ssize_t UNUSED
b15ea1
-format_vendor_helper(char *buf, size_t size, char *label, const_efidp dp)
b15ea1
+format_vendor_helper(unsigned char *buf, size_t size, char *label,
b15ea1
+		     const_efidp dp)
b15ea1
 {
b15ea1
 	ssize_t off = 0;
b15ea1
 	ssize_t bytes = efidp_node_size(dp)
b15ea1
@@ -157,11 +159,11 @@ format_vendor_helper(char *buf, size_t size, char *label, const_efidp dp)
b15ea1
 		off;							\
b15ea1
 	})
b15ea1
 
b15ea1
-extern ssize_t _format_hw_dn(char *buf, size_t size, const_efidp dp);
b15ea1
-extern ssize_t _format_acpi_dn(char *buf, size_t size, const_efidp dp);
b15ea1
-extern ssize_t _format_message_dn(char *buf, size_t size, const_efidp dp);
b15ea1
-extern ssize_t _format_media_dn(char *buf, size_t size, const_efidp dp);
b15ea1
-extern ssize_t _format_bios_boot_dn(char *buf, size_t size, const_efidp dp);
b15ea1
+extern ssize_t _format_hw_dn(unsigned char *buf, size_t size, const_efidp dp);
b15ea1
+extern ssize_t _format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp);
b15ea1
+extern ssize_t _format_message_dn(unsigned char *buf, size_t size, const_efidp dp);
b15ea1
+extern ssize_t _format_media_dn(unsigned char *buf, size_t size, const_efidp dp);
b15ea1
+extern ssize_t _format_bios_boot_dn(unsigned char *buf, size_t size, const_efidp dp);
b15ea1
 
b15ea1
 #define format_helper_2(name, buf, size, off, dp) ({			\
b15ea1
 		ssize_t _sz;						\
b15ea1
diff --git a/src/export.c b/src/export.c
b15ea1
index 5b11ae883cf..6b78412cce1 100644
b15ea1
--- a/src/export.c
b15ea1
+++ b/src/export.c
b15ea1
@@ -35,7 +35,7 @@
b15ea1
 struct efi_variable {
b15ea1
 	uint64_t attrs;
b15ea1
 	efi_guid_t *guid;
b15ea1
-	char *name;
b15ea1
+	unsigned char *name;
b15ea1
 	uint8_t *data;
b15ea1
 	size_t data_size;
b15ea1
 };
b15ea1
@@ -149,7 +149,7 @@ efi_variable_import(uint8_t *data, size_t size, efi_variable_t **var_out)
b15ea1
 ssize_t NONNULL(1) PUBLIC
b15ea1
 efi_variable_export(efi_variable_t *var, uint8_t *data, size_t size)
b15ea1
 {
b15ea1
-	size_t name_len = strlen(var->name);
b15ea1
+	size_t name_len = strlen((char *)var->name);
b15ea1
 
b15ea1
 	size_t needed = sizeof (uint32_t)		/* magic */
b15ea1
 		      + sizeof (uint32_t)		/* version */
b15ea1
@@ -233,13 +233,13 @@ efi_variable_free(efi_variable_t *var, int free_data)
b15ea1
 }
b15ea1
 
b15ea1
 int NONNULL(1, 2) PUBLIC
b15ea1
-efi_variable_set_name(efi_variable_t *var, char *name)
b15ea1
+efi_variable_set_name(efi_variable_t *var, unsigned char *name)
b15ea1
 {
b15ea1
 	var->name = name;
b15ea1
 	return 0;
b15ea1
 }
b15ea1
 
b15ea1
-char PUBLIC NONNULL(1) *
b15ea1
+unsigned char PUBLIC NONNULL(1) *
b15ea1
 efi_variable_get_name(efi_variable_t *var)
b15ea1
 {
b15ea1
 	if (!var->name) {
b15ea1
@@ -329,10 +329,10 @@ efi_variable_realize(efi_variable_t *var)
b15ea1
 	}
b15ea1
 	uint32_t attrs = var->attrs & ATTRS_MASK;
b15ea1
 	if (attrs & EFI_VARIABLE_APPEND_WRITE) {
b15ea1
-		return efi_append_variable(*var->guid, var->name,
b15ea1
+		return efi_append_variable(*var->guid, (char *)var->name,
b15ea1
 					var->data, var->data_size, attrs);
b15ea1
 	}
b15ea1
-	return efi_set_variable(*var->guid, var->name, var->data,
b15ea1
+	return efi_set_variable(*var->guid, (char *)var->name, var->data,
b15ea1
 				var->data_size, attrs, 0600);
b15ea1
 }
b15ea1
 
b15ea1
diff --git a/src/include/efivar/efivar-dp.h b/src/include/efivar/efivar-dp.h
b15ea1
index 57453548701..706d25bdebd 100644
b15ea1
--- a/src/include/efivar/efivar-dp.h
b15ea1
+++ b/src/include/efivar/efivar-dp.h
b15ea1
@@ -1240,10 +1240,12 @@ efidp_is_valid(const_efidp dp, ssize_t limit)
b15ea1
 #endif
b15ea1
 
b15ea1
 /* and now, printing and parsing */
b15ea1
-extern ssize_t efidp_parse_device_node(char *path, efidp out, size_t size);
b15ea1
-extern ssize_t efidp_parse_device_path(char *path, efidp out, size_t size);
b15ea1
-extern ssize_t efidp_format_device_path(char *buf, size_t size, const_efidp dp,
b15ea1
-				       ssize_t limit);
b15ea1
+extern ssize_t efidp_parse_device_node(unsigned char *path,
b15ea1
+				       efidp out, size_t size);
b15ea1
+extern ssize_t efidp_parse_device_path(unsigned char *path,
b15ea1
+				       efidp out, size_t size);
b15ea1
+extern ssize_t efidp_format_device_path(unsigned char *buf, size_t size,
b15ea1
+					const_efidp dp, ssize_t limit);
b15ea1
 extern ssize_t efidp_make_vendor(uint8_t *buf, ssize_t size, uint8_t type,
b15ea1
 				 uint8_t subtype,  efi_guid_t vendor_guid,
b15ea1
 				 void *data, size_t data_size);
b15ea1
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
b15ea1
index caa4adf056c..729b6fe80f7 100644
b15ea1
--- a/src/include/efivar/efivar.h
b15ea1
+++ b/src/include/efivar/efivar.h
b15ea1
@@ -144,9 +144,9 @@ extern efi_variable_t *efi_variable_alloc(void)
b15ea1
 			__attribute__((__visibility__ ("default")));
b15ea1
 extern void efi_variable_free(efi_variable_t *var, int free_data);
b15ea1
 
b15ea1
-extern int efi_variable_set_name(efi_variable_t *var, char *name)
b15ea1
+extern int efi_variable_set_name(efi_variable_t *var, unsigned char *name)
b15ea1
 			__attribute__((__nonnull__ (1, 2)));
b15ea1
-extern char *efi_variable_get_name(efi_variable_t *var)
b15ea1
+extern unsigned char *efi_variable_get_name(efi_variable_t *var)
b15ea1
 			__attribute__((__visibility__ ("default")))
b15ea1
 			__attribute__((__nonnull__ (1)));
b15ea1
 
b15ea1
diff --git a/src/ucs2.h b/src/ucs2.h
b15ea1
index 176f9ccac57..478de23b23f 100644
b15ea1
--- a/src/ucs2.h
b15ea1
+++ b/src/ucs2.h
b15ea1
@@ -47,7 +47,7 @@ ucs2size(const void *s, ssize_t limit)
b15ea1
 }
b15ea1
 
b15ea1
 static inline size_t UNUSED NONNULL(1)
b15ea1
-utf8len(uint8_t *s, ssize_t limit)
b15ea1
+utf8len(const unsigned char *s, ssize_t limit)
b15ea1
 {
b15ea1
 	ssize_t i, j;
b15ea1
 	for (i = 0, j = 0; i < (limit >= 0 ? limit : i+1) && s[i] != '\0';
b15ea1
@@ -64,7 +64,7 @@ utf8len(uint8_t *s, ssize_t limit)
b15ea1
 }
b15ea1
 
b15ea1
 static inline size_t UNUSED NONNULL(1)
b15ea1
-utf8size(uint8_t *s, ssize_t limit)
b15ea1
+utf8size(const unsigned char *s, ssize_t limit)
b15ea1
 {
b15ea1
 	size_t ret = utf8len(s,limit);
b15ea1
 	if (ret < (limit >= 0 ? (size_t)limit : ret+1))
b15ea1
@@ -129,7 +129,7 @@ ucs2_to_utf8(const void * const voidchars, ssize_t limit)
b15ea1
 }
b15ea1
 
b15ea1
 static inline ssize_t UNUSED NONNULL(4)
b15ea1
-utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
b15ea1
+utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, const unsigned char *utf8)
b15ea1
 {
b15ea1
 	ssize_t req;
b15ea1
 	ssize_t i, j;
b15ea1
-- 
b15ea1
2.24.1
b15ea1