bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add explicit casts from unsigned char * to char *


From: Miloslav Trmac
Subject: [PATCH] Add explicit casts from unsigned char * to char *
Date: Sun, 12 Mar 2006 00:52:01 +0100
User-agent: Thunderbird 1.5 (X11/20060210)

Hello,
the attached patch adds explicit casts in calls to substring().  The
implicit conversion is not actually defined by ISO C, and is thus
unportable.  gcc currently accepts the implicit casts, but warns about them.

Thanks,
        Mirek
diff -ur --exclude '*.o' --exclude '*~' texinfo-4.8/makeinfo/sectioning.c 
texinfo/makeinfo/sectioning.c
--- texinfo-4.8/makeinfo/sectioning.c   2004-07-06 00:23:23.000000000 +0200
+++ texinfo/makeinfo/sectioning.c       2006-03-11 16:53:19.000000000 +0100
@@ -491,7 +491,7 @@
      insert it into the TOC.  */
   ending_pos = output_paragraph + output_paragraph_offset;
   if (section_alist[index].toc == TOC_YES)
-    toc_add_entry (substring (starting_pos, ending_pos - 1),
+    toc_add_entry (substring ((char *)starting_pos, (char *)ending_pos - 1),
                    level, current_node, NULL);
 
   free (temp);
@@ -534,8 +534,9 @@
 
       starting_pos = output_paragraph + output_paragraph_offset;
       add_word_args ("%sTOC%d\">", a_name, toc_ref_count++);
-      toc_anchor = substring (starting_pos + sizeof (a_name) - 1,
-                              output_paragraph + output_paragraph_offset);
+      toc_anchor = substring ((char *)starting_pos + sizeof (a_name) - 1,
+                              (char *)output_paragraph
+                             + output_paragraph_offset);
       /* This must be added after toc_anchor is extracted, since
          toc_anchor cannot include the closing </a>.  For details,
          see toc.c:toc_add_entry and toc.c:contents_update_html.
@@ -585,7 +586,7 @@
   /* Pluck ``X.Y SECTION-NAME'' from the output buffer and insert it
      into the TOC.  */
   if (section_alist[index].toc == TOC_YES)
-    toc_add_entry (substring (starting_pos, ending_pos),
+    toc_add_entry (substring ((char *)starting_pos, (char *)ending_pos),
                    level, current_node, toc_anchor);
 
   free (temp);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]