mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-22 22:03:44 +03:00
Fix warning by Coverity
Error: DEADCODE (CWE-561): [#def1] virt-viewer-9.0/src/virt-viewer-display-vte.c:164: assignment: Assigning: "scroll" = "NULL". virt-viewer-9.0/src/virt-viewer-display-vte.c:188: null: At condition "scroll", the value of "scroll" must be "NULL". virt-viewer-9.0/src/virt-viewer-display-vte.c:188: dead_error_condition: The condition "scroll" cannot be true. virt-viewer-9.0/src/virt-viewer-display-vte.c:189: dead_error_begin: Execution cannot reach this statement: "gtk_container_add((GtkConta...". virt-viewer-9.0/src/virt-viewer-display-vte.c:189: effectively_constant: Local variable "scroll" is assigned only once, to a constant value, making it effectively constant throughout its scope. If this is not the intent, examine the logic to see if there is a missing assignment that would make "scroll" not remain constant. Reported in https://gitlab.com/virt-viewer/virt-viewer/-/issues/7. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
parent
db827dedc9
commit
1573a790da
@ -147,7 +147,6 @@ virt_viewer_display_vte_commit(VirtViewerDisplayVte *self,
|
||||
{
|
||||
g_signal_emit_by_name(self, "commit", text, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
virt_viewer_display_vte_adj_changed(VirtViewerDisplayVte *self,
|
||||
@ -156,12 +155,16 @@ virt_viewer_display_vte_adj_changed(VirtViewerDisplayVte *self,
|
||||
gtk_widget_set_visible(self->priv->scroll,
|
||||
gtk_adjustment_get_upper(adjustment) > gtk_adjustment_get_page_size(adjustment));
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget *
|
||||
virt_viewer_display_vte_new(VirtViewerSession *session, const char *name)
|
||||
{
|
||||
VirtViewerDisplayVte *self;
|
||||
GtkWidget *grid, *scroll = NULL, *vte;
|
||||
GtkWidget *grid, *vte;
|
||||
#ifdef HAVE_VTE
|
||||
GtkWidget *scroll = NULL;
|
||||
#endif
|
||||
|
||||
self = g_object_new(VIRT_VIEWER_TYPE_DISPLAY_VTE,
|
||||
"session", session,
|
||||
@ -185,6 +188,8 @@ virt_viewer_display_vte_new(VirtViewerSession *session, const char *name)
|
||||
grid = gtk_grid_new();
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(grid), vte);
|
||||
|
||||
#ifdef HAVE_VTE
|
||||
if (scroll) {
|
||||
gtk_container_add(GTK_CONTAINER(grid), scroll);
|
||||
gtk_widget_hide(scroll);
|
||||
@ -192,6 +197,7 @@ virt_viewer_display_vte_new(VirtViewerSession *session, const char *name)
|
||||
"changed", G_CALLBACK(virt_viewer_display_vte_adj_changed),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(self), grid);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user