Menu

#114 fix compile with clang-20, incompatible-pointer-types-discards-qualifiers

2.2.18
closed
nobody
None
2025-08-24
2025-08-21
Nico P
No
xml_entity.c:238:11: error: initializing 'gchar *' (aka 'char *') with an expression of type 'const gchar *' (aka 'const char *') discar
ds qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  238 |                         gchar *nxt = g_utf8_next_char(srcp);
      |                                ^     ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [Makefile:773: xml_entity.o] Error 1
diff --git a/src/xml_entity.c b/src/xml_entity.c
index 76440c6..013e612 100644
--- a/src/xml_entity.c
+++ b/src/xml_entity.c
@@ -235,7 +235,7 @@ gchar *utf82xmlentities(const gchar *inbuf, gboolean iso8859_1, gboolean symbols
                        g_free(entity);
                        srcp = g_utf8_next_char(srcp);
                } else {
-                       gchar *nxt = g_utf8_next_char(srcp);
+                       const gchar *nxt = g_utf8_next_char(srcp);
                        outbuf = strncat(outbuf, srcp, (nxt-srcp));
                        srcp = nxt;
                }

Discussion

  • Olivier Sessink

    Olivier Sessink - 2025-08-24
    • status: open --> closed
     
  • Olivier Sessink

    Olivier Sessink - 2025-08-24

    thanks again, fixed in revision 9141!

     

Log in to post a comment.

MongoDB Logo MongoDB