mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
Merge branch 'va-fixes-reported-by-pvs' into 'main'
Fix issues spotted by PVS-Studio See merge request GNOME/gtk!6558
This commit is contained in:
commit
3ab7b2d7ce
@ -75,7 +75,9 @@ query_tooltip (GtkWidget *widget,
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
|
||||
|
||||
precision = 1;
|
||||
s = NULL;
|
||||
do {
|
||||
g_free (s);
|
||||
s = g_strdup_printf ("%.*f", precision, self->scale);
|
||||
l = strlen (s) - 1;
|
||||
while (s[l] == '0')
|
||||
|
@ -186,7 +186,6 @@ gtk_css_parser_resolve_url (GtkCssParser *self,
|
||||
g_free (scheme);
|
||||
return file;
|
||||
}
|
||||
g_free (scheme);
|
||||
|
||||
if (self->directory == NULL)
|
||||
return NULL;
|
||||
|
@ -970,6 +970,7 @@ gtk_css_tokenizer_read_url (GtkCssTokenizer *tokenizer,
|
||||
{
|
||||
gtk_css_tokenizer_read_bad_url (tokenizer, token);
|
||||
gtk_css_tokenizer_parse_error (error, "Whitespace only allowed at start and end of url");
|
||||
g_string_free (url, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -445,11 +445,14 @@ notify_observers_added (GtkActionMuxer *muxer,
|
||||
gboolean enabled;
|
||||
GVariant *state;
|
||||
GSList *node;
|
||||
GSList *action_watchers;
|
||||
|
||||
if (!action->watchers)
|
||||
action_watchers = action ? action->watchers : NULL;
|
||||
|
||||
if (!action_watchers)
|
||||
continue;
|
||||
|
||||
for (node = action ? action->watchers : NULL; node; node = node->next)
|
||||
for (node = action_watchers; node; node = node->next)
|
||||
gtk_action_observer_primary_accel_changed (node->data, GTK_ACTION_OBSERVABLE (muxer),
|
||||
action_name, NULL);
|
||||
|
||||
@ -461,7 +464,7 @@ notify_observers_added (GtkActionMuxer *muxer,
|
||||
TRUE))
|
||||
continue;
|
||||
|
||||
for (node = action->watchers; node; node = node->next)
|
||||
for (node = action_watchers; node; node = node->next)
|
||||
{
|
||||
gtk_action_observer_action_added (node->data,
|
||||
GTK_ACTION_OBSERVABLE (muxer),
|
||||
|
@ -2661,7 +2661,7 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Object named \"%s\" is of type \"%s\" which is not compatible with expected type \%s\"",
|
||||
"Object named \"%s\" is of type \"%s\" which is not compatible with expected type \"%s\"",
|
||||
string, G_OBJECT_TYPE_NAME (object), g_type_name (type));
|
||||
ret = FALSE;
|
||||
}
|
||||
|
@ -479,11 +479,11 @@ check_hex (GtkIMContextSimple *context_simple,
|
||||
|
||||
ch = gdk_keyval_to_unicode (priv->compose_buffer[i]);
|
||||
|
||||
if (ch == 0)
|
||||
return FALSE;
|
||||
|
||||
if (!g_unichar_isxdigit (ch))
|
||||
return FALSE;
|
||||
if (ch == 0 || !g_unichar_isxdigit (ch))
|
||||
{
|
||||
g_string_free (str, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buf[g_unichar_to_utf8 (ch, buf)] = '\0';
|
||||
|
||||
|
@ -3324,7 +3324,7 @@ strip_ulines (const char *text,
|
||||
char *q;
|
||||
gboolean after_uline = FALSE;
|
||||
|
||||
new_text = malloc (strlen (text) + 1);
|
||||
new_text = g_malloc (strlen (text) + 1);
|
||||
|
||||
q = new_text;
|
||||
for (p = text; *p; p++)
|
||||
|
@ -66,6 +66,7 @@ gtk_section_model_default_get_section (GtkSectionModel *self,
|
||||
{
|
||||
*out_start = n_items;
|
||||
*out_end = G_MAXUINT;
|
||||
return;
|
||||
}
|
||||
|
||||
*out_start = 0;
|
||||
|
@ -155,7 +155,7 @@ gtk_tree_list_row_sort_keys_compare (gconstpointer a,
|
||||
resb = unpack (keysb, &keysb, &sizeb);
|
||||
if (!resa)
|
||||
return resb ? GTK_ORDERING_LARGER : (keysa[2] < keysb[2] ? GTK_ORDERING_SMALLER :
|
||||
(keysb[2] > keysa[2] ? GTK_ORDERING_LARGER : GTK_ORDERING_EQUAL));
|
||||
(keysa[2] > keysb[2] ? GTK_ORDERING_LARGER : GTK_ORDERING_EQUAL));
|
||||
else if (!resb)
|
||||
return GTK_ORDERING_SMALLER;
|
||||
|
||||
|
@ -3022,7 +3022,7 @@ create_temporary_queue (GtkPrintBackendCups *backend,
|
||||
static void
|
||||
create_cups_printer_from_avahi_data (AvahiConnectionTestData *data)
|
||||
{
|
||||
PrinterSetupInfo *info = g_new0 (PrinterSetupInfo, 1);
|
||||
PrinterSetupInfo *info;
|
||||
GtkPrinter *printer;
|
||||
|
||||
printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (data->backend), data->printer_name);
|
||||
@ -3034,6 +3034,7 @@ create_cups_printer_from_avahi_data (AvahiConnectionTestData *data)
|
||||
return;
|
||||
}
|
||||
|
||||
info = g_new0 (PrinterSetupInfo, 1);
|
||||
info->avahi_printer = TRUE;
|
||||
info->printer_name = data->printer_name;
|
||||
info->printer_uri = data->printer_uri;
|
||||
@ -4156,6 +4157,7 @@ cups_request_ppd (GtkPrinter *printer)
|
||||
httpClose (http);
|
||||
g_free (ppd_filename);
|
||||
g_free (data);
|
||||
g_free (resource);
|
||||
|
||||
g_signal_emit_by_name (printer, "details-acquired", FALSE);
|
||||
return FALSE;
|
||||
|
@ -430,7 +430,6 @@ update_columns (GtkTreeView *view, ViewColumnModel *view_model)
|
||||
int *new_order;
|
||||
GtkTreePath *path;
|
||||
|
||||
new_order = g_new (int, length);
|
||||
a = old_columns; b = view_model->columns;
|
||||
|
||||
while (a->data == b->data)
|
||||
@ -442,6 +441,8 @@ update_columns (GtkTreeView *view, ViewColumnModel *view_model)
|
||||
m++;
|
||||
}
|
||||
|
||||
new_order = g_new (int, length);
|
||||
|
||||
if (a->next->data == b->data)
|
||||
{
|
||||
b = b->next;
|
||||
|
@ -9,7 +9,7 @@ static const char *format_name[] = {
|
||||
static const char *
|
||||
format_to_string (GdkMemoryFormat format)
|
||||
{
|
||||
if (format < GDK_MEMORY_N_FORMATS)
|
||||
if (format < g_strv_length ((gchar **) format_name))
|
||||
return format_name[format];
|
||||
else
|
||||
return "ERROR";
|
||||
|
@ -55,12 +55,14 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
|
||||
i = 0;
|
||||
while (i < g_list_model_get_n_items (model))
|
||||
{
|
||||
|
@ -55,12 +55,13 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e, n;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
n = g_list_model_get_n_items (model);
|
||||
|
||||
i = 0;
|
||||
|
@ -55,12 +55,13 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e, n;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
n = g_list_model_get_n_items (model);
|
||||
|
||||
i = 0;
|
||||
|
@ -55,12 +55,13 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e, n;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
n = g_list_model_get_n_items (model);
|
||||
|
||||
i = 0;
|
||||
|
@ -54,12 +54,14 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
|
||||
i = 0;
|
||||
while (i < g_list_model_get_n_items (model))
|
||||
{
|
||||
|
@ -55,12 +55,14 @@ model_to_string (GListModel *model)
|
||||
static char *
|
||||
section_model_to_string (GListModel *model)
|
||||
{
|
||||
GString *string = g_string_new (NULL);
|
||||
GString *string;
|
||||
guint i, s, e;
|
||||
|
||||
if (!GTK_IS_SECTION_MODEL (model))
|
||||
return model_to_string (model);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
|
||||
i = 0;
|
||||
while (i < g_list_model_get_n_items (model))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user