Re: Warnings issued at build time due to recent changes .



> > .../../mc/src/hotlist.c: In function `add_new_entry_input':
> > .../../mc/src/hotlist.c:873: warning: assignment discards qualifiers from
> > pointer target type
> > .../../mc/src/hotlist.c:874: warning: assignment discards qualifiers from
> > pointer target type

More complete patchset is here.
These warnings are also fixed now:

./../mc/src/filegui.c: In function `file_mask_dialog':
./../mc/src/filegui.c:887: warning: assignment discards qualifiers from
pointer target type
./../mc/src/filegui.c:888: warning: assignment discards qualifiers from
pointer target type

-- 
Regards,
Andrew V. Samoilov.
edit/ChangeLog:

	* editcmd.c (edit_replace_prompt) [HAVE_CHARSET]: Warning hack.

--- edit/editcmd.c~	Thu Sep 16 17:27:43 2004
+++ edit/editcmd.c	Thu Sep 16 17:31:42 2004
@@ -1185,10 +1185,12 @@ edit_replace_prompt (WEdit * edit, char 
 #ifdef HAVE_CHARSET
     char *msg = _(" Replace with: ");
 
-    quick_widgets[5].text = catstrs (msg, replace_text, 0);
-
-    if (*replace_text)
-	convert_to_display (quick_widgets[5].text + strlen (msg));
+    if (*replace_text) {
+	int msg_len = strlen (msg);
+	msg = catstrs (msg, replace_text, 0);
+	convert_to_display (msg + msg_len);
+    }
+    quick_widgets[5].text = msg;
 #else
     quick_widgets[5].text = catstrs (_ (" Replace with: "), replace_text, 0);
 #endif /* !HAVE_CHARSET */
src/ChangeLog:

	* wtools.h (QuickWidget): Make text const.
	* wtools.c (fg_input_dialog_help): Fix warning.

--- src/wtools.h.bak	Thu Sep  2 09:19:34 2004
+++ src/wtools.h	Thu Sep 16 16:44:40 2004
@@ -35,7 +35,7 @@ typedef struct {
     int relative_y;
     int y_divisions;
 
-    char *text;			/* Text */
+    const char *text;		/* Text */
     int  hotkey_pos;		/* the hotkey position */
     int  value;			/* Buttons only: value of button */
     int  *result;		/* Checkbutton: where to store result */
--- src/wtools.c.bak	Thu Sep 16 16:55:53 2004
+++ src/wtools.c	Thu Sep 16 16:53:56 2004
@@ -450,6 +450,7 @@ fg_input_dialog_help (const char *header
     int ret;
     char *my_str;
     char histname[64] = "inp|";
+    char *p_text;
 
     /* we need a unique name for histname because widget.c:history_tool()
        needs a unique name for each dialog - using the header is ideal */
@@ -482,11 +483,12 @@ fg_input_dialog_help (const char *header
 
     Quick_input.xlen = len;
     Quick_input.xpos = -1;
-    Quick_input.title = const_cast(char *, header);
-    Quick_input.help = const_cast(char *, help);
+    Quick_input.title = header;
+    Quick_input.help = help;
     Quick_input.i18n = 0;
-    quick_widgets[INPUT_INDEX + 1].text = g_strstrip (g_strdup (text));
-    quick_widgets[INPUT_INDEX].text = const_cast(char *, def_text);
+    p_text = g_strstrip (g_strdup (text));
+    quick_widgets[INPUT_INDEX + 1].text = p_text;
+    quick_widgets[INPUT_INDEX].text = def_text;
 
     for (i = 0; i < 4; i++)
 	quick_widgets[i].y_divisions = lines + 6;
@@ -499,10 +501,10 @@ fg_input_dialog_help (const char *header
 
     Quick_input.widgets = quick_widgets;
     ret = quick_dialog (&Quick_input);
-    g_free (quick_widgets[INPUT_INDEX + 1].text);
+    g_free (p_text);
 
     if (ret != B_CANCEL) {
-	return *(quick_widgets[INPUT_INDEX].str_result);
+	return my_str;
     } else
 	return 0;
 }


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