Fix inproper usages of silent casts

This commit is contained in:
Rico Tzschichholz 2021-02-22 13:08:08 +01:00
parent ea7ff7d2a3
commit 06bbf4da41
4 changed files with 16 additions and 16 deletions

View file

@ -259,7 +259,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
private void search_entry_changed(Gtk.Editable entry)
{
var searchable = current_activity as GitgExt.Searchable;
var ntext = (entry as Gtk.Entry).text;
var ntext = ((Gtk.Entry) entry).text;
if (ntext != searchable.search_text)
{

View file

@ -442,7 +442,7 @@ class Gitg.DiffViewFileRendererText : Gtk.SourceView, DiffSelectable, DiffViewFi
if (s != null)
{
(buffer as Gtk.SourceBuffer).style_scheme = s;
((Gtk.SourceBuffer) buffer).style_scheme = s;
}
}

View file

@ -50,7 +50,7 @@ class Gitg.DiffViewFileSelectable : Object
var ret = new int[0];
Gtk.TextIter iter;
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
buffer.get_start_iter(out iter);
@ -161,7 +161,7 @@ class Gitg.DiffViewFileSelectable : Object
start.set_line_offset(0);
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
return buffer.get_source_marks_at_iter(start, d_selection_category) != null;
}
@ -172,7 +172,7 @@ class Gitg.DiffViewFileSelectable : Object
start.set_line_offset(0);
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
return (buffer.get_source_marks_at_iter(start, "added") != null) ||
(buffer.get_source_marks_at_iter(start, "removed") != null);
@ -184,7 +184,7 @@ class Gitg.DiffViewFileSelectable : Object
start.set_line_offset(0);
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
return buffer.get_source_marks_at_iter(start, "header") != null;
}
@ -225,7 +225,7 @@ class Gitg.DiffViewFileSelectable : Object
private void update_selection_range(Gtk.TextIter start, Gtk.TextIter end, bool select)
{
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
Gtk.TextIter real_start, real_end;
@ -319,7 +319,7 @@ class Gitg.DiffViewFileSelectable : Object
{
iter.forward_line();
var buffer = source_view.buffer as Gtk.SourceBuffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
if (!buffer.forward_iter_to_source_mark(ref iter, "header"))
{
@ -480,7 +480,7 @@ class Gitg.DiffViewFileSelectable : Object
private void update_has_selection()
{
var buffer = source_view.buffer;
unowned Gtk.SourceBuffer buffer = (Gtk.SourceBuffer) source_view.buffer;
Gtk.TextIter iter;
buffer.get_start_iter(out iter);
@ -493,7 +493,7 @@ class Gitg.DiffViewFileSelectable : Object
}
else
{
something_selected = (buffer as Gtk.SourceBuffer).forward_iter_to_source_mark(ref iter, d_selection_category);
something_selected = buffer.forward_iter_to_source_mark(ref iter, d_selection_category);
}
if (something_selected != has_selection)

View file

@ -245,7 +245,7 @@ public class Gitg.DiffView : Gtk.Grid
foreach (var file in d_grid_files.get_children())
{
(file as Gitg.DiffViewFile).expanded = expanded;
((Gitg.DiffViewFile) file).expanded = expanded;
}
}
@ -642,9 +642,9 @@ public class Gitg.DiffView : Gtk.Grid
foreach (var file in d_grid_files.get_children())
{
var selectable = (file as Gitg.DiffViewFile).renderer as DiffSelectable;
var selectable = ((Gitg.DiffViewFile) file).renderer as DiffSelectable;
if (selectable.has_selection)
if (selectable != null && selectable.has_selection)
{
something_selected = true;
break;
@ -894,7 +894,7 @@ public class Gitg.DiffView : Gtk.Grid
foreach (var file in file_widgets)
{
var f = file as Gitg.DiffViewFile;
unowned DiffViewFile f = (DiffViewFile) file;
if (preserve_expanded && f.expanded)
{
@ -944,7 +944,7 @@ public class Gitg.DiffView : Gtk.Grid
{
foreach (var file in d_grid_files.get_children())
{
if (!(file as Gitg.DiffViewFile).expanded)
if (!((Gitg.DiffViewFile) file).expanded)
{
auto_change_expanded(false);
return;
@ -960,7 +960,7 @@ public class Gitg.DiffView : Gtk.Grid
foreach (var file in d_grid_files.get_children())
{
var sel = (file as Gitg.DiffViewFile).renderer as DiffSelectable;
var sel = ((Gitg.DiffViewFile) file).renderer as DiffSelectable;
if (sel != null && sel.has_selection && sel.selection.patches.length != 0)
{