Fixed lot of compiler warnings

master
Yevgen Muntyan 2006-12-04 04:54:12 -06:00
parent db21c860c9
commit 0723a7e378
21 changed files with 97 additions and 134 deletions

View File

@ -26,7 +26,7 @@
</ignoreparts>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description/>
<description></description>
<secondaryLanguages>
<language>C</language>
</secondaryLanguages>
@ -35,7 +35,7 @@
<kdevautoproject>
<general>
<activetarget>moo/libmoo.la</activetarget>
<useconfiguration>gtk-cvs</useconfiguration>
<useconfiguration>intel</useconfiguration>
</general>
<run>
<mainprogram>tests/medit</mainprogram>
@ -103,6 +103,23 @@
<f77compilerbinary/>
<f77flags/>
</gtk-cvs>
<intel>
<configargs>--enable-debug --enable-all-intel-warnings</configargs>
<builddir>/home/muntyan/projects/moo/build/icc</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevg77options</f77compiler>
<cflags></cflags>
<cxxflags>-O0 -g3</cxxflags>
<envvars/>
<topsourcedir></topsourcedir>
<cppflags></cppflags>
<ldflags></ldflags>
<ccompilerbinary>icc</ccompilerbinary>
<cxxcompilerbinary></cxxcompilerbinary>
<f77compilerbinary></f77compilerbinary>
<f77flags></f77flags>
</intel>
<optimized>
<configargs> --enable-all-gcc-warnings --enable-printing</configargs>
<builddir>build/optimized</builddir>
@ -228,10 +245,10 @@
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>true</floatingtoolbar>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
</general>
<display>
<staticmembers>true</staticmembers>
@ -293,16 +310,16 @@
</kdevdoctreeview>
<kdevfilecreate>
<filetypes>
<type icon="source" ext="g" create="template" name="GAP source" >
<type icon="source" ext="g" name="GAP source" create="template" >
<descr>A new empty GAP source file</descr>
</type>
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
<descr>A new empty C++ file.</descr>
</type>
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
<descr>A new empty header file for C/C++.</descr>
</type>
<type icon="source_c" ext="c" create="template" name="C Source" >
<type icon="source_c" ext="c" name="C Source" create="template" >
<descr>A new empty C file.</descr>
</type>
</filetypes>
@ -329,7 +346,7 @@
</codecompletion>
<references/>
<creategettersetter>
<prefixGet/>
<prefixGet></prefixGet>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
@ -339,7 +356,7 @@
<qt>
<used>false</used>
<version>3</version>
<root/>
<root></root>
</qt>
</kdevcppsupport>
<kdevdocumentation>

View File

