[gnome-commander] Remove surplus assertions
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Remove surplus assertions
- Date: Fri, 10 Jun 2011 20:50:28 +0000 (UTC)
commit c1e3bab20c6b94c0d55fa88dd60a95c274a87055
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Fri Jun 10 22:24:46 2011 +0200
Remove surplus assertions
src/intviewer/inputmodes.cc | 8 +++++---
src/intviewer/scroll-box.cc | 9 ---------
src/intviewer/search-dlg.cc | 1 -
src/intviewer/search-progress-dlg.cc | 3 ---
src/intviewer/searcher.cc | 3 ---
src/intviewer/viewer-widget.cc | 27 ---------------------------
src/intviewer/viewer-window.cc | 5 -----
7 files changed, 5 insertions(+), 51 deletions(-)
---
diff --git a/src/intviewer/inputmodes.cc b/src/intviewer/inputmodes.cc
index 6c13343..90f59e3 100644
--- a/src/intviewer/inputmodes.cc
+++ b/src/intviewer/inputmodes.cc
@@ -84,9 +84,11 @@ GVInputModesData *gv_input_modes_new()
void gv_init_input_modes(GVInputModesData *imd, get_byte_proc proc, void *get_byte_user_data)
{
g_return_if_fail (imd!=NULL);
+
memset(imd, 0, sizeof(GVInputModesData));
g_return_if_fail (proc!=NULL);
+
imd->get_byte = proc;
imd->get_byte_user_data = get_byte_user_data;
@@ -114,7 +116,7 @@ void gv_free_input_modes(GVInputModesData *imd)
}
-const char*gv_get_input_mode(GVInputModesData *imd)
+const char *gv_get_input_mode(GVInputModesData *imd)
{
g_return_val_if_fail (imd!=NULL, "");
g_return_val_if_fail (imd->input_mode_name!=NULL, "");
@@ -364,7 +366,7 @@ static void inputmode_utf8_activate(GVInputModesData *imd)
inline guint utf8_get_char_len(GVInputModesData *imd, offset_type offset)
{
int value = gv_input_mode_get_byte(imd, offset);
-
+
if (value<0 || value>255) return 0;
if (UTF8_SINGLE_CHAR(value)) return 1;
@@ -387,7 +389,7 @@ inline guint utf8_get_char_len(GVInputModesData *imd, offset_type offset)
inline gboolean utf8_is_valid_char(GVInputModesData *imd, offset_type offset)
{
int len = utf8_get_char_len(imd, offset);
-
+
if (len==0 || (gv_input_mode_get_byte(imd, offset+len)==INVALID_CHAR))
return FALSE;
diff --git a/src/intviewer/scroll-box.cc b/src/intviewer/scroll-box.cc
index 771ca69..30a743c 100644
--- a/src/intviewer/scroll-box.cc
+++ b/src/intviewer/scroll-box.cc
@@ -126,7 +126,6 @@ static void scroll_box_init (ScrollBox *w)
static void scroll_box_destroy (GtkObject *widget)
{
- g_return_if_fail (widget!= NULL);
g_return_if_fail (IS_SCROLL_BOX (widget));
ScrollBox *w = SCROLL_BOX (widget);
@@ -148,7 +147,6 @@ static void scroll_box_destroy (GtkObject *widget)
GtkRange *scroll_box_get_v_range(ScrollBox *obj)
{
- g_return_val_if_fail (obj!= NULL, FALSE);
g_return_val_if_fail (IS_SCROLL_BOX (obj), FALSE);
return GTK_RANGE(obj->priv->vscroll);
@@ -157,7 +155,6 @@ GtkRange *scroll_box_get_v_range(ScrollBox *obj)
static gboolean scroll_box_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
- g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_SCROLL_BOX (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@@ -169,7 +166,6 @@ static gboolean scroll_box_button_press(GtkWidget *widget, GdkEventButton *event
void scroll_box_set_client (ScrollBox *obj, GtkWidget *client)
{
- g_return_if_fail (obj != NULL);
g_return_if_fail (IS_SCROLL_BOX (obj));
g_return_if_fail (client!=NULL);
@@ -191,7 +187,6 @@ void scroll_box_set_client (ScrollBox *obj, GtkWidget *client)
GtkWidget *scroll_box_get_client (ScrollBox *obj)
{
- g_return_val_if_fail (obj!= NULL, NULL);
g_return_val_if_fail (IS_SCROLL_BOX (obj), NULL);
return obj->priv->client;
@@ -200,7 +195,6 @@ GtkWidget *scroll_box_get_client (ScrollBox *obj)
void scroll_box_set_h_adjustment (ScrollBox *obj, GtkAdjustment *adjustment)
{
- g_return_if_fail (obj != NULL);
g_return_if_fail (IS_SCROLL_BOX(obj));
gtk_range_set_adjustment(GTK_RANGE(obj->priv->hscroll), adjustment);
@@ -209,7 +203,6 @@ void scroll_box_set_h_adjustment (ScrollBox *obj, GtkAdjustment *adjustment)
void scroll_box_set_v_adjustment (ScrollBox *obj, GtkAdjustment *adjustment)
{
- g_return_if_fail (obj != NULL);
g_return_if_fail (IS_SCROLL_BOX(obj));
gtk_range_set_adjustment(GTK_RANGE(obj->priv->vscroll), adjustment);
@@ -218,7 +211,6 @@ void scroll_box_set_v_adjustment (ScrollBox *obj, GtkAdjustment *adjustment)
GtkAdjustment *scroll_box_get_h_adjustment (ScrollBox *obj)
{
- g_return_val_if_fail (obj != NULL, NULL);
g_return_val_if_fail (IS_SCROLL_BOX(obj), NULL);
return gtk_range_get_adjustment (GTK_RANGE(obj->priv->hscroll));
@@ -227,7 +219,6 @@ GtkAdjustment *scroll_box_get_h_adjustment (ScrollBox *obj)
GtkAdjustment *scroll_box_get_v_adjustment (ScrollBox *obj)
{
- g_return_val_if_fail (obj != NULL, NULL);
g_return_val_if_fail (IS_SCROLL_BOX(obj), NULL);
return gtk_range_get_adjustment (GTK_RANGE(obj->priv->vscroll));
diff --git a/src/intviewer/search-dlg.cc b/src/intviewer/search-dlg.cc
index 9724bda..d6eb649 100644
--- a/src/intviewer/search-dlg.cc
+++ b/src/intviewer/search-dlg.cc
@@ -310,7 +310,6 @@ static void search_dlg_init (GViewerSearchDlg *sdlg)
static void search_dlg_destroy (GtkObject *object)
{
- g_return_if_fail (object != NULL);
g_return_if_fail (IS_GVIEWER_SEARCH_DLG(object));
GViewerSearchDlg *w = GVIEWER_SEARCH_DLG(object);
diff --git a/src/intviewer/search-progress-dlg.cc b/src/intviewer/search-progress-dlg.cc
index c2a4ab7..4f9b504 100644
--- a/src/intviewer/search-progress-dlg.cc
+++ b/src/intviewer/search-progress-dlg.cc
@@ -49,7 +49,6 @@ static void search_progress_dlg_action_response(GtkDialog *dlg, gint arg1, GView
{
g_return_if_fail (sdlg!=NULL);
g_return_if_fail (sdlg->priv!=NULL);
-
g_return_if_fail (sdlg->priv->abort_indicator!=NULL);
g_atomic_int_add(sdlg->priv->abort_indicator, 1);
@@ -99,7 +98,6 @@ static void search_progress_dlg_init (GViewerSearchProgressDlg *sdlg)
static void search_progress_dlg_destroy (GtkObject *object)
{
- g_return_if_fail (object != NULL);
g_return_if_fail (IS_GVIEWER_SEARCH_PROGRESS_DLG(object));
GViewerSearchProgressDlg *w = GVIEWER_SEARCH_PROGRESS_DLG(object);
@@ -147,7 +145,6 @@ GtkWidget *gviewer_search_progress_dlg_new (GtkWindow *parent)
gboolean search_progress_dlg_timeout(gpointer data)
{
- g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (IS_GVIEWER_SEARCH_PROGRESS_DLG(data), FALSE);
gdouble progress;
diff --git a/src/intviewer/searcher.cc b/src/intviewer/searcher.cc
index d0b7bc7..29f496d 100644
--- a/src/intviewer/searcher.cc
+++ b/src/intviewer/searcher.cc
@@ -550,7 +550,6 @@ gboolean search_text_backward (GViewerSearcher *src)
gpointer search_func (gpointer user_data)
{
- g_return_val_if_fail (user_data!=NULL, NULL);
g_return_val_if_fail (G_IS_VIEWERSEARCHER(user_data), NULL);
GViewerSearcher *src = G_VIEWERSEARCHER(user_data);
@@ -578,7 +577,6 @@ void g_viewer_searcher_join(GViewerSearcher *src)
{
g_return_if_fail (src!=NULL);
g_return_if_fail (src->priv!=NULL);
-
g_return_if_fail (src->priv->search_thread!=NULL);
g_thread_join(src->priv->search_thread);
@@ -590,7 +588,6 @@ void g_viewer_searcher_start_search(GViewerSearcher *src, gboolean forward)
{
g_return_if_fail (src!=NULL);
g_return_if_fail (src->priv!=NULL);
-
g_return_if_fail (src->priv->search_thread==NULL);
// Reset indicators
diff --git a/src/intviewer/viewer-widget.cc b/src/intviewer/viewer-widget.cc
index 93bafb1..52f520f 100644
--- a/src/intviewer/viewer-widget.cc
+++ b/src/intviewer/viewer-widget.cc
@@ -201,7 +201,6 @@ static void gviewer_init (GViewer *w)
#define MAX_STATUS_LENGTH 128
static void gviewer_text_status_update(TextRender *obj, TextRenderStatus *status, GViewer *viewer)
{
- g_return_if_fail (viewer!= NULL);
g_return_if_fail (IS_GVIEWER (viewer));
g_return_if_fail (status!=NULL);
@@ -220,7 +219,6 @@ static void gviewer_text_status_update(TextRender *obj, TextRenderStatus *status
static void gviewer_image_status_update(ImageRender *obj, ImageRenderStatus *status, GViewer *viewer)
{
- g_return_if_fail (viewer!= NULL);
g_return_if_fail (IS_GVIEWER (viewer));
g_return_if_fail (status!=NULL);
@@ -275,7 +273,6 @@ static gboolean on_text_viewer_button_pressed (GtkWidget *treeview, GdkEventButt
static void gviewer_destroy (GtkObject *widget)
{
- g_return_if_fail (widget!= NULL);
g_return_if_fail (IS_GVIEWER (widget));
GViewer *w = GVIEWER (widget);
@@ -350,7 +347,6 @@ void gviewer_auto_detect_display_mode(GViewer *obj)
void gviewer_set_display_mode(GViewer *obj, VIEWERDISPLAYMODE mode)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
if (mode==DISP_MODE_IMAGE && !obj->priv->img_initialized)
@@ -417,7 +413,6 @@ void gviewer_set_display_mode(GViewer *obj, VIEWERDISPLAYMODE mode)
VIEWERDISPLAYMODE gviewer_get_display_mode(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, DISP_MODE_TEXT_FIXED);
g_return_val_if_fail (IS_GVIEWER (obj), DISP_MODE_TEXT_FIXED);
return obj->priv->dispmode;
@@ -426,7 +421,6 @@ VIEWERDISPLAYMODE gviewer_get_display_mode(GViewer *obj)
void gviewer_load_filedesc(GViewer *obj, int fd)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (fd>2);
@@ -443,7 +437,6 @@ void gviewer_load_filedesc(GViewer *obj, int fd)
void gviewer_load_file(GViewer *obj, const gchar*filename)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (filename);
@@ -462,7 +455,6 @@ void gviewer_load_file(GViewer *obj, const gchar*filename)
const gchar *gviewer_get_filename(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, NULL);
g_return_val_if_fail (IS_GVIEWER (obj), NULL);
g_return_val_if_fail (obj->priv->filename, NULL);
@@ -472,7 +464,6 @@ const gchar *gviewer_get_filename(GViewer *obj)
void gviewer_set_tab_size(GViewer *obj, int tab_size)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -482,7 +473,6 @@ void gviewer_set_tab_size(GViewer *obj, int tab_size)
int gviewer_get_tab_size(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, 0);
g_return_val_if_fail (IS_GVIEWER (obj), 0);
g_return_val_if_fail (obj->priv->textr, 0);
@@ -492,7 +482,6 @@ int gviewer_get_tab_size(GViewer *obj)
void gviewer_set_wrap_mode(GViewer *obj, gboolean ACTIVE)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -502,7 +491,6 @@ void gviewer_set_wrap_mode(GViewer *obj, gboolean ACTIVE)
gboolean gviewer_get_wrap_mode(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, FALSE);
g_return_val_if_fail (IS_GVIEWER (obj), FALSE);
g_return_val_if_fail (obj->priv->textr, FALSE);
@@ -512,7 +500,6 @@ gboolean gviewer_get_wrap_mode(GViewer *obj)
void gviewer_set_fixed_limit(GViewer *obj, int fixed_limit)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -522,7 +509,6 @@ void gviewer_set_fixed_limit(GViewer *obj, int fixed_limit)
int gviewer_get_fixed_limit(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, 0);
g_return_val_if_fail (IS_GVIEWER (obj), 0);
g_return_val_if_fail (obj->priv->textr, 0);
@@ -532,7 +518,6 @@ int gviewer_get_fixed_limit(GViewer *obj)
void gviewer_set_encoding(GViewer *obj, const char *encoding)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -542,7 +527,6 @@ void gviewer_set_encoding(GViewer *obj, const char *encoding)
const gchar *gviewer_get_encoding(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, NULL);
g_return_val_if_fail (IS_GVIEWER (obj), NULL);
g_return_val_if_fail (obj->priv->textr, NULL);
@@ -552,7 +536,6 @@ const gchar *gviewer_get_encoding(GViewer *obj)
void gviewer_set_font_size(GViewer *obj, int font_size)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -562,7 +545,6 @@ void gviewer_set_font_size(GViewer *obj, int font_size)
int gviewer_get_font_size(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, 0);
g_return_val_if_fail (IS_GVIEWER (obj), 0);
g_return_val_if_fail (obj->priv->textr, 0);
@@ -572,7 +554,6 @@ int gviewer_get_font_size(GViewer *obj)
void gviewer_set_hex_offset_display(GViewer *obj, gboolean HEX_OFFSET)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
@@ -582,7 +563,6 @@ void gviewer_set_hex_offset_display(GViewer *obj, gboolean HEX_OFFSET)
gboolean gviewer_get_hex_offset_display(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, FALSE);
g_return_val_if_fail (IS_GVIEWER (obj), FALSE);
g_return_val_if_fail (obj->priv->textr, FALSE);
@@ -592,7 +572,6 @@ gboolean gviewer_get_hex_offset_display(GViewer *obj)
void gviewer_set_best_fit(GViewer *obj, gboolean active)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->imgr);
@@ -602,7 +581,6 @@ void gviewer_set_best_fit(GViewer *obj, gboolean active)
gboolean gviewer_get_best_fit(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, FALSE);
g_return_val_if_fail (IS_GVIEWER (obj), FALSE);
g_return_val_if_fail (obj->priv->textr, FALSE);
@@ -612,7 +590,6 @@ gboolean gviewer_get_best_fit(GViewer *obj)
void gviewer_set_scale_factor(GViewer *obj, double scalefactor)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->imgr);
@@ -622,7 +599,6 @@ void gviewer_set_scale_factor(GViewer *obj, double scalefactor)
double gviewer_get_scale_factor(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, 0);
g_return_val_if_fail (IS_GVIEWER (obj), 0);
g_return_val_if_fail (obj->priv->imgr, 0);
@@ -632,7 +608,6 @@ double gviewer_get_scale_factor(GViewer *obj)
TextRender *gviewer_get_text_render(GViewer *obj)
{
- g_return_val_if_fail (obj!= NULL, 0);
g_return_val_if_fail (IS_GVIEWER (obj), 0);
g_return_val_if_fail (obj->priv->textr, 0);
@@ -642,7 +617,6 @@ TextRender *gviewer_get_text_render(GViewer *obj)
void gviewer_image_operation(GViewer *obj, IMAGEOPERATION op)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->imgr);
@@ -652,7 +626,6 @@ void gviewer_image_operation(GViewer *obj, IMAGEOPERATION op)
void gviewer_copy_selection(GtkMenuItem *item, GViewer *obj)
{
- g_return_if_fail (obj!= NULL);
g_return_if_fail (IS_GVIEWER (obj));
g_return_if_fail (obj->priv->textr);
diff --git a/src/intviewer/viewer-window.cc b/src/intviewer/viewer-window.cc
index fce1975..0666137 100644
--- a/src/intviewer/viewer-window.cc
+++ b/src/intviewer/viewer-window.cc
@@ -259,7 +259,6 @@ static void gviewer_window_init (GViewerWindow *w)
static void gviewer_window_status_line_changed(GViewer *obj, const gchar *status_line, GViewerWindow *wnd)
{
- g_return_if_fail (wnd != NULL);
g_return_if_fail (IS_GVIEWER_WINDOW (wnd));
GViewerWindow *w = GVIEWER_WINDOW (wnd);
@@ -276,7 +275,6 @@ static void gviewer_window_status_line_changed(GViewer *obj, const gchar *status
void gviewer_window_set_settings(GViewerWindow *obj, /*in*/ GViewerWindowSettings *settings)
{
- g_return_if_fail (obj!=NULL);
g_return_if_fail (IS_GVIEWER_WINDOW(obj));
g_return_if_fail (settings!=NULL);
g_return_if_fail (obj->priv->viewer!=NULL);
@@ -324,7 +322,6 @@ void gviewer_window_set_settings(GViewerWindow *obj, /*in*/ GViewerWindowSetting
void gviewer_window_get_current_settings(GViewerWindow *obj, /* out */ GViewerWindowSettings *settings)
{
- g_return_if_fail (obj!=NULL);
g_return_if_fail (IS_GVIEWER_WINDOW(obj));
g_return_if_fail (settings!=NULL);
g_return_if_fail (obj->priv->viewer!=NULL);
@@ -355,7 +352,6 @@ void gviewer_window_get_current_settings(GViewerWindow *obj, /* out */ GViewerWi
static void gviewer_window_destroy (GtkObject *widget)
{
- g_return_if_fail (widget!= NULL);
g_return_if_fail (IS_GVIEWER_WINDOW (widget));
GViewerWindow *w = GVIEWER_WINDOW (widget);
@@ -378,7 +374,6 @@ static void gviewer_window_destroy (GtkObject *widget)
static gboolean gviewer_window_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
- g_return_val_if_fail (widget!= NULL, FALSE);
g_return_val_if_fail (IS_GVIEWER_WINDOW (widget), FALSE);
GViewerWindow *w = GVIEWER_WINDOW (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]