Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 16 Nov 2023 09:55:34 UTC
Commit: 0e0a96ef8e7fec5117f67f3aea1bcfa685d3f6d0
https://github.com/geany/geany/commit/0e0a96ef8e7fec5117f67f3aea1bcfa685d3f…
Log Message:
-----------
Remove invalid placeholder code
Since 9c49eceec823f042ffc93bea6e11e1e72d85df90 we don't have any
per-GTK-version CSS data, so the array holding those and the associated
metadata is empty.
However an array in ISO C cannot be zero-sized, so just drop this
placeholder code we might never need again anyway.
Modified Paths:
--------------
src/ui_utils.c
Modified: src/ui_utils.c
27 lines changed, 0 insertions(+), 27 deletions(-)
===================================================================
@@ -2576,33 +2576,6 @@ static void init_css_styles(void)
load_css_theme(theme_fn, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_free(theme_fn);
- // load themes to handle breakage between various GTK+ versions
- const struct
- {
- guint min_version;
- guint max_version;
- const gchar *file;
- }
- css_files[] =
- {
- /* Unused now but can be used to load css for different GTK versions, such as
- * { 20, G_MAXUINT, "geany-3.20.css" },
- * { 0, 19, "geany-3.0.css" },
- */
- };
-
- guint gtk_version = gtk_get_minor_version();
- for (guint i = 0; i < G_N_ELEMENTS(css_files); i++)
- {
- if (gtk_version >= css_files[i].min_version &&
- gtk_version <= css_files[i].max_version)
- {
- theme_fn = g_build_filename(app->datadir, css_files[i].file, NULL);
- load_css_theme(theme_fn, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_free(theme_fn);
- }
- }
-
// if the user provided a geany.css file in their config dir, try and load that
theme_fn = g_build_filename(app->configdir, "geany.css", NULL);
if (g_file_test(theme_fn, G_FILE_TEST_EXISTS))
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 16 Nov 2023 09:55:22 UTC
Commit: 73658f185b0398b2ec8610d6060f84033906001d
https://github.com/geany/geany/commit/73658f185b0398b2ec8610d6060f840339060…
Log Message:
-----------
"Fix" passing const arguments to spawn functions
`char**` doesn't coerce to `const char**` or any variant thereof, so
APIs expecting a `const char *const *` (like execv-style functions)
usually just use `char**` as it's usually effectively *more* convenient
for a caller.
However, this means that if we want to pass const data, we need a cast
(that is safe, as we know the API contract).
If making the compiler treat string literals as const (using e.g. GCC's
-Wwrite-strings), building an argument list composed of literals still
need to be const, so make it so and add a cast to the API call.
Modified Paths:
--------------
src/build.c
src/printing.c
Modified: src/build.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -771,7 +771,7 @@ static gchar *build_replace_placeholder(const GeanyDocument *doc, const gchar *s
static void build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *dir)
{
GError *error = NULL;
- gchar *argv[] = { "/bin/sh", "-c", NULL, NULL };
+ const gchar *argv[] = { "/bin/sh", "-c", NULL, NULL };
gchar *working_dir;
gchar *utf8_working_dir;
gchar *cmd_string;
@@ -813,7 +813,7 @@ static void build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *d
build_info.file_type_id = (doc == NULL) ? GEANY_FILETYPES_NONE : doc->file_type->id;
build_info.message_count = 0;
- if (!spawn_with_callbacks(working_dir, cmd, argv, NULL, 0, NULL, NULL, build_iofunc,
+ if (!spawn_with_callbacks(working_dir, cmd, (gchar **) argv, NULL, 0, NULL, NULL, build_iofunc,
GINT_TO_POINTER(0), 0, build_iofunc, GINT_TO_POINTER(1), 0, build_exit_cb, NULL,
&build_info.pid, &error))
{
Modified: src/printing.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -602,9 +602,9 @@ static void print_external(GeanyDocument *doc)
/* /bin/sh -c emulates the system() call and makes complex commands possible
* but only on non-win32 systems due to the lack of win32's shell capabilities */
#ifdef G_OS_UNIX
- gchar *argv[] = { "/bin/sh", "-c", cmdline, NULL };
+ const gchar *argv[] = { "/bin/sh", "-c", cmdline, NULL };
- if (!spawn_async(NULL, NULL, argv, NULL, NULL, &error))
+ if (!spawn_async(NULL, NULL, (gchar **) argv, NULL, NULL, &error))
#else
if (!spawn_async(NULL, cmdline, NULL, NULL, NULL, &error))
#endif
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 16 Nov 2023 09:47:12 UTC
Commit: ffad343f21be323b55b3ca44c6f2d0d4d9a008fb
https://github.com/geany/geany/commit/ffad343f21be323b55b3ca44c6f2d0d4d9a00…
Log Message:
-----------
Fix harmless GCC warning
src/tagmanager/tm_ctags.c: In function 'rename_anon_tags':
src/tagmanager/tm_ctags.c:323:68: warning: array subscript has type 'char' [-Wchar-subscripts]
323 | anon_counter = ++anon_counter_table[kind];
| ^
-Wchar-subscripts
Warn if an array subscript has type "char". This is a common cause
of error, as programmers often forget that this type is signed on
some machines. This warning is enabled by -Wall.
Modified Paths:
--------------
src/tagmanager/tm_ctags.c
Modified: src/tagmanager/tm_ctags.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -320,7 +320,7 @@ static void rename_anon_tags(TMSourceFile *source_file)
if (!anon_counter_table)
anon_counter_table = g_new0(gint, 256);
- anon_counter = ++anon_counter_table[kind];
+ anon_counter = ++anon_counter_table[(guchar) kind];
sprintf(buf, "anon_%s_%u", kind_name, anon_counter);
tag->name = g_strdup(buf);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Thu, 16 Nov 2023 09:47:12 UTC
Commit: 7f630aaf917b733c76640574610017fc3a7c15ab
https://github.com/geany/geany/commit/7f630aaf917b733c76640574610017fc3a7c1…
Log Message:
-----------
Fix fairly nasty implicit integer conversion
Subtracting two unsigned values result in an unsigned value, and here
to use a different sign on each side of a ternary operator.
src/tagmanager/tm_workspace.c: In function 'sort_found_tags':
src/tagmanager/tm_workspace.c:909:45: warning: operand of '?:' changes signedness from 'int' to 'gulong' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
909 | return info->sort_by_name ? g_strcmp0(t1->name, t2->name) : t2->line - t1->line;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an especially valid concern as TMTag::line is an unsigned long,
and the function returns an int, leading to possible sign swapping with
extreme values. This is fairly theoretical as it's unlikely actual
files have enough lines for this to actually matter, but still.
Modified Paths:
--------------
src/tagmanager/tm_workspace.c
Modified: src/tagmanager/tm_workspace.c
7 lines changed, 6 insertions(+), 1 deletions(-)
===================================================================
@@ -906,7 +906,12 @@ static gint sort_found_tags(gconstpointer a, gconstpointer b, gpointer user_data
* followed by workspace tags,
* followed by global tags */
if (t1->type & tm_tag_local_var_t && t2->type & tm_tag_local_var_t)
- return info->sort_by_name ? g_strcmp0(t1->name, t2->name) : t2->line - t1->line;
+ {
+ if (info->sort_by_name)
+ return g_strcmp0(t1->name, t2->name);
+ else /* just like (t2->line - t1->line), but doesn't overflow converting to int */
+ return (t2->line > t1->line) ? 1 : ((t2->line < t1->line) ? -1 : 0);
+ }
else if (t1->type & tm_tag_local_var_t)
return -1;
else if (t2->type & tm_tag_local_var_t)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).