From 91f680b08931aaa43df551d18fdd4b6638fbac7b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 30 Oct 2018 18:07:47 +0100 Subject: Fix style warnings from static analyser --- src/frame.c | 9 ++------- src/presentation.c | 12 ++---------- src/sc_editor.c | 6 ++---- src/sc_interp.c | 7 ------- src/sc_parse.c | 3 +-- src/slide_window.c | 18 ------------------ 6 files changed, 7 insertions(+), 48 deletions(-) diff --git a/src/frame.c b/src/frame.c index cf6bd7f..2f533ff 100644 --- a/src/frame.c +++ b/src/frame.c @@ -78,12 +78,6 @@ struct _paragraph }; -PangoLayout *paragraph_layout(Paragraph *para) -{ - return para->layout; -} - - /* Returns the height of the paragraph including all spacing, padding etc */ double paragraph_height(Paragraph *para) { @@ -1502,11 +1496,12 @@ void delete_text_from_frame(struct frame *fr, struct edit_pos p1, struct edit_po void show_para(Paragraph *p) { - int i; printf(_("Paragraph %p\n"), p); if ( p->type == PARA_TYPE_TEXT ) { + int i; + printf(_("%i runs:\n"), p->n_runs); for ( i=0; in_runs; i++ ) { printf(_(" Run %2i: SCBlock %p %s '%s'\n"), diff --git a/src/presentation.c b/src/presentation.c index e1df7c8..fd55bf7 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -41,17 +41,11 @@ void free_presentation(struct presentation *p) { - int final = 0; - /* FIXME: Loads of stuff leaks here */ g_object_unref(p->file); g_object_unref(p->stylesheet_from); imagestore_destroy(p->is); free(p); - - if ( final ) { - gtk_main_quit(); - } } @@ -69,13 +63,11 @@ char *get_titlebar_string(struct presentation *p) static void find_and_load_stylesheet(struct presentation *p, GFile *file) { GFile *ssfile; - GFile *parent; - gchar *ssuri; if ( file != NULL ) { /* First choice: /same/directory/.ss */ - ssuri = g_file_get_uri(file); + gchar *ssuri = g_file_get_uri(file); if ( ssuri != NULL ) { size_t l = strlen(ssuri); if ( ssuri[l-3] == '.' && ssuri[l-2] == 's' && ssuri[l-1] =='c' ) { @@ -89,7 +81,7 @@ static void find_and_load_stylesheet(struct presentation *p, GFile *file) /* Second choice: /same/directory/stylesheet.ss */ if ( p->stylesheet == NULL ) { - parent = g_file_get_parent(file); + GFile *parent = g_file_get_parent(file); if ( parent != NULL ) { ssfile = g_file_get_child(parent, "stylesheet.ss"); if ( ssfile != NULL ) { diff --git a/src/sc_editor.c b/src/sc_editor.c index e95beb4..2f272d3 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -764,10 +764,10 @@ static void draw_resize_handle(cairo_t *cr, double x, double y) static void draw_overlay(cairo_t *cr, SCEditor *e) { - double x, y, w, h; - if ( e->selection != NULL ) { + double x, y, w, h; + draw_editing_box(cr, e->selection); x = e->selection->x; @@ -2139,8 +2139,6 @@ SCEditor *sc_editor_new(SCBlock *scblocks, Stylesheet *stylesheet, sceditor->stylesheet = stylesheet; - sceditor->bg_pixbuf = NULL; - err = NULL; sceditor->bg_pixbuf = gdk_pixbuf_new_from_resource("/uk/me/bitwiz/Colloquium/sky.png", &err); diff --git a/src/sc_interp.c b/src/sc_interp.c index f2f604b..9495feb 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -270,13 +270,6 @@ static int check_callback(SCInterpreter *scin, SCBlock *bl) } -PangoFont *sc_interp_get_font(SCInterpreter *scin) -{ - struct sc_state *st = &scin->state[scin->j]; - return st->font; -} - - PangoFontDescription *sc_interp_get_fontdesc(SCInterpreter *scin) { struct sc_state *st = &scin->state[scin->j]; diff --git a/src/sc_parse.c b/src/sc_parse.c index a0ec8a5..e1b797a 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -567,11 +567,10 @@ static void separate_newlines(SCBlock *bl) { while ( bl != NULL ) { - char *npos; const char *contents = sc_block_contents(bl); if ( contents != NULL ) { - npos = strchr(contents, '\n'); + char *npos = strchr(contents, '\n'); if ( npos != NULL ) { SCBlock *nb = NULL; if ( npos == contents ) { diff --git a/src/slide_window.c b/src/slide_window.c index e23a3d7..0f27b10 100644 --- a/src/slide_window.c +++ b/src/slide_window.c @@ -61,18 +61,6 @@ struct _slidewindow SCBlock *scblocks; SCEditor *sceditor; - - struct menu_pl *style_menu; - int n_style_menu; -}; - - -/* Inelegance to make furniture selection menus work */ -struct menu_pl -{ - SlideWindow *sw; - char *style_name; - GtkWidget *widget; }; @@ -180,12 +168,6 @@ static void last_slide_sig(GSimpleAction *action, GVariant *parameter, } -void slidewindow_redraw(SlideWindow *sw) -{ - sc_editor_redraw(sw->sceditor); -} - - static gboolean sw_close_sig(GtkWidget *w, SlideWindow *sw) { sw->p->slidewindow = NULL; -- cgit v1.2.3