lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
November 2022
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
8 discussions
Start a n
N
ew thread
[geany/geany-plugins] d86698: Add cppcheck custom config for missing GLib types
by Enrico Tröger
30 Nov '22
30 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Mon, 28 Nov 2022 18:25:33 UTC Commit: d86698b8f3ece409e85e69cc2daae2a0690e8f69
https://github.com/geany/geany-plugins/commit/d86698b8f3ece409e85e69cc2daae…
Log Message: ----------- Add cppcheck custom config for missing GLib types Also fix a couple of new findings with current cppcheck version. Closes #1196. Modified Paths: -------------- Makefile.am build/cppcheck-geany-plugins.cfg build/cppcheck.mk codenav/src/goto_file.c debugger/src/dbm_gdb.c debugger/src/debug.c geanyvc/src/utils.c geniuspaste/src/geniuspaste.c latex/src/latex.c treebrowser/src/treebrowser.c workbench/src/sidebar.c workbench/src/wb_project.c Modified: Makefile.am 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --install AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}' +EXTRA_DIST = build/cppcheck-geany-plugins.cfg + SUBDIRS = po if ENABLE_UTILSLIB Modified: build/cppcheck-geany-plugins.cfg 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<def format="2"> + <define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/> + <define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/> +</def> Modified: build/cppcheck.mk 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -4,6 +4,7 @@ if HAVE_CPPCHECK check-cppcheck: $(srcdir) $(CPPCHECK) \ -q --template gcc --error-exitcode=2 \ + --library=$(top_srcdir)/build/cppcheck-geany-plugins.cfg \ -I$(GEANY_INCLUDEDIR)/geany \ $(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \ $(srcdir) Modified: codenav/src/goto_file.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -151,7 +151,7 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) static GtkTreeModel *old_model = NULL; GtkTreeModel* completion_list; static gchar *curr_dir = NULL; - gchar *new_dir, *new_dir_path; + gchar *new_dir, *new_dir_path = NULL; const gchar *text; text = gtk_entry_get_text(entry); @@ -174,8 +174,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) new_dir = g_strndup (text, dir_sep+1); /* I've already inserted new model completion for sub-dir elements? */ if ( g_strcmp0 (new_dir, curr_dir) == 0 ) + { + g_free(new_dir); return; - + } if ( curr_dir != NULL ) g_free(curr_dir); @@ -188,14 +190,16 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) log_debug("New completion list!"); if ( g_path_is_absolute(new_dir) ) - new_dir_path = new_dir; + new_dir_path = g_strdup(new_dir); else new_dir_path = g_build_filename(directory_ref, new_dir, NULL); /* Build the new file list for completion */ completion_list = build_file_list(new_dir_path, new_dir); gtk_entry_completion_set_model (completion, completion_list); g_object_unref(completion_list); + + g_free(new_dir_path); } Modified: debugger/src/dbm_gdb.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -761,6 +761,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi { colorize_message((gchar*)iter->data); } + g_free(unescaped); } g_list_foreach(lines, (GFunc)g_free, NULL); g_list_free(lines); Modified: debugger/src/debug.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1101,6 +1101,8 @@ void debug_init(void) gtk_text_buffer_create_tag(buffer, "yellow", "foreground", "#FFFF00", NULL); gtk_text_buffer_create_tag(buffer, "brown", "foreground", "#BB8915", NULL); gtk_text_buffer_create_tag(buffer, "rose", "foreground", "#BA92B7", NULL); + + g_free(configfile); } /* Modified: geanyvc/src/utils.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,7 +43,10 @@ normpath(const gchar * filename) return g_strdup("."); v = g_strsplit_set(filename, "/\\", -1); if (!g_strv_length(v)) + { + g_strfreev(v); return g_strdup("."); + } out = g_malloc0(sizeof(gchar *) * (g_strv_length(v) + 2)); pout = out; Modified: geniuspaste/src/geniuspaste.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -102,6 +102,10 @@ PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, PLUGIN_NAME, PLUGIN_VERSION, "Enrico Trotta <enrico.trt(a)gmail.com>") +static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, + const gchar *main_text, + const gchar *secondary_markup, ...) G_GNUC_PRINTF (4, 5); + static void pastebin_free(Pastebin *pastebin) { g_key_file_free(pastebin->config); @@ -715,7 +719,6 @@ static void message_dialog_label_set_url_hook(GtkWidget *widget, gpointer data) } } -G_GNUC_PRINTF (4, 5) static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, const gchar *main_text, const gchar *secondary_markup, ...) Modified: latex/src/latex.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -599,7 +599,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi { gchar *buf, *construct; /* TODO: Make possible to have longer than a 50 chars environment */ - gchar env[50]; + gchar env[50] = { 0 }; gint line = sci_get_line_from_position(sci, pos - (editor_get_eol_char_len (editor) + 1)); gint line_len = sci_get_line_length(sci, line); gint i, start; Modified: treebrowser/src/treebrowser.c 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -362,23 +362,39 @@ check_hidden(const gchar *filename) base_name = g_path_get_basename(filename); if (EMPTY(base_name)) + { + g_free(base_name); return FALSE; + } if (CONFIG_SHOW_HIDDEN_FILES) + { + g_free(base_name); return FALSE; + } #ifdef G_OS_WIN32 if (win32_check_hidden(filename)) + { + g_free(base_name); return TRUE; + } #else if (base_name[0] == '.') + { + g_free(base_name); return TRUE; + } #endif len = strlen(base_name); if (base_name[len - 1] == '~') + { + g_free(base_name); return TRUE; + } + g_free(base_name); return FALSE; } Modified: workbench/src/sidebar.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -447,6 +447,7 @@ static void sidebar_add_file (WB_PROJECT *prj, WB_PROJECT_DIR *root, const gchar { g_object_unref(icon); } + g_free(name); } @@ -550,11 +551,14 @@ static gboolean sidebar_get_filepath_iter (WB_PROJECT *prj, WB_PROJECT_DIR *root part = g_strdup(&(filepath[len])); if (strlen(part) == 0) { + g_free(part); return FALSE; } parts = g_strsplit(part, G_DIR_SEPARATOR_S, -1); if (parts[0] == NULL) { + g_free(part); + g_strfreev(parts); return FALSE; } Modified: workbench/src/wb_project.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -1246,12 +1246,13 @@ gchar *wb_project_dir_get_info (WB_PROJECT_DIR *dir) **/ gchar *wb_project_get_info (WB_PROJECT *prj) { - GString *temp = g_string_new(NULL); + GString *temp = NULL; gchar *text; if (prj == NULL) return g_strdup(""); + temp = g_string_new(NULL); g_string_append_printf(temp, _("Project: %s\n"), wb_project_get_name(prj)); g_string_append_printf(temp, _("File: %s\n"), wb_project_get_filename(prj)); g_string_append_printf(temp, _("Number of Directories: %u\n"), g_slist_length(prj->directories)); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 0fd74d: Merge pull request #1197 from eht16/cppcheck_add_library_gtk
by Enrico Tröger
30 Nov '22
30 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: GitHub <noreply(a)github.com> Date: Mon, 28 Nov 2022 18:48:26 UTC Commit: 0fd74d766f231e2aa84ca67af4da4773552eceb6
https://github.com/geany/geany-plugins/commit/0fd74d766f231e2aa84ca67af4da4…
Log Message: ----------- Merge pull request #1197 from eht16/cppcheck_add_library_gtk Add --library=gtk to cppcheck Modified Paths: -------------- Makefile.am build/cppcheck-geany-plugins.cfg build/cppcheck.mk codenav/src/goto_file.c debugger/src/dbm_gdb.c debugger/src/debug.c geanyvc/src/utils.c geniuspaste/src/geniuspaste.c latex/src/latex.c treebrowser/src/treebrowser.c workbench/src/sidebar.c workbench/src/wb_project.c Modified: Makefile.am 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --install AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}' +EXTRA_DIST = build/cppcheck-geany-plugins.cfg + SUBDIRS = po if ENABLE_UTILSLIB Modified: build/cppcheck-geany-plugins.cfg 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<def format="2"> + <define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/> + <define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/> +</def> Modified: build/cppcheck.mk 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -4,6 +4,7 @@ if HAVE_CPPCHECK check-cppcheck: $(srcdir) $(CPPCHECK) \ -q --template gcc --error-exitcode=2 \ + --library=$(top_srcdir)/build/cppcheck-geany-plugins.cfg \ -I$(GEANY_INCLUDEDIR)/geany \ $(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \ $(srcdir) Modified: codenav/src/goto_file.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -151,7 +151,7 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) static GtkTreeModel *old_model = NULL; GtkTreeModel* completion_list; static gchar *curr_dir = NULL; - gchar *new_dir, *new_dir_path; + gchar *new_dir, *new_dir_path = NULL; const gchar *text; text = gtk_entry_get_text(entry); @@ -174,8 +174,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) new_dir = g_strndup (text, dir_sep+1); /* I've already inserted new model completion for sub-dir elements? */ if ( g_strcmp0 (new_dir, curr_dir) == 0 ) + { + g_free(new_dir); return; - + } if ( curr_dir != NULL ) g_free(curr_dir); @@ -188,14 +190,16 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) log_debug("New completion list!"); if ( g_path_is_absolute(new_dir) ) - new_dir_path = new_dir; + new_dir_path = g_strdup(new_dir); else new_dir_path = g_build_filename(directory_ref, new_dir, NULL); /* Build the new file list for completion */ completion_list = build_file_list(new_dir_path, new_dir); gtk_entry_completion_set_model (completion, completion_list); g_object_unref(completion_list); + + g_free(new_dir_path); } Modified: debugger/src/dbm_gdb.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -761,6 +761,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi { colorize_message((gchar*)iter->data); } + g_free(unescaped); } g_list_foreach(lines, (GFunc)g_free, NULL); g_list_free(lines); Modified: debugger/src/debug.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1101,6 +1101,8 @@ void debug_init(void) gtk_text_buffer_create_tag(buffer, "yellow", "foreground", "#FFFF00", NULL); gtk_text_buffer_create_tag(buffer, "brown", "foreground", "#BB8915", NULL); gtk_text_buffer_create_tag(buffer, "rose", "foreground", "#BA92B7", NULL); + + g_free(configfile); } /* Modified: geanyvc/src/utils.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,7 +43,10 @@ normpath(const gchar * filename) return g_strdup("."); v = g_strsplit_set(filename, "/\\", -1); if (!g_strv_length(v)) + { + g_strfreev(v); return g_strdup("."); + } out = g_malloc0(sizeof(gchar *) * (g_strv_length(v) + 2)); pout = out; Modified: geniuspaste/src/geniuspaste.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -102,6 +102,10 @@ PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, PLUGIN_NAME, PLUGIN_VERSION, "Enrico Trotta <enrico.trt(a)gmail.com>") +static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, + const gchar *main_text, + const gchar *secondary_markup, ...) G_GNUC_PRINTF (4, 5); + static void pastebin_free(Pastebin *pastebin) { g_key_file_free(pastebin->config); @@ -715,7 +719,6 @@ static void message_dialog_label_set_url_hook(GtkWidget *widget, gpointer data) } } -G_GNUC_PRINTF (4, 5) static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, const gchar *main_text, const gchar *secondary_markup, ...) Modified: latex/src/latex.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -599,7 +599,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi { gchar *buf, *construct; /* TODO: Make possible to have longer than a 50 chars environment */ - gchar env[50]; + gchar env[50] = { 0 }; gint line = sci_get_line_from_position(sci, pos - (editor_get_eol_char_len (editor) + 1)); gint line_len = sci_get_line_length(sci, line); gint i, start; Modified: treebrowser/src/treebrowser.c 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -362,23 +362,39 @@ check_hidden(const gchar *filename) base_name = g_path_get_basename(filename); if (EMPTY(base_name)) + { + g_free(base_name); return FALSE; + } if (CONFIG_SHOW_HIDDEN_FILES) + { + g_free(base_name); return FALSE; + } #ifdef G_OS_WIN32 if (win32_check_hidden(filename)) + { + g_free(base_name); return TRUE; + } #else if (base_name[0] == '.') + { + g_free(base_name); return TRUE; + } #endif len = strlen(base_name); if (base_name[len - 1] == '~') + { + g_free(base_name); return TRUE; + } + g_free(base_name); return FALSE; } Modified: workbench/src/sidebar.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -447,6 +447,7 @@ static void sidebar_add_file (WB_PROJECT *prj, WB_PROJECT_DIR *root, const gchar { g_object_unref(icon); } + g_free(name); } @@ -550,11 +551,14 @@ static gboolean sidebar_get_filepath_iter (WB_PROJECT *prj, WB_PROJECT_DIR *root part = g_strdup(&(filepath[len])); if (strlen(part) == 0) { + g_free(part); return FALSE; } parts = g_strsplit(part, G_DIR_SEPARATOR_S, -1); if (parts[0] == NULL) { + g_free(part); + g_strfreev(parts); return FALSE; } Modified: workbench/src/wb_project.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -1246,12 +1246,13 @@ gchar *wb_project_dir_get_info (WB_PROJECT_DIR *dir) **/ gchar *wb_project_get_info (WB_PROJECT *prj) { - GString *temp = g_string_new(NULL); + GString *temp = NULL; gchar *text; if (prj == NULL) return g_strdup(""); + temp = g_string_new(NULL); g_string_append_printf(temp, _("Project: %s\n"), wb_project_get_name(prj)); g_string_append_printf(temp, _("File: %s\n"), wb_project_get_filename(prj)); g_string_append_printf(temp, _("Number of Directories: %u\n"), g_slist_length(prj->directories)); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 0fd74d: Merge pull request #1197 from eht16/cppcheck_add_library_gtk
by Enrico Tröger
28 Nov '22
28 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: GitHub <noreply(a)github.com> Date: Mon, 28 Nov 2022 18:48:26 UTC Commit: 0fd74d766f231e2aa84ca67af4da4773552eceb6
https://github.com/geany/geany-plugins/commit/0fd74d766f231e2aa84ca67af4da4…
Log Message: ----------- Merge pull request #1197 from eht16/cppcheck_add_library_gtk Add --library=gtk to cppcheck Modified Paths: -------------- Makefile.am build/cppcheck-geany-plugins.cfg build/cppcheck.mk codenav/src/goto_file.c debugger/src/dbm_gdb.c debugger/src/debug.c geanyvc/src/utils.c geniuspaste/src/geniuspaste.c latex/src/latex.c treebrowser/src/treebrowser.c workbench/src/sidebar.c workbench/src/wb_project.c Modified: Makefile.am 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --install AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}' +EXTRA_DIST = build/cppcheck-geany-plugins.cfg + SUBDIRS = po if ENABLE_UTILSLIB Modified: build/cppcheck-geany-plugins.cfg 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<def format="2"> + <define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/> + <define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/> +</def> Modified: build/cppcheck.mk 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -4,6 +4,7 @@ if HAVE_CPPCHECK check-cppcheck: $(srcdir) $(CPPCHECK) \ -q --template gcc --error-exitcode=2 \ + --library=$(top_srcdir)/build/cppcheck-geany-plugins.cfg \ -I$(GEANY_INCLUDEDIR)/geany \ $(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \ $(srcdir) Modified: codenav/src/goto_file.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -151,7 +151,7 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) static GtkTreeModel *old_model = NULL; GtkTreeModel* completion_list; static gchar *curr_dir = NULL; - gchar *new_dir, *new_dir_path; + gchar *new_dir, *new_dir_path = NULL; const gchar *text; text = gtk_entry_get_text(entry); @@ -174,8 +174,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) new_dir = g_strndup (text, dir_sep+1); /* I've already inserted new model completion for sub-dir elements? */ if ( g_strcmp0 (new_dir, curr_dir) == 0 ) + { + g_free(new_dir); return; - + } if ( curr_dir != NULL ) g_free(curr_dir); @@ -188,14 +190,16 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) log_debug("New completion list!"); if ( g_path_is_absolute(new_dir) ) - new_dir_path = new_dir; + new_dir_path = g_strdup(new_dir); else new_dir_path = g_build_filename(directory_ref, new_dir, NULL); /* Build the new file list for completion */ completion_list = build_file_list(new_dir_path, new_dir); gtk_entry_completion_set_model (completion, completion_list); g_object_unref(completion_list); + + g_free(new_dir_path); } Modified: debugger/src/dbm_gdb.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -761,6 +761,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi { colorize_message((gchar*)iter->data); } + g_free(unescaped); } g_list_foreach(lines, (GFunc)g_free, NULL); g_list_free(lines); Modified: debugger/src/debug.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1101,6 +1101,8 @@ void debug_init(void) gtk_text_buffer_create_tag(buffer, "yellow", "foreground", "#FFFF00", NULL); gtk_text_buffer_create_tag(buffer, "brown", "foreground", "#BB8915", NULL); gtk_text_buffer_create_tag(buffer, "rose", "foreground", "#BA92B7", NULL); + + g_free(configfile); } /* Modified: geanyvc/src/utils.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,7 +43,10 @@ normpath(const gchar * filename) return g_strdup("."); v = g_strsplit_set(filename, "/\\", -1); if (!g_strv_length(v)) + { + g_strfreev(v); return g_strdup("."); + } out = g_malloc0(sizeof(gchar *) * (g_strv_length(v) + 2)); pout = out; Modified: geniuspaste/src/geniuspaste.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -102,6 +102,10 @@ PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, PLUGIN_NAME, PLUGIN_VERSION, "Enrico Trotta <enrico.trt(a)gmail.com>") +static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, + const gchar *main_text, + const gchar *secondary_markup, ...) G_GNUC_PRINTF (4, 5); + static void pastebin_free(Pastebin *pastebin) { g_key_file_free(pastebin->config); @@ -715,7 +719,6 @@ static void message_dialog_label_set_url_hook(GtkWidget *widget, gpointer data) } } -G_GNUC_PRINTF (4, 5) static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, const gchar *main_text, const gchar *secondary_markup, ...) Modified: latex/src/latex.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -599,7 +599,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi { gchar *buf, *construct; /* TODO: Make possible to have longer than a 50 chars environment */ - gchar env[50]; + gchar env[50] = { 0 }; gint line = sci_get_line_from_position(sci, pos - (editor_get_eol_char_len (editor) + 1)); gint line_len = sci_get_line_length(sci, line); gint i, start; Modified: treebrowser/src/treebrowser.c 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -362,23 +362,39 @@ check_hidden(const gchar *filename) base_name = g_path_get_basename(filename); if (EMPTY(base_name)) + { + g_free(base_name); return FALSE; + } if (CONFIG_SHOW_HIDDEN_FILES) + { + g_free(base_name); return FALSE; + } #ifdef G_OS_WIN32 if (win32_check_hidden(filename)) + { + g_free(base_name); return TRUE; + } #else if (base_name[0] == '.') + { + g_free(base_name); return TRUE; + } #endif len = strlen(base_name); if (base_name[len - 1] == '~') + { + g_free(base_name); return TRUE; + } + g_free(base_name); return FALSE; } Modified: workbench/src/sidebar.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -447,6 +447,7 @@ static void sidebar_add_file (WB_PROJECT *prj, WB_PROJECT_DIR *root, const gchar { g_object_unref(icon); } + g_free(name); } @@ -550,11 +551,14 @@ static gboolean sidebar_get_filepath_iter (WB_PROJECT *prj, WB_PROJECT_DIR *root part = g_strdup(&(filepath[len])); if (strlen(part) == 0) { + g_free(part); return FALSE; } parts = g_strsplit(part, G_DIR_SEPARATOR_S, -1); if (parts[0] == NULL) { + g_free(part); + g_strfreev(parts); return FALSE; } Modified: workbench/src/wb_project.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -1246,12 +1246,13 @@ gchar *wb_project_dir_get_info (WB_PROJECT_DIR *dir) **/ gchar *wb_project_get_info (WB_PROJECT *prj) { - GString *temp = g_string_new(NULL); + GString *temp = NULL; gchar *text; if (prj == NULL) return g_strdup(""); + temp = g_string_new(NULL); g_string_append_printf(temp, _("Project: %s\n"), wb_project_get_name(prj)); g_string_append_printf(temp, _("File: %s\n"), wb_project_get_filename(prj)); g_string_append_printf(temp, _("Number of Directories: %u\n"), g_slist_length(prj->directories)); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] d86698: Add cppcheck custom config for missing GLib types
by Enrico Tröger
28 Nov '22
28 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Mon, 28 Nov 2022 18:25:33 UTC Commit: d86698b8f3ece409e85e69cc2daae2a0690e8f69
https://github.com/geany/geany-plugins/commit/d86698b8f3ece409e85e69cc2daae…
Log Message: ----------- Add cppcheck custom config for missing GLib types Also fix a couple of new findings with current cppcheck version. Closes #1196. Modified Paths: -------------- Makefile.am build/cppcheck-geany-plugins.cfg build/cppcheck.mk codenav/src/goto_file.c debugger/src/dbm_gdb.c debugger/src/debug.c geanyvc/src/utils.c geniuspaste/src/geniuspaste.c latex/src/latex.c treebrowser/src/treebrowser.c workbench/src/sidebar.c workbench/src/wb_project.c Modified: Makefile.am 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --install AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}' +EXTRA_DIST = build/cppcheck-geany-plugins.cfg + SUBDIRS = po if ENABLE_UTILSLIB Modified: build/cppcheck-geany-plugins.cfg 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<def format="2"> + <define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/> + <define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/> +</def> Modified: build/cppcheck.mk 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -4,6 +4,7 @@ if HAVE_CPPCHECK check-cppcheck: $(srcdir) $(CPPCHECK) \ -q --template gcc --error-exitcode=2 \ + --library=$(top_srcdir)/build/cppcheck-geany-plugins.cfg \ -I$(GEANY_INCLUDEDIR)/geany \ $(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \ $(srcdir) Modified: codenav/src/goto_file.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -151,7 +151,7 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) static GtkTreeModel *old_model = NULL; GtkTreeModel* completion_list; static gchar *curr_dir = NULL; - gchar *new_dir, *new_dir_path; + gchar *new_dir, *new_dir_path = NULL; const gchar *text; text = gtk_entry_get_text(entry); @@ -174,8 +174,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) new_dir = g_strndup (text, dir_sep+1); /* I've already inserted new model completion for sub-dir elements? */ if ( g_strcmp0 (new_dir, curr_dir) == 0 ) + { + g_free(new_dir); return; - + } if ( curr_dir != NULL ) g_free(curr_dir); @@ -188,14 +190,16 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion) log_debug("New completion list!"); if ( g_path_is_absolute(new_dir) ) - new_dir_path = new_dir; + new_dir_path = g_strdup(new_dir); else new_dir_path = g_build_filename(directory_ref, new_dir, NULL); /* Build the new file list for completion */ completion_list = build_file_list(new_dir_path, new_dir); gtk_entry_completion_set_model (completion, completion_list); g_object_unref(completion_list); + + g_free(new_dir_path); } Modified: debugger/src/dbm_gdb.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -761,6 +761,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi { colorize_message((gchar*)iter->data); } + g_free(unescaped); } g_list_foreach(lines, (GFunc)g_free, NULL); g_list_free(lines); Modified: debugger/src/debug.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -1101,6 +1101,8 @@ void debug_init(void) gtk_text_buffer_create_tag(buffer, "yellow", "foreground", "#FFFF00", NULL); gtk_text_buffer_create_tag(buffer, "brown", "foreground", "#BB8915", NULL); gtk_text_buffer_create_tag(buffer, "rose", "foreground", "#BA92B7", NULL); + + g_free(configfile); } /* Modified: geanyvc/src/utils.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -43,7 +43,10 @@ normpath(const gchar * filename) return g_strdup("."); v = g_strsplit_set(filename, "/\\", -1); if (!g_strv_length(v)) + { + g_strfreev(v); return g_strdup("."); + } out = g_malloc0(sizeof(gchar *) * (g_strv_length(v) + 2)); pout = out; Modified: geniuspaste/src/geniuspaste.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -102,6 +102,10 @@ PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, PLUGIN_NAME, PLUGIN_VERSION, "Enrico Trotta <enrico.trt(a)gmail.com>") +static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, + const gchar *main_text, + const gchar *secondary_markup, ...) G_GNUC_PRINTF (4, 5); + static void pastebin_free(Pastebin *pastebin) { g_key_file_free(pastebin->config); @@ -715,7 +719,6 @@ static void message_dialog_label_set_url_hook(GtkWidget *widget, gpointer data) } } -G_GNUC_PRINTF (4, 5) static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, const gchar *main_text, const gchar *secondary_markup, ...) Modified: latex/src/latex.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -599,7 +599,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi { gchar *buf, *construct; /* TODO: Make possible to have longer than a 50 chars environment */ - gchar env[50]; + gchar env[50] = { 0 }; gint line = sci_get_line_from_position(sci, pos - (editor_get_eol_char_len (editor) + 1)); gint line_len = sci_get_line_length(sci, line); gint i, start; Modified: treebrowser/src/treebrowser.c 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -362,23 +362,39 @@ check_hidden(const gchar *filename) base_name = g_path_get_basename(filename); if (EMPTY(base_name)) + { + g_free(base_name); return FALSE; + } if (CONFIG_SHOW_HIDDEN_FILES) + { + g_free(base_name); return FALSE; + } #ifdef G_OS_WIN32 if (win32_check_hidden(filename)) + { + g_free(base_name); return TRUE; + } #else if (base_name[0] == '.') + { + g_free(base_name); return TRUE; + } #endif len = strlen(base_name); if (base_name[len - 1] == '~') + { + g_free(base_name); return TRUE; + } + g_free(base_name); return FALSE; } Modified: workbench/src/sidebar.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -447,6 +447,7 @@ static void sidebar_add_file (WB_PROJECT *prj, WB_PROJECT_DIR *root, const gchar { g_object_unref(icon); } + g_free(name); } @@ -550,11 +551,14 @@ static gboolean sidebar_get_filepath_iter (WB_PROJECT *prj, WB_PROJECT_DIR *root part = g_strdup(&(filepath[len])); if (strlen(part) == 0) { + g_free(part); return FALSE; } parts = g_strsplit(part, G_DIR_SEPARATOR_S, -1); if (parts[0] == NULL) { + g_free(part); + g_strfreev(parts); return FALSE; } Modified: workbench/src/wb_project.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -1246,12 +1246,13 @@ gchar *wb_project_dir_get_info (WB_PROJECT_DIR *dir) **/ gchar *wb_project_get_info (WB_PROJECT *prj) { - GString *temp = g_string_new(NULL); + GString *temp = NULL; gchar *text; if (prj == NULL) return g_strdup(""); + temp = g_string_new(NULL); g_string_append_printf(temp, _("Project: %s\n"), wb_project_get_name(prj)); g_string_append_printf(temp, _("File: %s\n"), wb_project_get_filename(prj)); g_string_append_printf(temp, _("Number of Directories: %u\n"), g_slist_length(prj->directories)); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] fd42f7: TreeBrowser: Fix refresh from popup menu with a selected file
by Enrico Tröger
13 Nov '22
13 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Sun, 11 Sep 2022 15:26:17 UTC Commit: fd42f7e1b8eaf1c0d12ae86cfd91025c0e77b1f4
https://github.com/geany/geany-plugins/commit/fd42f7e1b8eaf1c0d12ae86cfd910…
Log Message: ----------- TreeBrowser: Fix refresh from popup menu with a selected file Closes #1194. Modified Paths: -------------- treebrowser/src/treebrowser.c Modified: treebrowser/src/treebrowser.c 23 lines changed, 21 insertions(+), 2 deletions(-) =================================================================== @@ -1163,15 +1163,34 @@ static void on_menu_refresh(GtkMenuItem *menuitem, gpointer *user_data) { GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - GtkTreeIter iter; + GtkTreeIter iter, parent_iter; + GtkTreeIter *target_iter = NULL; GtkTreeModel *model; gchar *uri; if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, TREEBROWSER_COLUMN_URI, &uri, -1); + /* if a directory is selected, use it directly for treebrowser_browse() + * if a file within a directory is selected, use its parent for treebrowser_browse() + * if a file on the top level is selected, use *no* parent for treebrowser_browse() */ if (g_file_test(uri, G_FILE_TEST_IS_DIR)) - treebrowser_browse(uri, &iter); + target_iter = &iter; + else + { + if (gtk_tree_model_iter_parent(model, &parent_iter, &iter)) + { + g_free(uri); + gtk_tree_model_get(model, &iter, TREEBROWSER_COLUMN_URI, &uri, -1); + target_iter = &parent_iter; + } + else + { + SETPTR(uri, g_path_get_dirname(uri)); + target_iter = NULL; + } + } + treebrowser_browse(uri, target_iter); g_free(uri); } else -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 38def1: Merge pull request #1195 from eht16/issue1194_treebrowser_refresh
by Enrico Tröger
13 Nov '22
13 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 13 Nov 2022 12:50:50 UTC Commit: 38def100f9c8cf214101d716f977ff8b2d1e44a1
https://github.com/geany/geany-plugins/commit/38def100f9c8cf214101d716f977f…
Log Message: ----------- Merge pull request #1195 from eht16/issue1194_treebrowser_refresh TreeBrowser: Fix refresh from popup menu with a selected file Modified Paths: -------------- treebrowser/src/treebrowser.c Modified: treebrowser/src/treebrowser.c 23 lines changed, 21 insertions(+), 2 deletions(-) =================================================================== @@ -1148,15 +1148,34 @@ static void on_menu_refresh(GtkMenuItem *menuitem, gpointer *user_data) { GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - GtkTreeIter iter; + GtkTreeIter iter, parent_iter; + GtkTreeIter *target_iter = NULL; GtkTreeModel *model; gchar *uri; if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, TREEBROWSER_COLUMN_URI, &uri, -1); + /* if a directory is selected, use it directly for treebrowser_browse() + * if a file within a directory is selected, use its parent for treebrowser_browse() + * if a file on the top level is selected, use *no* parent for treebrowser_browse() */ if (g_file_test(uri, G_FILE_TEST_IS_DIR)) - treebrowser_browse(uri, &iter); + target_iter = &iter; + else + { + if (gtk_tree_model_iter_parent(model, &parent_iter, &iter)) + { + g_free(uri); + gtk_tree_model_get(model, &iter, TREEBROWSER_COLUMN_URI, &uri, -1); + target_iter = &parent_iter; + } + else + { + SETPTR(uri, g_path_get_dirname(uri)); + target_iter = NULL; + } + } + treebrowser_browse(uri, target_iter); g_free(uri); } else -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] acb8b8: TreeBrowser: Port spawning external commands to the spawn API
by Enrico Tröger
13 Nov '22
13 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Mon, 27 Apr 2020 21:11:08 UTC Commit: acb8b852d0a0cec1d0b626275063173e0026fe63
https://github.com/geany/geany-plugins/commit/acb8b852d0a0cec1d0b6262750631…
Log Message: ----------- TreeBrowser: Port spawning external commands to the spawn API Port "Open Externally" and "Open in terminal" actions to the spawn API for better support on Windows. Also remove unnecessary hard-coded "cmd" command on Windows and use the configured command instead. Closes #556. Modified Paths: -------------- treebrowser/src/treebrowser.c Modified: treebrowser/src/treebrowser.c 33 lines changed, 9 insertions(+), 24 deletions(-) =================================================================== @@ -59,7 +59,7 @@ static gboolean flag_on_expand_refresh = FALSE; # define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "xdg-open '%d'" # define CONFIG_OPEN_TERMINAL_DEFAULT "xterm" #else -# define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "explorer '%d'" +# define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "explorer %d" # define CONFIG_OPEN_TERMINAL_DEFAULT "cmd" #endif @@ -412,18 +412,6 @@ get_default_dir(void) return g_get_current_dir(); } -static gchar * -get_terminal(void) -{ - gchar *terminal; -#ifdef G_OS_WIN32 - terminal = g_strdup("cmd"); -#else - terminal = g_strdup(CONFIG_OPEN_TERMINAL); -#endif - return terminal; -} - static gboolean treebrowser_checkdir(gchar *directory) { @@ -996,7 +984,7 @@ on_menu_current_path(GtkMenuItem *menuitem, gpointer *user_data) } static void -on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) +on_menu_open_externally(GtkMenuItem *menuitem, const gchar *uri) { gchar *cmd, *locale_cmd, *dir, *c; GString *cmd_str = g_string_new(CONFIG_OPEN_EXTERNAL_CMD); @@ -1009,7 +997,7 @@ on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) cmd = g_string_free(cmd_str, FALSE); locale_cmd = utils_get_locale_from_utf8(cmd); - if (! g_spawn_command_line_async(locale_cmd, &error)) + if (! spawn_async(dir, locale_cmd, NULL, NULL, NULL, &error)) { c = strchr(cmd, ' '); if (c != NULL) @@ -1025,19 +1013,16 @@ on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) } static void -on_menu_open_terminal(GtkMenuItem *menuitem, gchar *uri) +on_menu_open_terminal(GtkMenuItem *menuitem, const gchar *uri) { - gchar *argv[2] = {NULL, NULL}; - argv[0] = get_terminal(); - + gchar *cwd; if (g_file_test(uri, G_FILE_TEST_EXISTS)) - uri = g_file_test(uri, G_FILE_TEST_IS_DIR) ? g_strdup(uri) : g_path_get_dirname(uri); + cwd = g_file_test(uri, G_FILE_TEST_IS_DIR) ? g_strdup(uri) : g_path_get_dirname(uri); else - uri = g_strdup(addressbar_last_address); + cwd = g_strdup(addressbar_last_address); - g_spawn_async(uri, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); - g_free(uri); - g_free(argv[0]); + spawn_async(cwd, CONFIG_OPEN_TERMINAL, NULL, NULL, NULL, NULL); + g_free(cwd); } static void -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] b57f5f: Merge pull request #973 from eht16/issue556_treebrowser_spawn
by Enrico Tröger
13 Nov '22
13 Nov '22
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 13 Nov 2022 12:50:33 UTC Commit: b57f5f64d600d3621facce0c6f0d59dad30b674f
https://github.com/geany/geany-plugins/commit/b57f5f64d600d3621facce0c6f0d5…
Log Message: ----------- Merge pull request #973 from eht16/issue556_treebrowser_spawn TreeBrowser: Port spawning external commands to the spawn API Modified Paths: -------------- treebrowser/src/treebrowser.c Modified: treebrowser/src/treebrowser.c 33 lines changed, 9 insertions(+), 24 deletions(-) =================================================================== @@ -59,7 +59,7 @@ static gboolean flag_on_expand_refresh = FALSE; # define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "xdg-open '%d'" # define CONFIG_OPEN_TERMINAL_DEFAULT "xterm" #else -# define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "explorer '%d'" +# define CONFIG_OPEN_EXTERNAL_CMD_DEFAULT "explorer %d" # define CONFIG_OPEN_TERMINAL_DEFAULT "cmd" #endif @@ -412,18 +412,6 @@ get_default_dir(void) return g_get_current_dir(); } -static gchar * -get_terminal(void) -{ - gchar *terminal; -#ifdef G_OS_WIN32 - terminal = g_strdup("cmd"); -#else - terminal = g_strdup(CONFIG_OPEN_TERMINAL); -#endif - return terminal; -} - static gboolean treebrowser_checkdir(gchar *directory) { @@ -996,7 +984,7 @@ on_menu_current_path(GtkMenuItem *menuitem, gpointer *user_data) } static void -on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) +on_menu_open_externally(GtkMenuItem *menuitem, const gchar *uri) { gchar *cmd, *locale_cmd, *dir, *c; GString *cmd_str = g_string_new(CONFIG_OPEN_EXTERNAL_CMD); @@ -1009,7 +997,7 @@ on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) cmd = g_string_free(cmd_str, FALSE); locale_cmd = utils_get_locale_from_utf8(cmd); - if (! g_spawn_command_line_async(locale_cmd, &error)) + if (! spawn_async(dir, locale_cmd, NULL, NULL, NULL, &error)) { c = strchr(cmd, ' '); if (c != NULL) @@ -1025,19 +1013,16 @@ on_menu_open_externally(GtkMenuItem *menuitem, gchar *uri) } static void -on_menu_open_terminal(GtkMenuItem *menuitem, gchar *uri) +on_menu_open_terminal(GtkMenuItem *menuitem, const gchar *uri) { - gchar *argv[2] = {NULL, NULL}; - argv[0] = get_terminal(); - + gchar *cwd; if (g_file_test(uri, G_FILE_TEST_EXISTS)) - uri = g_file_test(uri, G_FILE_TEST_IS_DIR) ? g_strdup(uri) : g_path_get_dirname(uri); + cwd = g_file_test(uri, G_FILE_TEST_IS_DIR) ? g_strdup(uri) : g_path_get_dirname(uri); else - uri = g_strdup(addressbar_last_address); + cwd = g_strdup(addressbar_last_address); - g_spawn_async(uri, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); - g_free(uri); - g_free(argv[0]); + spawn_async(cwd, CONFIG_OPEN_TERMINAL, NULL, NULL, NULL, NULL); + g_free(cwd); } static void -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
Results per page:
10
25
50
100
200