[genius] Mon Sep 22 13:17:18 2014 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Mon Sep 22 13:17:18 2014 Jiri (George) Lebl <jirka 5z com>
- Date: Mon, 22 Sep 2014 18:17:33 +0000 (UTC)
commit 1daf133dbd945bda1e267aeff547cca9a57e18d0
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Mon Sep 22 13:17:22 2014 -0500
Mon Sep 22 13:17:18 2014 Jiri (George) Lebl <jirka 5z com>
* src/examples.c, gtkextra/*.c: fix compiler warnings. Also fix an
overuse of strlen, won't really improve performance, but I find
using "strlen(s) == 0" just annoying enough to make me change it
anyhow
ChangeLog | 7 +++++++
gtkextra/gtkplot.c | 10 +++++++---
gtkextra/gtkplotcairo.c | 4 ++--
gtkextra/gtkplotcsurface.c | 2 +-
gtkextra/gtkplotdt.c | 4 ++--
gtkextra/gtkplotflux.c | 10 +++++-----
gtkextra/gtkplotgdk.c | 6 +++---
gtkextra/gtkplotpc.c | 2 +-
gtkextra/gtkplotps.c | 2 +-
gtkextra/gtkplotsurface.c | 20 ++++++++++----------
src/examples.c | 5 +----
11 files changed, 40 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1856a9d..ec64714 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Sep 22 13:17:18 2014 Jiri (George) Lebl <jirka 5z com>
+
+ * src/examples.c, gtkextra/*.c: fix compiler warnings. Also fix an
+ overuse of strlen, won't really improve performance, but I find
+ using "strlen(s) == 0" just annoying enough to make me change it
+ anyhow
+
Thu Sep 18 17:52:37 2014 Jiri (George) Lebl <jirka 5z com>
* src/gnome-genius.c: Fix tab reordering, and add the close button
diff --git a/gtkextra/gtkplot.c b/gtkextra/gtkplot.c
index 5e3d5f7..b9affcb 100644
--- a/gtkextra/gtkplot.c
+++ b/gtkextra/gtkplot.c
@@ -3809,7 +3809,7 @@ gtk_plot_draw_text(GtkPlot *plot,
GtkAllocation allocation;
if(!text.text) return;
- if(strlen(text.text) == 0) return;
+ if(text.text[0] == '\0') return;
if(plot->drawable == NULL) return;
gtk_widget_get_allocation(GTK_WIDGET(plot), &allocation);
@@ -3827,7 +3827,7 @@ gtk_plot_paint_text(GtkPlot *plot,
gdouble m = plot->magnification;
if(!text.text) return;
- if(strlen(text.text) == 0) return;
+ if(text.text[0] == '\0') return;
if(plot->drawable == NULL) return;
gtk_plot_pc_draw_string(plot->pc,
@@ -3886,7 +3886,11 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
PangoContext *context;
gint i = 0;
- if(!text || strlen(text) == 0) return;
+
+ if (text == NULL || text[0] == '\0') {
+ *width = *height = *ascent = *descent = 0;
+ return;
+ }
layout = pango_layout_new(context = gdk_pango_context_get_for_screen(gdk_screen_get_default()));
g_object_unref(G_OBJECT(context));
pango_layout_set_text(layout, text, -1);
diff --git a/gtkextra/gtkplotcairo.c b/gtkextra/gtkplotcairo.c
index e0c5147..ef4c4b0 100644
--- a/gtkextra/gtkplotcairo.c
+++ b/gtkextra/gtkplotcairo.c
@@ -609,7 +609,7 @@ drawstring(GtkPlotPC *pc,
gint dpi_cairo, dpi_screen;
GdkScreen *screen = gdk_screen_get_default();
- if(!text || strlen(text) == 0) return 0;
+ if(!text || text[0] == '\0') return 0;
cairo_save(cairo);
map = pango_cairo_font_map_get_default();
@@ -619,7 +619,7 @@ drawstring(GtkPlotPC *pc,
height *= (double)dpi_screen/(double)dpi_cairo;
font = gtk_psfont_get_font_description(psfont, height);
pango_layout_set_font_description(GTK_PLOT_CAIRO(pc)->layout, font);
- pango_layout_set_text(GTK_PLOT_CAIRO(pc)->layout, text, strlen(text));
+ pango_layout_set_text(GTK_PLOT_CAIRO(pc)->layout, text, -1);
pango_layout_get_extents(GTK_PLOT_CAIRO(pc)->layout, NULL, &rect);
if (psfont->i18n_latinfamily && psfont->vertical) {
diff --git a/gtkextra/gtkplotcsurface.c b/gtkextra/gtkplotcsurface.c
index b448d78..f58253d 100644
--- a/gtkextra/gtkplotcsurface.c
+++ b/gtkextra/gtkplotcsurface.c
@@ -1666,7 +1666,7 @@ gtk_plot_csurface_draw_legend(GtkPlotData *data, gint x, gint y)
&lwidth, &lheight,
&lascent, &ldescent);
- if(GTK_PLOT_DATA(data)->show_legend && data->legend && strlen(data->legend) > 0){
+ if(GTK_PLOT_DATA(data)->show_legend && data->legend && data->legend[0] != '\0'){
legend.x = (gdouble)(area.x + x + roundint(4 * m))
/ (gdouble)area.width;
legend.y = (gdouble)(area.y + y + lascent) / (gdouble)area.height;
diff --git a/gtkextra/gtkplotdt.c b/gtkextra/gtkplotdt.c
index 2e15c7c..e7f0cae 100644
--- a/gtkextra/gtkplotdt.c
+++ b/gtkextra/gtkplotdt.c
@@ -1085,7 +1085,7 @@ gtk_plot_dt_triangulate_tryquad(GtkPlotDT *data)
GList *xrow_prev, *xrow_next= NULL, *xrow_sec= NULL;
GtkPlotDTnode *node, *x0y0, *x0y1, *x1y0, *x1y1, *center;
gint i, nc, nx= 0, ny= 0, x, y, num_mid, m;
- double x0;
+ /* double x0;*/
if (!data) return 0;
if (!data || ! data->nodes || data->node_cnt<3) return 0;
@@ -1096,7 +1096,7 @@ gtk_plot_dt_triangulate_tryquad(GtkPlotDT *data)
nodes= g_list_insert_sorted(nodes,node,gtk_plot_dt_compare_nodes_xy_wise);
}
- x0= ((GtkPlotDTnode *)nodes->data)->x;
+ /* x0= ((GtkPlotDTnode *)nodes->data)->x; */
/* sort order: x0y0 x0y1 x0y2 .. x1y0 x1y1 x1y2 .. xnyn */
for (list=nodes, i=0; list; list=list->next, i++) {
diff --git a/gtkextra/gtkplotflux.c b/gtkextra/gtkplotflux.c
index feea0be..86274a3 100644
--- a/gtkextra/gtkplotflux.c
+++ b/gtkextra/gtkplotflux.c
@@ -457,7 +457,7 @@ gtk_plot_flux_draw_symbol(GtkPlotData *dataset,
{
GtkPlot *plot;
GtkPlotFlux *flux = NULL;
- GdkRectangle area; //, clip_area;
+ //GdkRectangle area; //, clip_area;
gdouble m;
gdouble x1 = 0.0, y1 = 0.0, x2 = 0.0, y2=0.0;
gdouble factor, size, xm;
@@ -474,10 +474,10 @@ gtk_plot_flux_draw_symbol(GtkPlotData *dataset,
m = plot->magnification;
gtk_widget_get_allocation( GTK_WIDGET(plot), &allocation);
- area.x = allocation.x;
- area.y = allocation.y;
- area.width = allocation.width;
- area.height = allocation.height;
+ //area.x = allocation.x;
+ //area.y = allocation.y;
+ //area.width = allocation.width;
+ //area.height = allocation.height;
/*
clip_area.x = area.x + roundint(plot->x * area.width);
diff --git a/gtkextra/gtkplotgdk.c b/gtkextra/gtkplotgdk.c
index a5c8d32..8becc9c 100644
--- a/gtkextra/gtkplotgdk.c
+++ b/gtkextra/gtkplotgdk.c
@@ -567,11 +567,11 @@ drawstring(GtkPlotPC *pc,
PangoRectangle rect;
gint ret_value;
- if(!text || strlen(text) == 0) return 0;
+ if(!text || text[0] == '\0') return 0;
font = gtk_psfont_get_font_description(psfont, height);
pango_layout_set_font_description(GTK_PLOT_GDK(pc)->layout, font);
- pango_layout_set_text(GTK_PLOT_GDK(pc)->layout, text, strlen(text));
+ pango_layout_set_text(GTK_PLOT_GDK(pc)->layout, text, -1);
pango_layout_get_extents(GTK_PLOT_GDK(pc)->layout, NULL, &rect);
if (psfont->i18n_latinfamily && psfont->vertical) {
@@ -648,7 +648,7 @@ gtk_plot_gdk_draw_string (GtkPlotPC *pc,
if(!GTK_PLOT_GDK(pc)->drawable) return;
if(!GTK_PLOT_GDK(pc)->gc) return;
- if(!text || strlen(text) == 0) return;
+ if(!text || text[0] == '\0') return;
gc = GTK_PLOT_GDK(pc)->gc;
layout = GTK_PLOT_GDK(pc)->layout;
diff --git a/gtkextra/gtkplotpc.c b/gtkextra/gtkplotpc.c
index 4d9477f..732a9ae 100644
--- a/gtkextra/gtkplotpc.c
+++ b/gtkextra/gtkplotpc.c
@@ -410,7 +410,7 @@ void gtk_plot_pc_draw_string (GtkPlotPC *pc,
{
if(!text) return;
- if(strlen(text) == 0) return;
+ if(text[0] == '\0') return;
GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_string(pc, x, y,
angle,
diff --git a/gtkextra/gtkplotps.c b/gtkextra/gtkplotps.c
index fcb0ee4..f36dff2 100644
--- a/gtkextra/gtkplotps.c
+++ b/gtkextra/gtkplotps.c
@@ -922,7 +922,7 @@ psdrawstring (GtkPlotPC *pc,
gchar *curstr, bkspchar[3];
gchar num[4];
- if (text == NULL || strlen(text) == 0) return;
+ if (text == NULL || text[0] == '\0') return;
psout = GTK_PLOT_PS(pc)->psfile;
diff --git a/gtkextra/gtkplotsurface.c b/gtkextra/gtkplotsurface.c
index bb2e3f6..cf010a6 100644
--- a/gtkextra/gtkplotsurface.c
+++ b/gtkextra/gtkplotsurface.c
@@ -944,7 +944,7 @@ gtk_plot_surface_get_legend_size(GtkPlotData *data, gint *width, gint *height)
m = plot->magnification;
legend = plot->legends_attr;
- if(data->legend && strlen(data->legend) > 0)
+ if(data->legend && data->legend[0] != '\0')
legend.text = data->legend;
else
legend.text = "X";
@@ -993,7 +993,7 @@ gtk_plot_surface_draw_legend(GtkPlotData *data, gint x, gint y)
m = plot->magnification;
legend = plot->legends_attr;
- if(data->legend && strlen(data->legend) > 0)
+ if(data->legend && data->legend[0] != '\0')
legend.text = data->legend;
else
legend.text = "X";
@@ -1033,7 +1033,7 @@ gtk_plot_surface_draw_legend(GtkPlotData *data, gint x, gint y)
/ (gdouble)area.width;
legend.y = (gdouble)(area.y + y + lascent) / (gdouble)area.height;
- if(data->legend && strlen(data->legend) > 0) gtk_plot_draw_text(plot, legend);
+ if(data->legend && data->legend != '\0') gtk_plot_draw_text(plot, legend);
y += 2*lheight;
} else
@@ -2013,7 +2013,7 @@ compare_func (gpointer a, gpointer b)
GtkPlotPolygon *pa, *pb;
GtkPlotDTtriangle *ta, *tb;
gint i, j;
- gint na[3], nb[3];
+ //gint na[3], nb[3];
gint naz[3], nbz[3];
gdouble pax[3], pbx[3];
gdouble pay[3], pby[3];
@@ -2074,9 +2074,9 @@ compare_func (gpointer a, gpointer b)
if(zg == 9) return 1;
if(zl == 9) return -1;
- na[0] = nb[0] = 0;
- na[1] = nb[1] = 1;
- na[2] = nb[2] = 2;
+ //na[0] = nb[0] = 0;
+ //na[1] = nb[1] = 1;
+ //na[2] = nb[2] = 2;
pax[0] = ta->na->px;
pax[1] = ta->nb->px;
@@ -2109,9 +2109,9 @@ compare_func (gpointer a, gpointer b)
return(czb > cza ? 1 : -1);
}
- na[0] = nb[0] = 0;
- na[1] = nb[1] = 1;
- na[2] = nb[2] = 2;
+ //na[0] = nb[0] = 0;
+ //na[1] = nb[1] = 1;
+ //na[2] = nb[2] = 2;
pay[0] = ta->na->py;
pay[1] = ta->nb->py;
diff --git a/src/examples.c b/src/examples.c
index 18f5653..58dd6ad 100644
--- a/src/examples.c
+++ b/src/examples.c
@@ -53,9 +53,6 @@
GSList *gel_example_list = NULL;
-static GHashTable *opened = NULL;
-static GHashTable *info = NULL;
-
static GelExample *
gel_readexample (const char *dir_name, const char *file_name)
{
@@ -188,5 +185,5 @@ gel_read_example_list (void)
/* FIXME: should do more */
gel_example_list = g_slist_sort (gel_example_list,
- compare_examples);
+ (GCompareFunc)compare_examples);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]