From 85f73129c018610728efe9e34bc742e48435bf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 20 Feb 2008 11:24:23 +0000 Subject: [PATCH] Apply patch from Daniel Richard G. to fix to fix several compiler warnings, C89 violations and minor code problems (thanks). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2267 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ plugins/autosave.c | 4 ++-- plugins/classbuilder.c | 2 +- plugins/demoplugin.c | 4 ++-- plugins/export.c | 2 +- plugins/filebrowser.c | 26 +++++++++++++------------- plugins/htmlchars.c | 6 +++--- plugins/vcdiff.c | 8 ++++---- src/build.c | 6 +++--- src/build.h | 4 ++-- src/callbacks.c | 6 +++--- src/dialogs.c | 8 ++++---- src/dialogs.h | 10 +++++----- src/document.c | 8 ++++---- src/document.h | 22 ++++++---------------- src/editor.c | 4 ++-- src/editor.h | 2 +- src/encodings.c | 11 +++++++---- src/encodings.h | 2 +- src/filetypes.h | 16 ++++++++-------- src/geanyobject.h | 2 +- src/highlighting.c | 14 +++++++------- src/highlighting.h | 4 ++-- src/keybindings.c | 10 ++++++---- src/keybindings.h | 4 ++-- src/keyfile.c | 23 +++++++++++++---------- src/keyfile.h | 18 +++++++++--------- src/main.c | 10 +++++----- src/main.h | 2 +- src/msgwindow.c | 5 ++++- src/msgwindow.h | 10 +++++----- src/navqueue.c | 2 +- src/navqueue.h | 8 ++++---- src/notebook.c | 4 ++-- src/notebook.h | 2 +- src/plugindata.h | 8 ++++---- src/plugins.c | 12 ++++++------ src/plugins.h | 8 ++++---- src/prefix.c | 4 ++++ src/prefs.c | 6 +++--- src/project.c | 4 ++-- src/project.h | 14 +++++++------- src/sciwrappers.c | 2 +- src/search.c | 10 +++++----- src/search.h | 8 ++++---- src/socket.c | 9 ++++++--- src/socket.h | 8 +++++--- src/symbols.c | 20 ++++++++++---------- src/symbols.h | 8 ++++---- src/templates.c | 2 +- src/tools.c | 6 +++--- src/tools.h | 4 ++-- src/treeviews.c | 6 +++--- src/treeviews.h | 6 +++--- src/ui_utils.c | 28 ++++++++++++++-------------- src/ui_utils.h | 24 ++++++++++++------------ src/utils.c | 12 ++++++------ src/utils.h | 12 ++++++------ src/vte.c | 13 +++++++------ src/vte.h | 4 ++-- tagmanager/c.c | 2 +- tagmanager/docbook.c | 2 +- tagmanager/haskell.c | 4 ++-- tagmanager/include/tm_workspace.h | 2 +- tagmanager/sort.c | 2 +- tagmanager/tm_workspace.c | 4 ++-- 66 files changed, 274 insertions(+), 256 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73a29169..6f4a1ad1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-02-20 Enrico Tröger + + * plugins/*, src/*, tagmanager/*: + Apply patch from Daniel Richard G. to fix to fix several + compiler warnings, C89 violations and minor code problems (thanks). + + 2008-02-18 Enrico Tröger * src/vte.c: Apply patch from Jeff Pohlmeyer to mark the VTE also as diff --git a/plugins/autosave.c b/plugins/autosave.c index b22a97e0..bf98def4 100644 --- a/plugins/autosave.c +++ b/plugins/autosave.c @@ -79,7 +79,7 @@ gboolean auto_save(gpointer data) } -void set_timeout() +void set_timeout(void) { if (src_id != G_MAXUINT) g_source_remove(src_id); @@ -195,7 +195,7 @@ void configure(GtkWidget *parent) } -void cleanup() +void cleanup(void) { g_source_remove(src_id); g_free(config_file); diff --git a/plugins/classbuilder.c b/plugins/classbuilder.c index dd5c7f64..b0604645 100644 --- a/plugins/classbuilder.c +++ b/plugins/classbuilder.c @@ -803,7 +803,7 @@ void init(GeanyData *data) } -void cleanup() +void cleanup(void) { gtk_widget_destroy(plugin_fields->menu_item); } diff --git a/plugins/demoplugin.c b/plugins/demoplugin.c index 5bbef3e9..b89a1c94 100644 --- a/plugins/demoplugin.c +++ b/plugins/demoplugin.c @@ -70,7 +70,7 @@ item_activate(GtkMenuItem *menuitem, gpointer gdata) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - welcome_text); + "%s", welcome_text); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), _("(From the %s plugin)"), info()->name); @@ -146,7 +146,7 @@ void configure(GtkWidget *parent) /* Called by Geany before unloading the plugin. * Here any UI changes should be removed, memory freed and any other finalization done. * Be sure to leave Geany as it was before init(). */ -void cleanup() +void cleanup(void) { // remove the menu item added in init() gtk_widget_destroy(plugin_fields->menu_item); diff --git a/plugins/export.c b/plugins/export.c index 18440511..4778b360 100644 --- a/plugins/export.c +++ b/plugins/export.c @@ -737,7 +737,7 @@ void init(GeanyData *data) } -void cleanup() +void cleanup(void) { gtk_widget_destroy(plugin_fields->menu_item); } diff --git a/plugins/filebrowser.c b/plugins/filebrowser.c index 03630aa5..81672634 100644 --- a/plugins/filebrowser.c +++ b/plugins/filebrowser.c @@ -60,7 +60,7 @@ enum { FILEVIEW_COLUMN_ICON = 0, FILEVIEW_COLUMN_NAME, - FILEVIEW_N_COLUMNS, + FILEVIEW_N_COLUMNS }; static gboolean show_hidden_files = FALSE; @@ -163,7 +163,7 @@ static gboolean is_top_level_directory(const gchar *dir) // adds ".." to the start of the file list -static void add_top_level_entry() +static void add_top_level_entry(void) { GtkTreeIter iter; @@ -178,7 +178,7 @@ static void add_top_level_entry() } -static void clear() +static void clear(void) { gtk_list_store_clear(file_store); @@ -190,7 +190,7 @@ static void clear() // recreate the tree model from current_dir. -static void refresh() +static void refresh(void) { gchar *utf8_dir; GSList *list; @@ -217,14 +217,14 @@ static void refresh() } -static void on_go_home() +static void on_go_home(void) { setptr(current_dir, g_strdup(g_get_home_dir())); refresh(); } -static gchar *get_default_dir() +static gchar *get_default_dir(void) { const gchar *dir = NULL; @@ -237,7 +237,7 @@ static gchar *get_default_dir() } -static void on_current_path() +static void on_current_path(void) { gchar *fname; gchar *dir; @@ -260,7 +260,7 @@ static void on_current_path() } -static void on_go_up() +static void on_go_up(void) { // remove the highest directory part (which becomes the basename of current_dir) setptr(current_dir, g_path_get_dirname(current_dir)); @@ -495,7 +495,7 @@ static void on_hidden_files_clicked(GtkCheckMenuItem *item) } -static GtkWidget *create_popup_menu() +static GtkWidget *create_popup_menu(void) { GtkWidget *item, *menu, *image; @@ -629,7 +629,7 @@ static void on_path_entry_activate(GtkEntry *entry, gpointer user_data) } -static void prepare_file_view() +static void prepare_file_view(void) { GtkCellRenderer *text_renderer, *icon_renderer; GtkTreeViewColumn *column; @@ -671,7 +671,7 @@ static void prepare_file_view() } -static GtkWidget *make_toolbar() +static GtkWidget *make_toolbar(void) { GtkWidget *wid, *toolbar; GtkTooltips *tooltips = GTK_TOOLTIPS(p_support->lookup_widget( @@ -756,7 +756,7 @@ static gboolean completion_match_selected(GtkEntryCompletion *widget, GtkTreeMod } -static void completion_create() +static void completion_create(void) { entry_completion = gtk_entry_completion_new(); @@ -915,7 +915,7 @@ void configure(GtkWidget *parent) } -void cleanup() +void cleanup(void) { g_free(config_file); g_free(open_cmd); diff --git a/plugins/htmlchars.c b/plugins/htmlchars.c index 611d1133..92cde0b8 100644 --- a/plugins/htmlchars.c +++ b/plugins/htmlchars.c @@ -61,7 +61,7 @@ static void sc_fill_store(GtkTreeStore *store); static gboolean sc_insert(GtkTreeModel *model, GtkTreeIter *iter); -static void tools_show_dialog_insert_special_chars() +static void tools_show_dialog_insert_special_chars(void) { if (sc_dialog == NULL) { @@ -79,7 +79,7 @@ static void tools_show_dialog_insert_special_chars() gtk_widget_set_name(sc_dialog, "GeanyDialog"); height = GEANY_WINDOW_MINIMAL_HEIGHT; - gtk_window_set_default_size(GTK_WINDOW(sc_dialog), height * 0.8, height); + gtk_window_set_default_size(GTK_WINDOW(sc_dialog), height * 8 / 10, height); gtk_dialog_set_default_response(GTK_DIALOG(sc_dialog), GTK_RESPONSE_CANCEL); label = gtk_label_new(_("Choose a special character from the list below and double click on it or use the button to insert it at the current cursor position.")); @@ -521,7 +521,7 @@ void init(GeanyData *data) /* Destroy widgets */ -void cleanup() +void cleanup(void) { gtk_widget_destroy(plugin_fields->menu_item); diff --git a/plugins/vcdiff.c b/plugins/vcdiff.c index 52b2e0d2..2f7d0c3d 100644 --- a/plugins/vcdiff.c +++ b/plugins/vcdiff.c @@ -271,11 +271,11 @@ static void show_output(const gchar *std_output, const gchar *name_prefix, if (force_encoding) { text = p_encoding->convert_to_utf8_from_charset( - std_output, -1, force_encoding, TRUE); + std_output, (gsize)-1, force_encoding, TRUE); } else { - text = p_encoding->convert_to_utf8(std_output, -1, &detect_enc); + text = p_encoding->convert_to_utf8(std_output, (gsize)-1, &detect_enc); } if (text) { @@ -454,7 +454,7 @@ static GtkWidget *menu_vcdiff_file = NULL; static GtkWidget *menu_vcdiff_dir = NULL; static GtkWidget *menu_vcdiff_project = NULL; -static void update_menu_items() +static void update_menu_items(void) { document *doc; gboolean have_file; @@ -525,7 +525,7 @@ void init(GeanyData *data) /* Called by Geany before unloading the plugin. */ -void cleanup() +void cleanup(void) { // remove the menu item added in init() gtk_widget_destroy(plugin_fields->menu_item); diff --git a/src/build.c b/src/build.c index 55fe0c25..6314ae4a 100644 --- a/src/build.c +++ b/src/build.c @@ -1384,7 +1384,7 @@ on_includes_arguments_tex_dialog_response (GtkDialog *dialog, } -static void show_includes_arguments_tex() +static void show_includes_arguments_tex(void) { GtkWidget *dialog, *label, *entries[4], *vbox, *table; gint idx = document_get_cur_idx(); @@ -1551,7 +1551,7 @@ on_includes_arguments_dialog_response (GtkDialog *dialog, } -static void show_includes_arguments_gen() +static void show_includes_arguments_gen(void) { GtkWidget *dialog, *label, *entries[3], *vbox; GtkWidget *ft_table = NULL; @@ -1943,7 +1943,7 @@ on_make_custom_input_response(const gchar *input) static void -show_make_custom() +show_make_custom(void) { static GtkWidget *dialog = NULL; // keep dialog for combo history diff --git a/src/build.h b/src/build.h index c8c09526..bd00e314 100644 --- a/src/build.h +++ b/src/build.h @@ -62,9 +62,9 @@ typedef struct BuildMenuItems -void build_init(); +void build_init(void); -void build_finalize(); +void build_finalize(void); gboolean build_parse_make_dir(const gchar *string, gchar **prefix); diff --git a/src/callbacks.c b/src/callbacks.c index b95546c4..84c4d53d 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -93,7 +93,7 @@ static gboolean insert_callback_from_menu = FALSE; CallbacksData callbacks_data = {-1}; -static gboolean check_no_unsaved() +static gboolean check_no_unsaved(void) { guint i; @@ -108,7 +108,7 @@ static gboolean check_no_unsaved() } -static gboolean account_for_unsaved() +static gboolean account_for_unsaved(void) { gint p; @@ -139,7 +139,7 @@ static void verify_click_pos(gint idx) // should only be called from on_exit_clicked -static void quit_app() +static void quit_app(void) { guint i; diff --git a/src/dialogs.c b/src/dialogs.c index 58825067..6a90cd9d 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -63,7 +63,7 @@ enum }; #if ! GEANY_USE_WIN32_DIALOG -static GtkWidget *add_file_open_extra_widget(); +static GtkWidget *add_file_open_extra_widget(void); #endif @@ -163,7 +163,7 @@ on_file_open_check_hidden_toggled (GtkToggleButton *togglebutton, #if ! GEANY_USE_WIN32_DIALOG -static void create_open_file_dialog() +static void create_open_file_dialog(void) { GtkWidget *filetype_combo, *encoding_combo; GtkWidget *viewbtn; @@ -471,7 +471,7 @@ on_file_save_dialog_response (GtkDialog *dialog, #if ! GEANY_USE_WIN32_DIALOG -static void create_save_file_dialog() +static void create_save_file_dialog(void) { GtkWidget *vbox, *check_open_new_tab, *rename_btn; GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips")); @@ -823,7 +823,7 @@ on_input_dialog_response(GtkDialog *dialog, gint response, GtkWidget *entry) { - gboolean persistent = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "has_combo")); + gboolean persistent = (gboolean) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "has_combo")); if (response == GTK_RESPONSE_ACCEPT) { diff --git a/src/dialogs.h b/src/dialogs.h index 75adc58d..60884a4f 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -33,22 +33,22 @@ typedef void (*InputCallback)(const gchar *); -void dialogs_show_open_file(); +void dialogs_show_open_file(void); -gboolean dialogs_show_save_as(); +gboolean dialogs_show_save_as(void); gboolean dialogs_show_unsaved_file(gint idx); -void dialogs_show_open_font(); +void dialogs_show_open_font(void); -void dialogs_show_word_count(); +void dialogs_show_word_count(void); void dialogs_show_color(gchar *colour); GtkWidget *dialogs_show_input(const gchar *title, const gchar *label_text, const gchar *default_text, gboolean persistent, InputCallback input_cb); -void dialogs_show_goto_line(); +void dialogs_show_goto_line(void); void dialogs_show_file_properties(gint idx); diff --git a/src/document.c b/src/document.c index 89309d6d..af25da34 100644 --- a/src/document.c +++ b/src/document.c @@ -354,7 +354,7 @@ static void init_doc_struct(document *new_doc) /* returns the next free place(i.e. index) in the document list, * or -1 if the current doc_array is full */ -static gint document_get_new_idx() +static gint document_get_new_idx(void) { guint i; @@ -1294,9 +1294,9 @@ gboolean document_save_file(gint idx, gboolean force) // encoding, it will be converted to doc_list[idx].encoding below and this conversion // also changes the BOM data = (gchar*) g_malloc(len + 3); // 3 chars for BOM - data[0] = 0xef; - data[1] = 0xbb; - data[2] = 0xbf; + data[0] = (gchar) 0xef; + data[1] = (gchar) 0xbb; + data[2] = (gchar) 0xbf; sci_get_text(doc_list[idx].sci, len, data + 3); len += 3; } diff --git a/src/document.h b/src/document.h index 48c88fb2..62a0e636 100644 --- a/src/document.h +++ b/src/document.h @@ -131,22 +131,19 @@ extern GArray *doc_array; gint document_find_by_filename(const gchar *filename, gboolean is_tm_filename); - gint document_find_by_sci(ScintillaObject *sci); - gint document_get_notebook_page(gint doc_idx); gint document_get_n_idx(guint page_num); -gint document_get_cur_idx(); +gint document_get_cur_idx(void); -document *document_get_current(); +document *document_get_current(void); +void document_init_doclist(void); -void document_init_doclist(); - -void document_finalize(); +void document_finalize(void); void document_set_text_changed(gint idx); @@ -154,10 +151,8 @@ void document_set_text_changed(gint idx); void document_apply_update_prefs(gint idx); - gboolean document_remove(guint page_num); - gint document_new_file(const gchar *filename, filetype *ft, const gchar *text); gint document_clone(gint old_idx, const gchar *utf8_filename); @@ -174,13 +169,10 @@ void document_open_file_list(const gchar *data, gssize length); void document_open_files(const GSList *filenames, gboolean readonly, filetype *ft, const gchar *forced_enc); - gboolean document_reload_file(gint idx, const gchar *forced_enc); - gboolean document_save_file(gint idx, gboolean force); - gboolean document_search_bar_find(gint idx, const gchar *text, gint flags, gboolean inc); gint document_find_text(gint idx, const gchar *text, gint flags, gboolean search_backwards, @@ -254,13 +246,11 @@ void document_redo(gint idx); void document_undo_add(gint idx, guint type, gpointer data); - GdkColor *document_get_status(gint idx); +void document_delay_colourise(void); -void document_delay_colourise(); - -void document_colourise_new(); +void document_colourise_new(void); void document_insert_colour(gint idx, const gchar *colour); diff --git a/src/editor.c b/src/editor.c index 85b729c5..424c9e0d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -77,7 +77,7 @@ on_editor_button_press_event (GtkWidget *widget, gpointer user_data) { gint idx = GPOINTER_TO_INT(user_data); - editor_info.click_pos = sci_get_position_from_xy(doc_list[idx].sci, event->x, event->y, FALSE); + editor_info.click_pos = sci_get_position_from_xy(doc_list[idx].sci, (gint)event->x, (gint)event->y, FALSE); if (event->button == 1) { @@ -1997,7 +1997,7 @@ void editor_highlight_braces(ScintillaObject *sci, gint cur_pos) brace_pos++; if (! utils_isbrace(sci_get_char_at(sci, brace_pos), editor_prefs.brace_match_ltgt)) { - SSM(sci, SCI_BRACEBADLIGHT, -1, 0); + SSM(sci, SCI_BRACEBADLIGHT, (uptr_t)-1, 0); return; } } diff --git a/src/editor.h b/src/editor.h index 3336ce44..202d8506 100644 --- a/src/editor.h +++ b/src/editor.h @@ -133,7 +133,7 @@ void editor_indentation_by_one_space(gint idx, gint pos, gboolean decrease); void editor_scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_view); -void editor_finalize(); +void editor_finalize(void); /* General editing functions */ diff --git a/src/encodings.c b/src/encodings.c index 4e41548f..7e785fb9 100644 --- a/src/encodings.c +++ b/src/encodings.c @@ -53,6 +53,9 @@ static regex_t pregs[2]; #endif +GeanyEncoding encodings[GEANY_ENCODINGS_MAX]; + + #define fill(Order, Group, Idx, Charset, Name) \ encodings[Idx].idx = Idx; \ encodings[Idx].order = Order; \ @@ -479,7 +482,7 @@ gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_e gchar *utf8_content; gboolean check_regex = FALSE; gboolean check_locale = FALSE; - guint i; + gint i; if ((gint)size == -1) { @@ -488,7 +491,7 @@ gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_e #ifdef HAVE_REGCOMP // first try to read the encoding from the file content - for (i = 0; i < G_N_ELEMENTS(pregs) && ! check_regex; i++) + for (i = 0; i < (gint) G_N_ELEMENTS(pregs) && ! check_regex; i++) { if ((regex_charset = regex_match(&pregs[i], buffer, size)) != NULL) check_regex = TRUE; @@ -500,7 +503,7 @@ gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_e for (i = 0; i < GEANY_ENCODINGS_MAX; i++) { - if (i == (guint) encodings[GEANY_ENCODING_NONE].idx || i == (guint) -1) + if (i == encodings[GEANY_ENCODING_NONE].idx || i == -1) continue; if (check_regex) @@ -522,7 +525,7 @@ gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_e if (charset == NULL) continue; - geany_debug("Trying to convert %d bytes of data from %s into UTF-8.", (gint) size, charset); + geany_debug("Trying to convert %" G_GSIZE_FORMAT " bytes of data from %s into UTF-8.", size, charset); utf8_content = encodings_convert_to_utf8_from_charset(buffer, size, charset, FALSE); if (utf8_content != NULL) diff --git a/src/encodings.h b/src/encodings.h index 9b8a0a86..77219752 100644 --- a/src/encodings.h +++ b/src/encodings.h @@ -179,7 +179,7 @@ typedef enum } GeanyEncodingIndex; -GeanyEncoding encodings[GEANY_ENCODINGS_MAX]; +extern GeanyEncoding encodings[GEANY_ENCODINGS_MAX]; GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, guint *bom_len); diff --git a/src/filetypes.h b/src/filetypes.h index 2060daf8..4dffa63a 100644 --- a/src/filetypes.h +++ b/src/filetypes.h @@ -88,9 +88,9 @@ typedef enum struct build_actions { - gboolean can_compile:1; - gboolean can_link:1; - gboolean can_exec:1; + gboolean can_compile; + gboolean can_link; + gboolean can_exec; }; struct build_programs @@ -128,10 +128,10 @@ extern filetype *filetypes[GEANY_MAX_FILE_TYPES]; filetype *filetypes_get_from_uid(gint uid); /* Calls filetypes_init_types() and creates the filetype menu. */ -void filetypes_init(); +void filetypes_init(void); /* Create the filetype array and fill it with the known filetypes. */ -void filetypes_init_types(); +void filetypes_init_types(void); /* Detect the filetype for document idx, checking for a shebang, then filename extension. */ filetype *filetypes_detect_from_file(gint idx); @@ -141,17 +141,17 @@ filetype *filetypes_detect_from_file(gint idx); filetype *filetypes_detect_from_filename(const gchar *utf8_filename); /* frees the array and all related pointers */ -void filetypes_free_types(); +void filetypes_free_types(void); void filetypes_load_config(gint ft_id); -void filetypes_save_commands(); +void filetypes_save_commands(void); void filetypes_select_radio_item(const filetype *ft); GtkFileFilter *filetypes_create_file_filter(filetype *ft); -GtkFileFilter *filetypes_create_file_filter_all_source(); +GtkFileFilter *filetypes_create_file_filter_all_source(void); gchar *filetypes_get_conf_extension(gint filetype_idx); diff --git a/src/geanyobject.h b/src/geanyobject.h index 611e1cc7..9fc51f28 100644 --- a/src/geanyobject.h +++ b/src/geanyobject.h @@ -76,7 +76,7 @@ struct _GeanyObjectClass void (*document_activate)(gint idx); void (*project_open)(GKeyFile *keyfile); void (*project_save)(GKeyFile *keyfile); - void (*project_close)(); + void (*project_close)(void); }; GType geany_object_get_type (void); diff --git a/src/highlighting.c b/src/highlighting.c index 241e3bd1..706ce505 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -73,9 +73,9 @@ enum // Geany common styling typedef struct { // can take values 1 or 2 (or 3) - guchar marker:2; - guchar lines:2; - guchar draw_line:3; + guint marker:2; + guint lines:2; + guint draw_line:3; } FoldingStyle; static struct @@ -582,10 +582,10 @@ HighlightingStyle gsd_string_eol = {0x000000, 0xe0c0e0, FALSE, FALSE}; static void styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, gint filetype_idx) { - HighlightingStyle uuid = {0x404080, 0xffffff, FALSE, FALSE}; - HighlightingStyle operator = {0x301010, 0xffffff, FALSE, FALSE}; - HighlightingStyle verbatim = {0x301010, 0xffffff, FALSE, FALSE}; - HighlightingStyle regex = {0x105090, 0xffffff, FALSE, FALSE}; + static HighlightingStyle uuid = {0x404080, 0xffffff, FALSE, FALSE}; + static HighlightingStyle operator = {0x301010, 0xffffff, FALSE, FALSE}; + static HighlightingStyle verbatim = {0x301010, 0xffffff, FALSE, FALSE}; + static HighlightingStyle regex = {0x105090, 0xffffff, FALSE, FALSE}; StyleEntry entries[] = { diff --git a/src/highlighting.h b/src/highlighting.h index 562d059d..c1fe7355 100644 --- a/src/highlighting.h +++ b/src/highlighting.h @@ -33,8 +33,8 @@ typedef struct HighlightingStyle { gint foreground; gint background; - gboolean bold:1; - gboolean italic:1; + gboolean bold; + gboolean italic; } HighlightingStyle; diff --git a/src/keybindings.c b/src/keybindings.c index c32d32bc..1a2e57d9 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -46,6 +46,8 @@ #include "vte.h" +KeyBinding *keys[GEANY_MAX_KEYS]; + static const gboolean swap_alt_tab_order = FALSE; @@ -103,10 +105,10 @@ static void cb_func_edit_global(guint key_id); // common function for keybindings using current word static void cb_func_current_word(guint key_id); -static void add_menu_accels(); +static void add_menu_accels(void); -static void init_default_kb() +static void init_default_kb(void) { // init all fields of keys with default values keys[GEANY_KEYS_MENU_NEW] = fill(cb_func_file_action, @@ -331,7 +333,7 @@ static void init_default_kb() } -static void load_user_kb() +static void load_user_kb(void) { gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "keybindings.conf", NULL); gchar *val; @@ -570,7 +572,7 @@ void keybindings_show_shortcuts() gtk_widget_set_name(dialog, "GeanyDialog"); height = GEANY_WINDOW_MINIMAL_HEIGHT; - gtk_window_set_default_size(GTK_WINDOW(dialog), height * 0.8, height); + gtk_window_set_default_size(GTK_WINDOW(dialog), height * 8 / 10, height); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); label3 = gtk_label_new(_("The following keyboard shortcuts are configurable:")); diff --git a/src/keybindings.h b/src/keybindings.h index ef1da54b..e0774063 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -185,7 +185,7 @@ typedef enum } GeanyKeyCommand; -KeyBinding *keys[GEANY_MAX_KEYS]; +extern KeyBinding *keys[GEANY_MAX_KEYS]; void keybindings_init(void); @@ -197,7 +197,7 @@ void keybindings_cmd(GeanyKeyCommand cmd_id); /* just write the content of the keys array to the config file */ void keybindings_write_to_file(void); -void keybindings_show_shortcuts(); +void keybindings_show_shortcuts(void); /* central keypress event handler, almost all keypress events go to this function */ gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); diff --git a/src/keyfile.c b/src/keyfile.c index fa0b3947..3ee2c3d5 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -160,8 +160,11 @@ static void save_plugin_prefs(GKeyFile *config) g_key_file_set_string_list(config, "plugins", "active_plugins", (const gchar**)app->active_plugins, g_strv_length(app->active_plugins)); else + { // use an empty dummy array to override maybe exisiting value - g_key_file_set_string_list(config, "plugins", "active_plugins", (const gchar*[1]){ "" }, 1); + const gchar *dummy[] = { "" }; + g_key_file_set_string_list(config, "plugins", "active_plugins", dummy, 1); + } } #endif @@ -375,7 +378,7 @@ static void save_hidden_prefs(GKeyFile *config) } -void configuration_save() +void configuration_save(void) { GKeyFile *config = g_key_file_new(); gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); @@ -744,7 +747,7 @@ static void load_ui_prefs(GKeyFile *config) /* * Save current session in default configuration file */ -void configuration_save_default_session() +void configuration_save_default_session(void) { gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); gchar *data; @@ -768,7 +771,7 @@ void configuration_save_default_session() /* * Only reload the session part of the default configuration */ -void configuration_reload_default_session() +void configuration_reload_default_session(void) { gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); GKeyFile *config = g_key_file_new(); @@ -782,7 +785,7 @@ void configuration_reload_default_session() } -gboolean configuration_load() +gboolean configuration_load(void) { gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); GKeyFile *config = g_key_file_new(); @@ -813,7 +816,7 @@ gboolean configuration_load() /* Open session files * Note: notebook page switch handler and adding to recent files list is always disabled * for all files opened within this function */ -gboolean configuration_open_files() +gboolean configuration_open_files(void) { gint i; guint pos; @@ -901,7 +904,7 @@ gboolean configuration_open_files() /* set some settings which are already read from the config file, but need other things, like the * realisation of the main window */ -void configuration_apply_settings() +void configuration_apply_settings(void) { if (scribble_text) { // update the scribble widget, because now it's realized @@ -936,7 +939,7 @@ static void generate_filetype_extensions(const gchar *output_dir); /* Generate the config files in "data/" from defaults */ -void configuration_generate_data_files() +void configuration_generate_data_files(void) { gchar *cur_dir, *gen_dir; @@ -997,7 +1000,7 @@ static void generate_filetype_extensions(const gchar *output_dir) #endif -void configuration_read_filetype_extensions() +void configuration_read_filetype_extensions(void) { guint i; gsize len = 0; @@ -1034,7 +1037,7 @@ void configuration_read_filetype_extensions() } -void configuration_read_snippets() +void configuration_read_snippets(void) { gsize i, j, len = 0, len_keys = 0; gchar *sysconfigfile, *userconfigfile; diff --git a/src/keyfile.h b/src/keyfile.h index 50535d89..c0cfd781 100644 --- a/src/keyfile.h +++ b/src/keyfile.h @@ -26,31 +26,31 @@ #define GEANY_KEYFILE_H 1 -void configuration_save(); +void configuration_save(void); -gboolean configuration_load(); +gboolean configuration_load(void); -gboolean configuration_open_files(); +gboolean configuration_open_files(void); -void configuration_reload_default_session(); +void configuration_reload_default_session(void); -void configuration_save_default_session(); +void configuration_save_default_session(void); void configuration_load_session_files(GKeyFile *config); void configuration_save_session_files(GKeyFile *config); -void configuration_read_filetype_extensions(); +void configuration_read_filetype_extensions(void); -void configuration_read_snippets(); +void configuration_read_snippets(void); /* set some settings which are already read from the config file, but need other things, like the * realisation of the main window */ -void configuration_apply_settings(); +void configuration_apply_settings(void); #ifdef GEANY_DEBUG /* Generate the config files in "data/" from defaults */ -void configuration_generate_data_files(); +void configuration_generate_data_files(void); #endif #endif diff --git a/src/main.c b/src/main.c index 4699364a..7834c371 100644 --- a/src/main.c +++ b/src/main.c @@ -419,7 +419,7 @@ static void get_line_and_column_from_filename(gchar *filename, gint *line, gint } -static void setup_paths() +static void setup_paths(void) { gchar *data_dir; gchar *doc_dir; @@ -448,7 +448,7 @@ static void setup_paths() } -static void locale_init() +static void locale_init(void) { #ifdef ENABLE_NLS gchar *locale_dir = NULL; @@ -615,7 +615,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv) // Returns 0 if config dir is OK. -static gint setup_config_dir() +static gint setup_config_dir(void) { gint mkdir_result = 0; gchar *tmp = app->configdir; @@ -705,7 +705,7 @@ static gboolean open_cl_files(gint argc, gchar **argv) } -static void load_project_file() +static void load_project_file(void) { gchar *locale_filename; @@ -721,7 +721,7 @@ static void load_project_file() } -static void load_settings() +static void load_settings(void) { configuration_load(); // let cmdline options overwrite configuration settings diff --git a/src/main.h b/src/main.h index 5cbfc826..b07df365 100644 --- a/src/main.h +++ b/src/main.h @@ -49,6 +49,6 @@ extern GeanyStatus main_status; gchar *get_argv_filename(const gchar *filename); -void main_quit(); +void main_quit(void); #endif diff --git a/src/msgwindow.c b/src/msgwindow.c index 363cb512..a6d99d74 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -595,7 +595,10 @@ static void parse_file_line(ParseData *data, gchar **filename, gint *line) * *filename must be freed unless it is NULL. */ void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gchar **filename, gint *line) { - ParseData data = {string, build_info.dir, NULL, 0, 0, 0}; + ParseData data = {NULL, NULL, NULL, 0, 0, 0}; + + data.string = string; + data.dir = build_info.dir; *filename = NULL; *line = -1; diff --git a/src/msgwindow.h b/src/msgwindow.h index 7bd5ec78..a25bf6f3 100644 --- a/src/msgwindow.h +++ b/src/msgwindow.h @@ -40,7 +40,7 @@ typedef enum MSG_COMPILER, MSG_MESSAGE, MSG_SCRATCH, - MSG_VTE, + MSG_VTE } MessageWindowTabNum; @@ -63,9 +63,9 @@ typedef struct extern MessageWindow msgwindow; -void msgwin_init(); +void msgwin_init(void); -void msgwin_finalize(); +void msgwin_finalize(void); void msgwin_show_hide(gboolean show); @@ -87,11 +87,11 @@ void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2); void msgwin_menu_add_common_items(GtkMenu *menu); -gboolean msgwin_goto_compiler_file_line(); +gboolean msgwin_goto_compiler_file_line(void); void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gchar **filename, gint *line); -gboolean msgwin_goto_messages_file_line(); +gboolean msgwin_goto_messages_file_line(void); #endif diff --git a/src/navqueue.c b/src/navqueue.c index 698d4589..c54127b2 100644 --- a/src/navqueue.c +++ b/src/navqueue.c @@ -71,7 +71,7 @@ void navqueue_free() } -static void adjust_buttons() +static void adjust_buttons(void) { if (g_queue_get_length(navigation_queue) < 2) { diff --git a/src/navqueue.h b/src/navqueue.h index 95da2ddb..817c6aff 100644 --- a/src/navqueue.h +++ b/src/navqueue.h @@ -27,16 +27,16 @@ #define GEANY_NAVQUEUE_H 1 -void navqueue_init(); +void navqueue_init(void); -void navqueue_free(); +void navqueue_free(void); gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line); -void navqueue_go_back(); +void navqueue_go_back(void); -void navqueue_go_forward(); +void navqueue_go_forward(void); #endif diff --git a/src/notebook.c b/src/notebook.c index e10b407a..2bb14443 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -74,7 +74,7 @@ notebook_find_tab_num_at_pos(GtkNotebook *notebook, gint x, gint y); static void notebook_tab_close_clicked_cb(GtkButton *button, gpointer user_data); -static void setup_tab_dnd(); +static void setup_tab_dnd(void); static void focus_sci(GtkWidget *widget, gpointer user_data) @@ -280,7 +280,7 @@ notebook_find_tab_num_at_pos(GtkNotebook *notebook, gint x, gint y) // call this after the number of tabs in app->notebook changes. -static void tab_count_changed() +static void tab_count_changed(void) { switch (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook))) { diff --git a/src/notebook.h b/src/notebook.h index e0c5a102..ba755e30 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -24,7 +24,7 @@ #ifndef GEANY_NOTEBOOK_H #define GEANY_NOTEBOOK_H 1 -void notebook_init(); +void notebook_init(void); /* Returns page number of notebook page, or -1 on error */ gint notebook_new_tab(gint doc_idx); diff --git a/src/plugindata.h b/src/plugindata.h index f0a7ae52..5ea78bc4 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -72,7 +72,7 @@ PluginInfo; /* Sets the plugin name and a brief description of what it is. */ #define PLUGIN_INFO(p_name, p_description, p_version, p_author) \ - PluginInfo *info() \ + PluginInfo *info(void) \ { \ static PluginInfo p_info; \ \ @@ -160,10 +160,10 @@ typedef GeanyData PluginData; // for compatibility with API < 7 typedef struct DocumentFuncs { gint (*new_file) (const gchar *filename, struct filetype *ft, const gchar *text); - gint (*get_cur_idx) (); + gint (*get_cur_idx) (void); gint (*get_n_idx) (guint i); gint (*find_by_filename) (const gchar *filename, gboolean is_tm_filename); - struct document* (*get_current) (); + struct document* (*get_current) (void); gboolean (*save_file)(gint idx, gboolean force); gint (*open_file)(const gchar *locale_filename, gboolean readonly, struct filetype *ft, const gchar *forced_enc); @@ -262,7 +262,7 @@ typedef struct DialogFuncs { gboolean (*show_question) (const gchar *text, ...); void (*show_msgbox) (gint type, const gchar *text, ...); - gboolean (*show_save_as) (); + gboolean (*show_save_as) (void); } DialogFuncs; diff --git a/src/plugins.c b/src/plugins.c index 679f9b6d..80707e39 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -73,10 +73,10 @@ typedef struct Plugin gulong *signal_ids; // signal IDs to disconnect when unloading gsize signal_ids_len; - PluginInfo* (*info) (); /* Returns plugin name, description */ + PluginInfo* (*info) (void); /* Returns plugin name, description */ void (*init) (GeanyData *data); /* Called when the plugin is enabled */ void (*configure) (GtkWidget *parent); /* plugin configure dialog, optionally */ - void (*cleanup) (); /* Called when the plugin is disabled or when Geany exits */ + void (*cleanup) (void); /* Called when the plugin is disabled or when Geany exits */ } Plugin; @@ -240,7 +240,7 @@ static GeanyData geany_data = { static void -geany_data_init() +geany_data_init(void) { geany_data.app = app; geany_data.tools_menu = lookup_widget(app->window, "tools1_menu"); @@ -387,7 +387,7 @@ plugin_new(const gchar *fname) { Plugin *plugin; GModule *module; - PluginInfo* (*info)(); + PluginInfo* (*info)(void); PluginFields **plugin_fields; GeanyData **p_geany_data; @@ -554,7 +554,7 @@ static gchar *get_plugin_path() #endif -static void load_plugin_paths() +static void load_plugin_paths(void) { gchar *path; @@ -650,7 +650,7 @@ void plugins_update_document_sensitive(gboolean enabled) static gint plugin_has_menu(Plugin *a, Plugin *b) { - if (((PluginFields)a->fields).menu_item != NULL) + if (a->fields.menu_item != NULL) return 0; return 1; diff --git a/src/plugins.h b/src/plugins.h index b709325e..8a4b35ca 100644 --- a/src/plugins.h +++ b/src/plugins.h @@ -28,13 +28,13 @@ #ifdef HAVE_PLUGINS -void plugins_init(); +void plugins_init(void); -void plugins_free(); +void plugins_free(void); -void plugins_create_active_list(); +void plugins_create_active_list(void); -void plugins_update_tools_menu(); +void plugins_update_tools_menu(void); void plugins_update_document_sensitive(gboolean enabled); diff --git a/src/prefix.c b/src/prefix.c index db67ee62..e7c39385 100644 --- a/src/prefix.c +++ b/src/prefix.c @@ -287,4 +287,8 @@ br_prepend_prefix (void *symbol, char *path) return newpath; } +#else /* ENABLE_BINRELOC */ + +typedef int iso_c_forbids_an_empty_source_file; + #endif /* ENABLE_BINRELOC */ diff --git a/src/prefs.c b/src/prefs.c index 0e405d1b..1a5292a7 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -87,10 +87,10 @@ enum { KB_TREE_ACTION, KB_TREE_SHORTCUT, - KB_TREE_INDEX, + KB_TREE_INDEX }; -static void init_kb_tree() +static void init_kb_tree(void) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -124,7 +124,7 @@ static void init_kb_tree() } -static void init_keybindings() +static void init_keybindings(void) { GtkTreeIter parent, iter; gint i; diff --git a/src/project.c b/src/project.c index 82902670..990acee2 100644 --- a/src/project.c +++ b/src/project.c @@ -75,7 +75,7 @@ typedef struct _PropertyDialogElements static gboolean update_config(const PropertyDialogElements *e); static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElements *e); static void on_file_open_button_clicked(GtkButton *button, PropertyDialogElements *e); -static gboolean close_open_project(); +static gboolean close_open_project(void); static gboolean load_config(const gchar *filename); static gboolean write_config(gboolean emit_signal); static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e); @@ -299,7 +299,7 @@ void project_open() // Called when opening, closing and updating projects. -static void update_ui() +static void update_ui(void) { ui_set_window_title(-1); build_menu_update(-1); diff --git a/src/project.h b/src/project.h index 11e455ce..a6b1b62a 100644 --- a/src/project.h +++ b/src/project.h @@ -54,28 +54,28 @@ typedef struct extern ProjectPrefs project_prefs; -void project_new(); +void project_new(void); -void project_open(); +void project_open(void); void project_close(gboolean open_default); -void project_properties(); +void project_properties(void); gboolean project_load_file(const gchar *locale_file_name); -gchar *project_get_base_path(); +gchar *project_get_base_path(void); -gchar *project_get_make_dir(); +gchar *project_get_make_dir(void); void project_save_prefs(GKeyFile *config); void project_load_prefs(GKeyFile *config); -void project_setup_prefs(); +void project_setup_prefs(void); -void project_apply_prefs(); +void project_apply_prefs(void); #endif diff --git a/src/sciwrappers.c b/src/sciwrappers.c index c20eead9..ab36e7f4 100644 --- a/src/sciwrappers.c +++ b/src/sciwrappers.c @@ -807,7 +807,7 @@ void sci_target_end(ScintillaObject *sci, gint end) gint sci_target_replace(ScintillaObject *sci, const gchar *text, gboolean regex) { - return SSM(sci, (regex) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET, -1, (sptr_t) text); + return SSM(sci, (regex) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET, (uptr_t) -1, (sptr_t) text); } diff --git a/src/search.c b/src/search.c index c228a934..7415031a 100644 --- a/src/search.c +++ b/src/search.c @@ -108,7 +108,7 @@ static gboolean search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *opts); -void search_init() +void search_init(void) { widgets.find_dialog = NULL; widgets.replace_dialog = NULL; @@ -120,7 +120,7 @@ void search_init() #define FREE_WIDGET(wid) \ if (wid && GTK_IS_WIDGET(wid)) gtk_widget_destroy(wid); -void search_finalize() +void search_finalize(void) { FREE_WIDGET(widgets.find_dialog); FREE_WIDGET(widgets.replace_dialog); @@ -257,7 +257,7 @@ void search_find_selection(gint idx, gboolean search_backwards) } -void search_show_find_dialog() +void search_show_find_dialog(void) { gint idx = document_get_cur_idx(); gchar *sel = NULL; @@ -376,7 +376,7 @@ static void send_replace_dialog_response(GtkButton *button, gpointer user_data) } -void search_show_replace_dialog() +void search_show_replace_dialog(void) { gint idx = document_get_cur_idx(); gchar *sel = NULL; @@ -1012,7 +1012,7 @@ on_widget_key_pressed_set_focus(GtkWidget *widget, GdkEventKey *event, gpointer } -static GString *get_grep_options() +static GString *get_grep_options(void) { gboolean fgrep = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( lookup_widget(widgets.find_in_files_dialog, "radio_fgrep"))); diff --git a/src/search.h b/src/search.h index c825b711..4c889e40 100644 --- a/src/search.h +++ b/src/search.h @@ -47,13 +47,13 @@ typedef struct extern SearchPrefs search_prefs; -void search_init(); +void search_init(void); -void search_finalize(); +void search_finalize(void); -void search_show_find_dialog(); +void search_show_find_dialog(void); -void search_show_replace_dialog(); +void search_show_replace_dialog(void); void search_show_find_in_files_dialog(const gchar *dir); diff --git a/src/socket.c b/src/socket.c index 7cda96bb..3ee11244 100644 --- a/src/socket.c +++ b/src/socket.c @@ -91,10 +91,13 @@ #endif +struct socket_info_struct socket_info; + + #ifdef G_OS_WIN32 static gint socket_fd_connect_inet (gushort port); static gint socket_fd_open_inet (gushort port); -static void socket_init_win32(); +static void socket_init_win32 (void); #else static gint socket_fd_connect_unix (const gchar *path); static gint socket_fd_open_unix (const gchar *path); @@ -160,7 +163,7 @@ void send_open_command(gint sock, gint argc, gchar **argv) #ifndef G_OS_WIN32 -static void remove_socket_link_full() +static void remove_socket_link_full(void) { gchar real_path[512]; gsize len; @@ -457,7 +460,7 @@ static gint socket_fd_connect_inet(gushort port) } -static void socket_init_win32() +static void socket_init_win32(void) { WSADATA wsadata; diff --git a/src/socket.h b/src/socket.h index 9a1c1b96..8939d147 100644 --- a/src/socket.h +++ b/src/socket.h @@ -26,20 +26,22 @@ #define GEANY_SOCKET_H 1 -struct +struct socket_info_struct { gboolean ignore_socket; gchar *file_name; GIOChannel *read_ioc; gint lock_socket; gint lock_socket_tag; -} socket_info; +}; + +extern struct socket_info_struct socket_info; gint socket_init(gint argc, gchar **argv); gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpointer data); -gint socket_finalize(); +gint socket_finalize(void); #endif diff --git a/src/symbols.c b/src/symbols.c index 1e0e66db..b6671eb2 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -83,7 +83,7 @@ static TagFileInfo tag_file_info[GTF_MAX] = static gchar *user_tags_dir; -static void html_tags_loaded(); +static void html_tags_loaded(void); static void load_user_tags(filetype_id ft_id); /* tags_ignore is a NULL-terminated array of strings, read from ~/.geany/ignore.tags. @@ -91,7 +91,7 @@ static void load_user_tags(filetype_id ft_id); * by the C/C++ parser, see -I command line option of ctags for details. */ gchar **c_tags_ignore = NULL; -static void load_c_ignore_tags() +static void load_c_ignore_tags(void) { gchar *path = g_strconcat(app->configdir, G_DIR_SEPARATOR_S "ignore.tags", NULL); gchar *content; @@ -158,7 +158,7 @@ void symbols_global_tags_loaded(gint file_type_idx) // HTML tagfile is just a list of entities for autocompletion (e.g. '&') -static void html_tags_loaded() +static void html_tags_loaded(void) { TagFileInfo *tfi; @@ -244,7 +244,7 @@ const gchar *symbols_get_context_separator(gint ft_id) } -GString *symbols_get_macro_list() +GString *symbols_get_macro_list(void) { guint j, i; const GPtrArray *tags; @@ -319,7 +319,7 @@ static TMTag *find_workspace_tag(const gchar *tag_name, gint type) } -const gchar **symbols_get_html_entities() +const gchar **symbols_get_html_entities(void) { if (html_entities == NULL) html_tags_loaded(); // if not yet created, force creation of the array but shouldn't occur @@ -328,7 +328,7 @@ const gchar **symbols_get_html_entities() } -void symbols_finalize() +void symbols_finalize(void) { g_strfreev(html_entities); g_strfreev(c_tags_ignore); @@ -411,7 +411,7 @@ static const GList *get_tag_list(gint idx, guint tag_types, gboolean sort_by_nam if (tag->type & tag_types) { if (! doc_is_utf8) utf8_name = encodings_convert_to_utf8_from_charset(tag->name, - -1, doc_list[idx].encoding, TRUE); + (gsize)-1, doc_list[idx].encoding, TRUE); else utf8_name = tag->name; if (utf8_name == NULL) @@ -462,7 +462,7 @@ struct TreeviewSymbols } tv_iters; -static void init_tag_iters() +static void init_tag_iters(void) { // init all GtkTreeIters with -1 to make them invalid to avoid crashes when switching between // filetypes(e.g. config file to Python crashes Geany without this) @@ -965,7 +965,7 @@ int symbols_generate_global_tags(int argc, char **argv, gboolean want_preprocess } -void symbols_show_load_tags_dialog() +void symbols_show_load_tags_dialog(void) { GtkWidget *dialog; GtkFileFilter *filter; @@ -1037,7 +1037,7 @@ static GHashTable *get_tagfile_hash(const GSList *file_list) } -static GHashTable *init_user_tags() +static GHashTable *init_user_tags(void) { GSList *file_list; GHashTable *lang_hash; diff --git a/src/symbols.h b/src/symbols.h index 50031659..6eada385 100644 --- a/src/symbols.h +++ b/src/symbols.h @@ -37,17 +37,17 @@ const gchar *symbols_get_context_separator(gint ft_id); const GList *symbols_get_tag_list(gint idx, guint tag_types); -GString *symbols_get_macro_list(); +GString *symbols_get_macro_list(void); -const gchar **symbols_get_html_entities(); +const gchar **symbols_get_html_entities(void); -void symbols_finalize(); +void symbols_finalize(void); gboolean symbols_recreate_tag_list(gint idx, gboolean sort_by_name); gint symbols_generate_global_tags(gint argc, gchar **argv, gboolean want_preprocess); -void symbols_show_load_tags_dialog(); +void symbols_show_load_tags_dialog(void); gboolean symbols_goto_tag(const gchar *name, gboolean definition); diff --git a/src/templates.c b/src/templates.c index eda0aa5e..c5b089c4 100644 --- a/src/templates.c +++ b/src/templates.c @@ -333,7 +333,7 @@ on_new_with_template (GtkMenuItem *menuitem, // template items for the new file menu -static void create_new_menu_items() +static void create_new_menu_items(void) { GtkWidget *template_menu = lookup_widget(app->window, "menu_new_with_template1_menu"); filetype_id ft_id; diff --git a/src/tools.c b/src/tools.c index 5c9d96f5..da0d6ad8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -209,7 +209,7 @@ void tools_execute_custom_command(gint idx, const gchar *command) } -static void cc_show_dialog_custom_commands() +static void cc_show_dialog_custom_commands(void) { GtkWidget *dialog, *label, *vbox, *button; guint i; @@ -389,7 +389,7 @@ static void cc_insert_custom_command_items(GtkMenu *me, GtkMenu *mp, gchar *labe } -void tools_create_insert_custom_command_menu_items() +void tools_create_insert_custom_command_menu_items(void) { GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "send_selection_to2_menu")); GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "send_selection_to1_menu")); @@ -509,7 +509,7 @@ word_count(gchar *text, guint *chars, guint *lines, guint *words) } -void tools_word_count() +void tools_word_count(void) { GtkWidget *dialog, *label, *vbox, *table; gint idx; diff --git a/src/tools.h b/src/tools.h index 87912a31..a62ffb3c 100644 --- a/src/tools.h +++ b/src/tools.h @@ -25,12 +25,12 @@ #ifndef GEANY_TOOLS_H #define GEANY_TOOLS_H 1 -void tools_create_insert_custom_command_menu_items(); +void tools_create_insert_custom_command_menu_items(void); void tools_execute_custom_command(gint idx, const gchar *command); -void tools_word_count(); +void tools_word_count(void); void tools_color_chooser(gchar *color); diff --git a/src/treeviews.c b/src/treeviews.c index 8a0a2d98..914051d1 100644 --- a/src/treeviews.c +++ b/src/treeviews.c @@ -232,7 +232,7 @@ gboolean on_treeviews_tooltip_queried(GtkWidget *widget, gint x, gint y, gboolea /* does some preparing things to the open files list widget */ -static void prepare_openfiles() +static void prepare_openfiles(void) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -356,7 +356,7 @@ void treeviews_remove_document(gint idx) } -static void create_taglist_popup_menu() +static void create_taglist_popup_menu(void) { GtkWidget *item; @@ -423,7 +423,7 @@ static void on_list_symbol_activate(GtkCheckMenuItem *item, gpointer user_data) } -static void create_openfiles_popup_menu() +static void create_openfiles_popup_menu(void) { GtkWidget *item; diff --git a/src/treeviews.h b/src/treeviews.h index 3f22938a..547088e8 100644 --- a/src/treeviews.h +++ b/src/treeviews.h @@ -42,10 +42,10 @@ enum SYMBOLS_COLUMN_ICON, SYMBOLS_COLUMN_NAME, SYMBOLS_COLUMN_LINE, - SYMBOLS_N_COLUMNS, + SYMBOLS_N_COLUMNS }; -void treeviews_init(); +void treeviews_init(void); void treeviews_update_tag_list(gint idx, gboolean update); @@ -53,7 +53,7 @@ void treeviews_openfiles_add(gint idx); void treeviews_openfiles_update(gint idx); -void treeviews_openfiles_update_all(); +void treeviews_openfiles_update_all(void); void treeviews_select_openfiles_item(gint idx); diff --git a/src/ui_utils.c b/src/ui_utils.c index 0b34e739..876a7d1f 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -59,7 +59,7 @@ widgets; static gchar *menu_item_get_text(GtkMenuItem *menu_item); -static void update_recent_menu(); +static void update_recent_menu(void); static void recent_file_loaded(const gchar *utf8_filename); static void recent_file_activate_cb (GtkMenuItem *menuitem, @@ -262,7 +262,7 @@ void ui_set_editor_font(const gchar *font_name) } -void ui_set_fullscreen() +void ui_set_fullscreen(void) { if (ui_prefs.fullscreen) { @@ -361,7 +361,7 @@ void ui_update_insert_include_item(gint idx, gint item) } -void ui_update_fold_items() +void ui_update_fold_items(void) { ui_widget_show_hide(lookup_widget(app->window, "menu_fold_all1"), editor_prefs.folding); ui_widget_show_hide(lookup_widget(app->window, "menu_unfold_all1"), editor_prefs.folding); @@ -403,7 +403,7 @@ static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gch } -void ui_create_insert_menu_items() +void ui_create_insert_menu_items(void) { GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "insert_include2_menu")); GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "insert_include1_menu")); @@ -470,7 +470,7 @@ static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label) } -void ui_create_insert_date_menu_items() +void ui_create_insert_date_menu_items(void) { GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "insert_date1_menu")); GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "insert_date2_menu")); @@ -542,7 +542,7 @@ void ui_save_buttons_toggle(gboolean enable) } -static void init_document_widgets() +static void init_document_widgets(void) { /* Cache the document-sensitive widgets so we don't have to keep looking them up * when using ui_document_buttons_update(). */ @@ -594,7 +594,7 @@ static void init_document_widgets() } -void ui_document_buttons_update() +void ui_document_buttons_update(void) { guint i; gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) ? TRUE : FALSE; @@ -621,7 +621,7 @@ void ui_widget_show_hide(GtkWidget *widget, gboolean show) } -void ui_sidebar_show_hide() +void ui_sidebar_show_hide(void) { GtkWidget *widget; @@ -720,7 +720,7 @@ void ui_update_toolbar_icons(GtkIconSize size) } -void ui_update_toolbar_items() +void ui_update_toolbar_items(void) { // show toolbar GtkWidget *widget = lookup_widget(app->window, "menu_show_toolbar1"); @@ -833,7 +833,7 @@ GtkWidget *ui_new_image_from_inline(gint img, gboolean small_img) } -void ui_create_recent_menu() +void ui_create_recent_menu(void) { GtkWidget *tmp; guint i; @@ -973,7 +973,7 @@ static void recent_file_loaded(const gchar *utf8_filename) } -static void update_recent_menu() +static void update_recent_menu(void) { GtkWidget *tmp; static GtkMenuToolButton *menu = NULL; @@ -1028,7 +1028,7 @@ static void update_recent_menu() } -void ui_show_markers_margin() +void ui_show_markers_margin(void) { gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); @@ -1040,7 +1040,7 @@ void ui_show_markers_margin() } -void ui_show_linenumber_margin() +void ui_show_linenumber_margin(void) { gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); @@ -1397,7 +1397,7 @@ void ui_table_add_row(GtkTable *table, gint row, ...) } -void ui_init() +void ui_init(void) { init_document_widgets(); } diff --git a/src/ui_utils.h b/src/ui_utils.h index 62584775..f01963c3 100644 --- a/src/ui_utils.h +++ b/src/ui_utils.h @@ -100,7 +100,7 @@ void ui_table_add_row(GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED; /* End of 'generic' functions */ -void ui_init(); +void ui_init(void); void ui_set_statusbar(gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3); @@ -113,7 +113,7 @@ void ui_set_window_title(gint index); void ui_set_editor_font(const gchar *font_name); -void ui_set_fullscreen(); +void ui_set_fullscreen(void); void ui_update_popup_reundo_items(gint idx); @@ -127,27 +127,27 @@ void ui_update_menu_copy_items(gint idx); void ui_update_insert_include_item(gint idx, gint item); -void ui_update_fold_items(); +void ui_update_fold_items(void); -void ui_create_insert_menu_items(); +void ui_create_insert_menu_items(void); -void ui_create_insert_date_menu_items(); +void ui_create_insert_date_menu_items(void); void ui_save_buttons_toggle(gboolean enable); -void ui_document_buttons_update(); +void ui_document_buttons_update(void); -void ui_sidebar_show_hide(); +void ui_sidebar_show_hide(void); void ui_document_show_hide(gint idx); void ui_update_toolbar_icons(GtkIconSize size); -void ui_update_toolbar_items(); +void ui_update_toolbar_items(void); GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img); @@ -155,20 +155,20 @@ GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img); GtkWidget *ui_new_image_from_inline(gint img, gboolean small_img); -void ui_create_recent_menu(); +void ui_create_recent_menu(void); void ui_add_recent_file(const gchar *utf8_filename); -void ui_show_markers_margin(); +void ui_show_markers_margin(void); -void ui_show_linenumber_margin(); +void ui_show_linenumber_margin(void); void ui_update_tab_status(gint idx); -typedef gboolean TVMatchCallback(); +typedef gboolean TVMatchCallback(void); gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb); diff --git a/src/utils.c b/src/utils.c index 2e85652f..1c79713d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -719,7 +719,7 @@ gchar utils_brace_opposite(gchar ch) } -gchar *utils_get_hostname() +gchar *utils_get_hostname(void) { #ifdef G_OS_WIN32 return win32_get_hostname(); @@ -769,7 +769,7 @@ gint utils_is_file_writeable(const gchar *locale_filename) # define DIR_SEP "" #endif -gint utils_make_settings_dir() +gint utils_make_settings_dir(void) { gint saved_errno = 0; gchar *conf_file = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL); @@ -1118,7 +1118,7 @@ gchar *utils_get_hex_from_color(GdkColor *color) /* Get directory from current file in the notebook. * Returns dir string that should be freed or NULL, depending on whether current file is valid. * Returned string is in UTF-8 encoding */ -gchar *utils_get_current_file_dir_utf8() +gchar *utils_get_current_file_dir_utf8(void) { gint cur_idx = document_get_cur_idx(); @@ -1139,7 +1139,7 @@ gchar *utils_get_current_file_dir_utf8() /* very simple convenience function */ -void utils_beep() +void utils_beep(void) { if (prefs.beep_on_errors) gdk_beep(); } @@ -1240,7 +1240,7 @@ gint utils_strtod(const gchar *source, gchar **end, gboolean with_route) // Returns: newly allocated string with the current time formatted HH:MM:SS. -gchar *utils_get_current_time_string() +gchar *utils_get_current_time_string(void) { const time_t tp = time(NULL); const struct tm *tmval = localtime(&tp); @@ -1778,7 +1778,7 @@ gboolean utils_string_replace_all(GString *haystack, const gchar *needle, const /* Get project or default startup directory (if set), or NULL. */ -const gchar *utils_get_default_dir_utf8() +const gchar *utils_get_default_dir_utf8(void) { if (app->project && NZV(app->project->base_path)) { diff --git a/src/utils.h b/src/utils.h index f4763135..ffe29186 100644 --- a/src/utils.h +++ b/src/utils.h @@ -82,9 +82,9 @@ gchar *utils_remove_ext_from_filename(const gchar *filename); gchar utils_brace_opposite(gchar ch); -gchar *utils_get_hostname(); +gchar *utils_get_hostname(void); -gint utils_make_settings_dir(); +gint utils_make_settings_dir(void); gboolean utils_string_replace_all(GString *str, const gchar *needle, const gchar *replace); @@ -108,18 +108,18 @@ void utils_replace_filename(gint idx); gchar *utils_get_hex_from_color(GdkColor *color); -const gchar *utils_get_default_dir_utf8(); +const gchar *utils_get_default_dir_utf8(void); -gchar *utils_get_current_file_dir_utf8(); +gchar *utils_get_current_file_dir_utf8(void); -void utils_beep(); +void utils_beep(void); gchar *utils_make_human_readable_str(unsigned long long size, gulong block_size, gulong display_unit); gint utils_strtod(const gchar *source, gchar **end, gboolean with_route); -gchar *utils_get_current_time_string(); +gchar *utils_get_current_time_string(void); GIOChannel *utils_set_up_io_channel(gint fd, GIOCondition cond, gboolean nblock, GIOFunc func, gpointer data); diff --git a/src/vte.c b/src/vte.c index bfb73ffc..0863c023 100644 --- a/src/vte.c +++ b/src/vte.c @@ -46,6 +46,7 @@ VteInfo vte_info; +VteConfig *vc; extern gchar **environ; static pid_t pid; @@ -63,7 +64,7 @@ static const gchar VTE_WORDCHARS[] = "-A-Za-z0-9,./?%&#:_"; #define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal)) #define VTE_TYPE_TERMINAL (vf->vte_terminal_get_type()) -static void create_vte(); +static void create_vte(void); static void vte_start(GtkWidget *widget); static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data); static gboolean vte_keyrelease(GtkWidget *widget, GdkEventKey *event, gpointer data); @@ -87,7 +88,7 @@ enum TARGET_TEXT, TARGET_COMPOUND_TEXT, TARGET_STRING, - TARGET_TEXT_PLAIN, + TARGET_TEXT_PLAIN }; static const GtkTargetEntry dnd_targets[] = @@ -140,7 +141,7 @@ static gchar **vte_get_child_environment(void) } -static void override_menu_key() +static void override_menu_key(void) { if (gtk_menu_key_accel == NULL) // for restoring the default value g_object_get(G_OBJECT(gtk_settings_get_default()), "gtk-menu-bar-accel", @@ -206,7 +207,7 @@ void vte_init(void) } -static void create_vte() +static void create_vte(void) { GtkWidget *vte, *scrollbar, *hbox, *frame; @@ -532,7 +533,7 @@ gboolean vte_send_cmd(const gchar *cmd) /* Taken from Terminal by os-cillation: terminal_screen_get_working_directory, thanks. * Determines the working directory using various OS-specific mechanisms. */ -const gchar* vte_get_working_directory() +const gchar* vte_get_working_directory(void) { gchar buffer[4096 + 1]; gchar *file; @@ -631,7 +632,7 @@ static void check_run_in_vte_toggled(GtkToggleButton *togglebutton, GtkWidget *u } -void vte_append_preferences_tab() +void vte_append_preferences_tab(void) { if (vte_info.have_vte) { diff --git a/src/vte.h b/src/vte.h index 6a6c40c9..d3efd2fe 100644 --- a/src/vte.h +++ b/src/vte.h @@ -63,7 +63,7 @@ typedef struct GdkColor *colour_fore; GdkColor *colour_back; } VteConfig; -VteConfig *vc; +extern VteConfig *vc; void vte_init(void); @@ -78,7 +78,7 @@ const gchar* vte_get_working_directory(void); void vte_cwd(const gchar *filename, gboolean force); -void vte_append_preferences_tab(); +void vte_append_preferences_tab(void); /* void vte_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, diff --git a/tagmanager/c.c b/tagmanager/c.c index 306512ed..26593155 100644 --- a/tagmanager/c.c +++ b/tagmanager/c.c @@ -434,7 +434,7 @@ static const char *getVarType (const statementInfo *const st); */ /* Debugging functions added by Biswa */ -#if DEBUG_C +#if defined(DEBUG_C) && DEBUG_C static char *tokenTypeName[] = { "none", "args", "'}'", "'{'", "','", "'::'", "keyword", "name", "package", "paren-name", "';'", "spec", "*", "[]", "count" diff --git a/tagmanager/docbook.c b/tagmanager/docbook.c index e787a638..b04b91e2 100644 --- a/tagmanager/docbook.c +++ b/tagmanager/docbook.c @@ -32,7 +32,7 @@ typedef enum { K_SECT1, K_SECT2, K_SECT3, - K_APPENDIX, + K_APPENDIX } docbookKind; static kindOption DocBookKinds [] = { diff --git a/tagmanager/haskell.c b/tagmanager/haskell.c index d7c2aec1..82fefc26 100644 --- a/tagmanager/haskell.c +++ b/tagmanager/haskell.c @@ -51,7 +51,7 @@ typedef const unsigned char *custr; */ -static void skip_rest_of_line() +static void skip_rest_of_line(void) { int c; do { @@ -71,7 +71,7 @@ static int get_line(char *buf) return i; } -static int get_next_char() +static int get_next_char(void) { int c, nxt; c = fileGetc(); diff --git a/tagmanager/include/tm_workspace.h b/tagmanager/include/tm_workspace.h index 92920cb6..bd554b17 100644 --- a/tagmanager/include/tm_workspace.h +++ b/tagmanager/include/tm_workspace.h @@ -56,7 +56,7 @@ typedef struct _TMWorkspace a workspace is created. Subsequent calls to the function will return the created workspace. */ -const TMWorkspace *tm_get_workspace(); +const TMWorkspace *tm_get_workspace(void); /*! Adds a work object (source file or project) to the workspace. \param work_object The work object to add to the project. diff --git a/tagmanager/sort.c b/tagmanager/sort.c index 9c7632f2..a46d23fc 100644 --- a/tagmanager/sort.c +++ b/tagmanager/sort.c @@ -111,7 +111,7 @@ static void failedSort (FILE *const fp, const char* msg) if (fp != NULL) fclose (fp); if (msg == NULL) - error (FATAL | PERROR, cannotSort); + error (FATAL | PERROR, "%s", cannotSort); else error (FATAL, "%s: %s", msg, cannotSort); } diff --git a/tagmanager/tm_workspace.c b/tagmanager/tm_workspace.c index 907542ed..21d00acc 100644 --- a/tagmanager/tm_workspace.c +++ b/tagmanager/tm_workspace.c @@ -29,7 +29,7 @@ static TMWorkspace *theWorkspace = NULL; guint workspace_class_id = 0; -static gboolean tm_create_workspace() +static gboolean tm_create_workspace(void) { workspace_class_id = tm_work_object_register(tm_workspace_free, tm_workspace_update , tm_workspace_find_object); @@ -709,7 +709,7 @@ tm_get_current_function (GPtrArray * file_tags, const gulong line) return function_tag; } return NULL; -}; +} const GPtrArray *tm_workspace_get_parents(const gchar *name)