From: Bruno Haible Date: Fri, 2 Jun 2023 23:31:33 +0000 (+0200) Subject: Silence "initialization discards ‘const’ qualifier from pointer target type" warnings. X-Git-Tag: v0.22~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f02f5daf419d8b39e5a8625f198e0dd8b86df933;p=thirdparty%2Fgettext.git Silence "initialization discards ‘const’ qualifier from pointer target type" warnings. * gettext-tools/src/pos.h (struct lex_pos_ty): Change type of file_name field to 'const char *'. * gettext-tools/src/read-catalog.c (default_destructor, default_reset_comment_state): Cast file_name to 'char *' before free()ing it. * gettext-tools/src/xg-arglist-parser.h (arglist_parser_remember, arglist_parser_remember_msgctxt): Change type of file_name parameter. * gettext-tools/src/xg-arglist-parser.c (arglist_parser_remember, arglist_parser_remember_msgctxt): Likewise. --- diff --git a/gettext-tools/src/pos.h b/gettext-tools/src/pos.h index ce2b002b3..8167c7f60 100644 --- a/gettext-tools/src/pos.h +++ b/gettext-tools/src/pos.h @@ -1,5 +1,5 @@ /* Source file positions. - Copyright (C) 1995-1998, 2000-2001, 2021 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2001, 2021, 2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ typedef struct lex_pos_ty lex_pos_ty; struct lex_pos_ty { - char *file_name; + const char *file_name; size_t line_number; }; diff --git a/gettext-tools/src/read-catalog.c b/gettext-tools/src/read-catalog.c index 08fabb87b..c593ca98e 100644 --- a/gettext-tools/src/read-catalog.c +++ b/gettext-tools/src/read-catalog.c @@ -1,6 +1,5 @@ /* Reading PO files. - Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2016 Free - Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2016, 2023 Free Software Foundation, Inc. This file was written by Peter Miller This program is free software: you can redistribute it and/or modify @@ -127,7 +126,7 @@ default_destructor (abstract_catalog_reader_ty *that) } for (j = 0; j < this->filepos_count; ++j) - free (this->filepos[j].file_name); + free ((char *) this->filepos[j].file_name); if (this->filepos != NULL) free (this->filepos); } @@ -199,7 +198,7 @@ default_reset_comment_state (default_catalog_reader_ty *this) } } for (j = 0; j < this->filepos_count; ++j) - free (this->filepos[j].file_name); + free ((char *) this->filepos[j].file_name); if (this->filepos != NULL) free (this->filepos); this->filepos_count = 0; diff --git a/gettext-tools/src/xg-arglist-parser.c b/gettext-tools/src/xg-arglist-parser.c index cc30bfc94..cadcb18c3 100644 --- a/gettext-tools/src/xg-arglist-parser.c +++ b/gettext-tools/src/xg-arglist-parser.c @@ -147,7 +147,7 @@ void arglist_parser_remember (struct arglist_parser *ap, int argnum, mixed_string_ty *string, flag_context_ty context, - char *file_name, size_t line_number, + const char *file_name, size_t line_number, refcounted_string_list_ty *comment, bool comment_is_utf8) { @@ -207,7 +207,7 @@ void arglist_parser_remember_msgctxt (struct arglist_parser *ap, mixed_string_ty *string, flag_context_ty context, - char *file_name, size_t line_number) + const char *file_name, size_t line_number) { bool stored_string = false; size_t nalternatives = ap->nalternatives; diff --git a/gettext-tools/src/xg-arglist-parser.h b/gettext-tools/src/xg-arglist-parser.h index 9f2dedca0..4c813e983 100644 --- a/gettext-tools/src/xg-arglist-parser.h +++ b/gettext-tools/src/xg-arglist-parser.h @@ -86,7 +86,7 @@ extern struct arglist_parser * arglist_parser_clone (struct arglist_parser *ap); extern void arglist_parser_remember (struct arglist_parser *ap, int argnum, mixed_string_ty *string, flag_context_ty context, - char *file_name, size_t line_number, + const char *file_name, size_t line_number, refcounted_string_list_ty *comment, bool comment_is_utf8); /* Adds a string argument as msgctxt to an arglist_parser, without incrementing @@ -96,7 +96,7 @@ extern void arglist_parser_remember (struct arglist_parser *ap, extern void arglist_parser_remember_msgctxt (struct arglist_parser *ap, mixed_string_ty *string, flag_context_ty context, - char *file_name, size_t line_number); + const char *file_name, size_t line_number); /* Tests whether an arglist_parser has is not waiting for more arguments after argument ARGNUM. */ extern bool arglist_parser_decidedp (struct arglist_parser *ap, int argnum);