texinfo-commits
[Top][All Lists]
Advanced

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

[6742] info fix compiler warnings


From: Gavin D. Smith
Subject: [6742] info fix compiler warnings
Date: Sat, 31 Oct 2015 22:17:35 +0000

Revision: 6742
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6742
Author:   gavin
Date:     2015-10-31 22:17:34 +0000 (Sat, 31 Oct 2015)
Log Message:
-----------
info fix compiler warnings

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/display.c
    trunk/info/variables.c
    trunk/info/variables.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-10-31 21:10:02 UTC (rev 6741)
+++ trunk/ChangeLog     2015-10-31 22:17:34 UTC (rev 6742)
@@ -1,5 +1,15 @@
 2015-10-31  Gavin Smith  <address@hidden>
 
+       Fix compiler warnings.
+       * info/variables.h (VARIABLE_ALIST): Change type of 'value' 
+       field from int * to void *.  All uses updated to cast as 
+       appropriate.
+       * info/variables.c (highlight_searches): Type changed to int *.
+       * info/display.c (wrap_terminal_switch_rendition): Cast from 
+       long * to char *.
+
+2015-10-31  Gavin Smith  <address@hidden>
+
        * info/README: Remove.
 
 2015-10-31  Gavin Smith  <address@hidden>

Modified: trunk/info/display.c
===================================================================
--- trunk/info/display.c        2015-10-31 21:10:02 UTC (rev 6741)
+++ trunk/info/display.c        2015-10-31 22:17:34 UTC (rev 6742)
@@ -317,7 +317,7 @@
       /* The text added here is only used internally to see when the
          display has changed, and is not output to the terminal. */
       text_buffer_add_string (printed_line, "\033", 1);
-      text_buffer_add_string (printed_line, &desired_rendition,
+      text_buffer_add_string (printed_line, (char *) &desired_rendition,
                               sizeof (long));
     }
 }

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2015-10-31 21:10:02 UTC (rev 6741)
+++ trunk/info/variables.c      2015-10-31 22:17:34 UTC (rev 6742)
@@ -55,9 +55,9 @@
    this variable. */
 char *rendition_variable = 0;
 
-static char *highlight_searches;
+/* Address of this indicates the 'highlight-searches' variable. */
+static int *highlight_searches;
 
-
 /* Note that the 'where_set' field of each element in the array is
    not given and defaults to 0. */
 VARIABLE_ALIST info_variables[] = {
@@ -174,10 +174,10 @@
 
   if (var->choices)
     asprintf (&description, "%s (%s): %s.",
-             var->name, var->choices[*var->value], _(var->doc));
+             var->name, var->choices[*(int *)var->value], _(var->doc));
   else
     asprintf (&description, "%s (%d): %s.",
-            var->name, *var->value, _(var->doc));
+             var->name, *(int *)var->value, _(var->doc));
 
   window_message_in_echo_area ("%s", description);
   free (description);
@@ -204,7 +204,7 @@
       if (info_explicit_arg || count != 1)
         potential_value = count;
       else
-        potential_value = *(var->value);
+        potential_value = *(int *)(var->value);
 
       sprintf (prompt, _("Set %s to value (%d): "),
                var->name, potential_value);
@@ -241,7 +241,7 @@
         }
 
       sprintf (prompt, _("Set %s to value (%s): "),
-               var->name, var->choices[*(var->value)]);
+               var->name, var->choices[*(int *)(var->value)]);
 
       /* Ask the completer to read a variable value for us. */
       line = info_read_completing_in_echo_area (prompt, array);
@@ -360,20 +360,16 @@
          "match-rendition=standout". */
       if (var->value == &highlight_searches)
         {
-          our_var.choices = &rendition_variable;
-          our_var.value = &match_rendition;
-          var = &our_var;
-          value = highlight_searches = xstrdup ("standout");
-          /* Save new string to prevent a memory leak being apparent. */
+          match_rendition.mask = STANDOUT_MASK;
+          match_rendition.value = STANDOUT_MASK;
         }
-
-      if (var->choices != &rendition_variable)
+      else if (var->choices != (char **) &rendition_variable)
         {
           /* Find the choice in our list of choices. */
           for (j = 0; var->choices[j]; j++)
             if (strcmp (var->choices[j], value) == 0)
               {
-                *var->value = j;
+                *(int *)var->value = j;
                 var->where_set = where;
                 return 1;
               }
@@ -442,7 +438,7 @@
       long n = strtol (value, &p, 10);
       if (*p == 0 && INT_MIN <= n && n <= INT_MAX)
        {
-         *var->value = n;
+          *(int *)var->value = n;
          return 1;
        }
     }

Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h      2015-10-31 21:10:02 UTC (rev 6741)
+++ trunk/info/variables.h      2015-10-31 22:17:34 UTC (rev 6742)
@@ -35,7 +35,7 @@
 typedef struct {
   char *name;                   /* Polite name. */
   char *doc;                    /* Documentation string. */
-  int *value;                   /* Address of value. */
+  void *value;                  /* Address of value. */
   char **choices;               /* Array of strings or NULL if numeric only. */
   int where_set;                /* Where this variable was set. */
 } VARIABLE_ALIST;




reply via email to

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