@ -55,7 +55,7 @@ gboolean _moo_edit_line_mark_clicked (MooTextView *view,
/***********************************************************************/
/* Preferences
/*/
*/
enum {
MOO_EDIT_SETTING_LANG,
MOO_EDIT_SETTING_INDENT,
@ -80,7 +80,7 @@ void _moo_edit_update_config_from_global (MooEdit *edit);
/***********************************************************************/
/* File operations
/*/
*/
void _moo_edit_set_filename (MooEdit *edit,
const char *file,
@ -121,7 +121,7 @@ struct _MooEditPrivate {
/***********************************************************************/
/* Document
/*/
*/
char *filename;
char *basename;
char *display_filename;
@ -140,7 +140,7 @@ struct _MooEditPrivate {
/***********************************************************************/
/* Progress dialog and stuff
/*/
*/
MooEditState state;
guint progress_timeout;
GtkWidget *progress;
@ -151,14 +151,14 @@ struct _MooEditPrivate {
/***********************************************************************/
/* Bookmarks
/*/
*/
gboolean enable_bookmarks;
GSList *bookmarks; /* sorted by line number */
guint update_bookmarks_idle;
/***********************************************************************/
/* Actions
/*/
*/
GtkMenu *menu;
MooActionCollection *actions;
};

View File

@ -179,10 +179,10 @@ moo_edit_class_new_action (MooEditClass *klass,
static void
moo_edit_class_install_action (MooEditClass *klass,
const char *action_id,
MooActionFactory *action,
char **conditions)
moo_edit_class_install_action (MooEditClass *klass,
const char *action_id,
MooActionFactory *factory,
char **conditions)
{
GHashTable *actions;
ActionInfo *info;
@ -190,7 +190,7 @@ moo_edit_class_install_action (MooEditClass *klass,
GSList *l;
g_return_if_fail (MOO_IS_EDIT_CLASS (klass));
g_return_if_fail (MOO_IS_ACTION_FACTORY (action));
g_return_if_fail (MOO_IS_ACTION_FACTORY (factory));
g_return_if_fail (action_id && action_id[0]);
type = G_OBJECT_CLASS_TYPE (klass);
@ -206,7 +206,7 @@ moo_edit_class_install_action (MooEditClass *klass,
if (g_hash_table_lookup (actions, action_id))
moo_edit_class_remove_action (klass, action_id);
info = action_info_new (action, conditions);
info = action_info_new (factory, conditions);
g_hash_table_insert (actions, g_strdup (action_id), info);
for (l = _moo_edit_instances; l != NULL; l = l->next)

View File

@ -1424,7 +1424,6 @@ moo_editor_close_docs (MooEditor *editor,
for (l = list; l != NULL; l = l->next)
{
WindowInfo *info;
MooEdit *doc = l->data;
g_return_val_if_fail (MOO_IS_EDIT (doc), FALSE);

View File

@ -157,7 +157,6 @@ _moo_edit_update_global_config (void)
void
_moo_edit_apply_prefs (MooEdit *edit)
{
GtkTextView *text_view;
MooLangMgr *mgr;
MooTextStyleScheme *scheme;
@ -165,8 +164,6 @@ _moo_edit_apply_prefs (MooEdit *edit)
g_object_freeze_notify (G_OBJECT (edit));
text_view = GTK_TEXT_VIEW (edit);
g_object_set (edit,
"smart-home-end", get_bool (MOO_EDIT_PREFS_SMART_HOME_END),
"enable-highlight", get_bool (MOO_EDIT_PREFS_ENABLE_HIGHLIGHTING),

View File

@ -3638,7 +3638,7 @@ do_update_doc_list (MooEditWindow *window)
}
else
{
GtkActionGroup *group;
GtkActionGroup *action_group;
char *name = g_strdup_printf ("MooEdit-%p", doc);
action = g_object_new (MOO_TYPE_RADIO_ACTION ,
"name", name,
@ -3649,8 +3649,8 @@ do_update_doc_list (MooEditWindow *window)
g_object_set_data (G_OBJECT (action), "moo-edit", doc);
_moo_action_set_no_accel (action, TRUE);
g_signal_connect (action, "toggled", G_CALLBACK (doc_list_action_toggled), window);
group = moo_action_collection_get_group (moo_window_get_actions (MOO_WINDOW (window)), NULL);
gtk_action_group_add_action (group, GTK_ACTION (action));
action_group = moo_action_collection_get_group (moo_window_get_actions (MOO_WINDOW (window)), NULL);
gtk_action_group_add_action (action_group, GTK_ACTION (action));
g_free (name);
}

View File

@ -417,7 +417,6 @@ moo_line_view_write_line (MooLineView *view,
static void
check_if_scrolled (MooLineView *view)
{
GdkWindow *text_window;
GdkRectangle rect;
GtkTextIter iter;
int line;
@ -428,9 +427,6 @@ check_if_scrolled (MooLineView *view)
return;
}
text_window = gtk_text_view_get_window (GTK_TEXT_VIEW (view),
GTK_TEXT_WINDOW_TEXT);
gtk_text_view_get_visible_rect (GTK_TEXT_VIEW (view), &rect);
gtk_text_view_get_line_at_y (GTK_TEXT_VIEW (view), &iter,
rect.y + rect.height - 1, NULL);

View File

@ -254,17 +254,17 @@ moo_plugin_register (const char *id,
for (p = langs; p && *p; ++p)
{
char *id;
char *lang_id;
if (!**p)
continue;
id = _moo_lang_id_from_name (*p);
lang_id = _moo_lang_id_from_name (*p);
if (!g_hash_table_lookup (table, id))
g_hash_table_insert (table, id, id);
if (!g_hash_table_lookup (table, lang_id))
g_hash_table_insert (table, lang_id, lang_id);
else
g_free (id);
g_free (lang_id);
}
if (!g_hash_table_size (table))

View File

@ -1930,15 +1930,11 @@ void
moo_text_buffer_delete_line_mark (MooTextBuffer *buffer,
MooLineMark *mark)
{
int line;
g_return_if_fail (MOO_IS_TEXT_BUFFER (buffer));
g_return_if_fail (MOO_IS_LINE_MARK (mark));
g_return_if_fail (moo_line_mark_get_buffer (mark) == buffer);
line = moo_line_mark_get_line (mark);
_moo_line_buffer_remove_mark (buffer->priv->line_buf, mark);
line_mark_deleted (buffer, mark);
g_object_unref (mark);
}

View File

@ -28,7 +28,7 @@ G_BEGIN_DECLS
/***********************************************************************/
/* GtkTextView stuff
/*/
*/
void _moo_text_view_move_cursor (GtkTextView *text_view,
GtkMovementStep step,
gint count,
@ -93,7 +93,7 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Drawing
/*/
*/
MooTextStyleScheme *style_scheme;
guint tab_width;
gboolean highlight_current_line;
@ -122,13 +122,13 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Search
/*/
*/
int last_search_stamp;
GtkTextMark *last_found_start, *last_found_end;
/***********************************************************************/
/* Indentation
/*/
*/
MooIndenter *indenter;
gboolean backspace_indents;
gboolean enter_indents;
@ -136,7 +136,7 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Keyboard
/*/
*/
gboolean smart_home_end;
gboolean ctrl_up_down_scrolls;
gboolean ctrl_page_up_down_scrolls;
@ -148,7 +148,7 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Selection and drag
/*/
*/
guint drag_scroll_timeout;
GdkEventType drag_button;
MooTextViewDragType drag_type;
@ -160,7 +160,7 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Drag'n'drop from outside
/*/
*/
gboolean drag_inside;
gboolean drag_drop;
GtkTargetList *targets;
@ -168,13 +168,13 @@ struct _MooTextViewPrivate {
/***********************************************************************/
/* Children
/*/
*/
GtkWidget *children[4];
GSList *boxes;
/***********************************************************************/
/* Search
/*/
*/
struct {
gboolean enable;
gboolean in_search;

View File

@ -25,16 +25,6 @@
#include <string.h>
#ifdef __WIN32__
#if MOO_USER_TOOL_THIS_OS != MOO_USER_TOOL_WIN32
#error "oops"
#endif
#else
#if MOO_USER_TOOL_THIS_OS != MOO_USER_TOOL_UNIX
#error "oops"
#endif
#endif
#define N_TOOLS 2
#define ITEM_TOOL "tool"

View File

@ -256,10 +256,10 @@ moo_file_selector_chdir (MooFileView *fileview,
if (result)
{
char *dir = NULL;
g_object_get (fileview, "current-directory", &dir, NULL);
moo_prefs_set_filename (DIR_PREFS, dir);
g_free (dir);
char *new_dir = NULL;
g_object_get (fileview, "current-directory", &new_dir, NULL);
moo_prefs_set_filename (DIR_PREFS, new_dir);
g_free (new_dir);
}
return result;

View File

@ -105,22 +105,17 @@ static int
ms_lex_parse_string (MSLex *lex,
MSParser *parser)
{
guint first, last;
guchar quote, second;
guint last;
guchar quote;
GString *string;
int token = -1;
g_assert (IS_QUOTE (lex->input[lex->ptr]));
last = first = lex->ptr + 1;
last = lex->ptr + 1;
quote = lex->input[lex->ptr];
string = g_string_new (NULL);
if (quote == '\'')
second = '"';
else
second = '\'';
while (last < lex->len)
{
guchar c = lex->input[last];

View File

@ -341,22 +341,22 @@ add_row (GtkActionGroup *group,
}
else
{
GtkTreeIter group;
GtkTreeIter group_iter;
GtkTreePath *path;
gtk_tree_store_append (page->store, &group, NULL);
gtk_tree_store_set (page->store, &group,
gtk_tree_store_append (page->store, &group_iter, NULL);
gtk_tree_store_set (page->store, &group_iter,
COLUMN_ACTION_NAME, group_name,
COLUMN_ACTION, NULL,
COLUMN_ACCEL, NULL,
-1);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (page->store), &group);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (page->store), &group_iter);
g_hash_table_insert (page->groups,
g_strdup (group_name),
gtk_tree_row_reference_new (GTK_TREE_MODEL (page->store), path));
gtk_tree_path_free (path);
gtk_tree_store_append (page->store, &iter, &group);
gtk_tree_store_append (page->store, &iter, &group_iter);
}
accel = get_accel_label_for_path (_moo_action_get_accel_path (action));

View File

@ -455,11 +455,9 @@ set_initial_size (GtkWindow *window,
PositionInfo *pinfo)
{
int width, height;
gboolean maximized;
width = moo_prefs_get_int (pinfo->key_width);
height = moo_prefs_get_int (pinfo->key_height);
maximized = moo_prefs_get_bool (pinfo->key_maximized);
if (width > 0 && height > 0)
gtk_window_set_default_size (window, width, height);

View File

@ -102,7 +102,6 @@ static void moo_font_selection_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void moo_font_selection_init (MooFontSelection *fontsel);
static void moo_font_selection_finalize (GObject *object);
static void moo_font_selection_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
@ -138,9 +137,6 @@ static void moo_font_selection_update_preview (MooFontSelection *fs);
static void moo_font_selection_dialog_class_init (MooFontSelectionDialogClass *klass);
static void moo_font_selection_dialog_init (MooFontSelectionDialog *fontseldiag);
static GtkVBoxClass *font_selection_parent_class = NULL;
static GtkWindowClass *font_selection_dialog_parent_class = NULL;
G_DEFINE_TYPE(MooFontSelection, moo_font_selection, GTK_TYPE_VBOX)
@ -150,8 +146,6 @@ moo_font_selection_class_init (MooFontSelectionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
font_selection_parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = moo_font_selection_set_property;
gobject_class->get_property = moo_font_selection_get_property;
@ -188,8 +182,6 @@ moo_font_selection_class_init (MooFontSelectionClass *klass)
P_("filter-visible"),
TRUE,
G_PARAM_READWRITE));
gobject_class->finalize = moo_font_selection_finalize;
}
static void
@ -549,18 +541,6 @@ moo_font_selection_new (void)
return GTK_WIDGET (fontsel);
}
static void
moo_font_selection_finalize (GObject *object)
{
MooFontSelection *fontsel;
g_return_if_fail (MOO_IS_FONT_SELECTION (object));
fontsel = MOO_FONT_SELECTION (object);
(* G_OBJECT_CLASS (font_selection_parent_class)->finalize) (object);
}
static void
moo_font_selection_refresh (MooFontSelection *fontsel)
{
@ -1306,9 +1286,8 @@ moo_font_selection_set_filter_visible (MooFontSelection *fontsel,
G_DEFINE_TYPE(MooFontSelectionDialog, moo_font_selection_dialog, GTK_TYPE_DIALOG)
static void
moo_font_selection_dialog_class_init (MooFontSelectionDialogClass *klass)
moo_font_selection_dialog_class_init (G_GNUC_UNUSED MooFontSelectionDialogClass *klass)
{
font_selection_dialog_parent_class = g_type_class_peek_parent (klass);
}
static void

View File

@ -856,12 +856,12 @@ create_child (MooGladeXML *xml,
static void
pack_children (MooGladeXML *xml,
Widget *parent_node,
GtkWidget *parent)
GtkWidget *parent_widget)
{
GSList *l;
g_return_if_fail (parent_node != NULL);
g_return_if_fail (parent != NULL);
g_return_if_fail (parent_widget != NULL);
for (l = parent_node->children; l != NULL; l = l->next)
{
@ -875,13 +875,13 @@ pack_children (MooGladeXML *xml,
widget = child->widget->widget;
g_return_if_fail (widget != NULL);
if (GTK_IS_FRAME (parent) &&
if (GTK_IS_FRAME (parent_widget) &&
(child->props->mask & PACK_PROP_LABEL_ITEM))
{
gtk_frame_set_label_widget (GTK_FRAME (parent), widget);
gtk_frame_set_label_widget (GTK_FRAME (parent_widget), widget);
packed = TRUE;
}
else if (GTK_IS_NOTEBOOK (parent) &&
else if (GTK_IS_NOTEBOOK (parent_widget) &&
(child->props->mask & PACK_PROP_TAB))
{
int index = g_slist_index (parent_node->children, child);
@ -897,21 +897,21 @@ pack_children (MooGladeXML *xml,
if (!page_child->widget || !page_child->widget->widget)
g_message ("%s: empty notebook page with non-empty label", G_STRLOC);
else
gtk_notebook_set_tab_label (GTK_NOTEBOOK (parent),
gtk_notebook_set_tab_label (GTK_NOTEBOOK (parent_widget),
page_child->widget->widget,
widget);
packed = TRUE;
}
}
else if (GTK_IS_MENU_ITEM (parent) && GTK_IS_MENU (widget))
else if (GTK_IS_MENU_ITEM (parent_widget) && GTK_IS_MENU (widget))
{
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), widget);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent_widget), widget);
packed = TRUE;
}
else if (GTK_IS_OPTION_MENU (parent) && GTK_IS_MENU (widget))
else if (GTK_IS_OPTION_MENU (parent_widget) && GTK_IS_MENU (widget))
{
gtk_option_menu_set_menu (GTK_OPTION_MENU (parent), widget);
gtk_option_menu_set_menu (GTK_OPTION_MENU (parent_widget), widget);
packed = TRUE;
}
else if (child->widget->props->mask & PROP_RESPONSE_ID)
@ -940,16 +940,16 @@ pack_children (MooGladeXML *xml,
}
if (!packed)
gtk_container_add (GTK_CONTAINER (parent), widget);
gtk_container_add (GTK_CONTAINER (parent_widget), widget);
if (child->props->n_params)
{
guint i;
for (i = 0; i < child->props->n_params; ++i)
gtk_container_child_set_property (GTK_CONTAINER (parent),
widget,
child->props->params[i].name,
&child->props->params[i].value);
gtk_container_child_set_property (GTK_CONTAINER (parent_widget),
widget,
child->props->params[i].name,
&child->props->params[i].value);
}
set_special_props (xml, widget, child->widget->props);

View File

@ -728,7 +728,6 @@ moo_markup_set_prop (MooMarkupNode *elm,
else
{
guint j;
char **attr_names, **attr_vals;
/* XXX just move them */
@ -991,10 +990,9 @@ moo_markup_create_text_element (MooMarkupNode *parent,
const char *content)
{
MooMarkupElement *elm;
MooMarkupNode *child;
g_return_val_if_fail (MOO_MARKUP_IS_ELEMENT (parent) ||
MOO_MARKUP_IS_DOC (parent), NULL);
MOO_MARKUP_IS_DOC (parent), NULL);
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (content != NULL, NULL);
g_return_val_if_fail (g_utf8_validate (content, -1, NULL), NULL);
@ -1004,9 +1002,9 @@ moo_markup_create_text_element (MooMarkupNode *parent,
if (!elm)
return NULL;
child = moo_markup_text_node_new (MOO_MARKUP_TEXT_NODE,
elm->doc, MOO_MARKUP_NODE (elm),
content, strlen (content));
moo_markup_text_node_new (MOO_MARKUP_TEXT_NODE,
elm->doc, MOO_MARKUP_NODE (elm),
content, strlen (content));
g_free (elm->content);
elm->content = g_strdup (content);

View File

@ -935,7 +935,6 @@ static void moo_notebook_size_allocate (GtkWidget *widget,
if (nb->priv->current_page)
{
int border_width = gtk_container_get_border_width (GTK_CONTAINER (nb));
child_allocation.x = allocation->x + border_width + xthickness;
child_allocation.y = allocation->y + nb->priv->tabs_height + border_width + ythickness;
child_allocation.width = MAX (0, allocation->width - 2*border_width - 2*xthickness);
@ -3531,8 +3530,9 @@ static gboolean moo_notebook_focus (GtkWidget *widget,
}
static void moo_notebook_set_focus_child(GtkContainer *container,
GtkWidget *child)
static void
moo_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
Page *page;
GtkWidget *focus_child, *window;
@ -3563,6 +3563,7 @@ static void moo_notebook_set_focus_child(GtkContainer *container,
}
}
/* XXX should it be used? */
old_focus = nb->priv->focus;
if (child)

View File

@ -1091,12 +1091,9 @@ moo_prefs_load (const char *file_rc,
const char *file_state,
GError **error)
{
MooPrefs *prefs;
g_return_val_if_fail (file_rc != NULL, FALSE);
g_return_val_if_fail (file_state != NULL, FALSE);
prefs = instance ();
moo_prefs_set_modified (FALSE);
return load_file (file_rc, MOO_PREFS_RC, error) &&

View File

@ -993,7 +993,7 @@ moo_window_class_get_name (MooWindowClass *klass)
static void
moo_window_class_install_action (MooWindowClass *klass,
const char *action_id,
MooActionFactory *action,
MooActionFactory *factory,
const char *group,
char **conditions)
{
@ -1003,7 +1003,7 @@ moo_window_class_install_action (MooWindowClass *klass,
GType type;
g_return_if_fail (MOO_IS_WINDOW_CLASS (klass));
g_return_if_fail (MOO_IS_ACTION_FACTORY (action));
g_return_if_fail (MOO_IS_ACTION_FACTORY (factory));
g_return_if_fail (action_id && action_id[0]);
type = G_OBJECT_CLASS_TYPE (klass);
@ -1012,7 +1012,7 @@ moo_window_class_install_action (MooWindowClass *klass,
if (g_hash_table_lookup (store->actions, action_id))
moo_window_class_remove_action (klass, action_id);
info = action_info_new (action, group, conditions);
info = action_info_new (factory, group, conditions);
g_hash_table_insert (store->actions, g_strdup (action_id), info);
for (l = window_instances; l != NULL; l = l->next)