Fix some -Wcast-qual warning, reported by clang.
diff --git a/ChangeLog b/ChangeLog
index 2dbd9cc..f6b4274 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-08-31 Bruno Haible <bruno@clisp.org>
+
+ Fix some -Wcast-qual warning, reported by clang.
+ * lib/iconv.c (compare_by_name): Add more 'const'.
+ (iconv_canonicalize): Cast value to 'unsigned char', not pointer to 'unsigned char *'.
+ * lib/iconv_open1.h: Likewise.
+
2020-08-30 Bruno Haible <bruno@clisp.org>
Make sure that build-aux/compile is in the tarball.
diff --git a/lib/iconv.c b/lib/iconv.c
index 1201f12..3fc3f36 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2008, 2011, 2016, 2018 Free Software Foundation, Inc.
+ * Copyright (C) 1999-2008, 2011, 2016, 2018, 2020 Free Software Foundation, Inc.
* This file is part of the GNU LIBICONV Library.
*
* The GNU LIBICONV Library is free software; you can redistribute it
@@ -364,8 +364,8 @@
static int compare_by_name (const void * arg1, const void * arg2)
{
- const char * name1 = *(const char **)arg1;
- const char * name2 = *(const char **)arg2;
+ const char * name1 = *(const char * const *)arg1;
+ const char * name2 = *(const char * const *)arg2;
/* Compare alphabetically, but put "CS" names at the end. */
int sign = strcmp(name1,name2);
if (sign != 0) {
@@ -507,7 +507,7 @@
for (code = name;;) {
/* Search code in the table. */
for (cp = code, bp = buf, count = MAX_WORD_LENGTH+10+1; ; cp++, bp++) {
- unsigned char c = * (unsigned char *) cp;
+ unsigned char c = (unsigned char) *cp;
if (c >= 0x80)
goto invalid;
if (c >= 'a' && c <= 'z')
diff --git a/lib/iconv_open1.h b/lib/iconv_open1.h
index 0feb509..90cf869 100644
--- a/lib/iconv_open1.h
+++ b/lib/iconv_open1.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2008, 2011, 2018 Free Software Foundation, Inc.
+ * Copyright (C) 1999-2008, 2011, 2018, 2020 Free Software Foundation, Inc.
* This file is part of the GNU LIBICONV Library.
*
* The GNU LIBICONV Library is free software; you can redistribute it
@@ -46,7 +46,7 @@
for (to_wchar = 0;;) {
/* Search tocode in the table. */
for (cp = tocode, bp = buf, count = MAX_WORD_LENGTH+10+1; ; cp++, bp++) {
- unsigned char c = * (unsigned char *) cp;
+ unsigned char c = (unsigned char) *cp;
if (c >= 0x80)
goto invalid;
if (c >= 'a' && c <= 'z')
@@ -138,7 +138,7 @@
for (from_wchar = 0;;) {
/* Search fromcode in the table. */
for (cp = fromcode, bp = buf, count = MAX_WORD_LENGTH+10+1; ; cp++, bp++) {
- unsigned char c = * (unsigned char *) cp;
+ unsigned char c = (unsigned char) *cp;
if (c >= 0x80)
goto invalid;
if (c >= 'a' && c <= 'z')