From 82cc5883c8a7bfbaffe57ed79174fe1a23121bcf Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Sat, 3 Dec 2016 21:22:51 +0100
Subject: [PATCH] Fix some gcc warnings and dubious constructs.

---
 pd/src/g_array.c    | 12 +++++++++---
 pd/src/g_template.c |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index a34abd4e8..2706f685e 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -93,10 +93,10 @@ void array_resize_and_redraw(t_array *array, t_glist *glist, int n)
     while (a2->a_gp.gp_stub->gs_which == GP_ARRAY)
         a2 = a2->a_gp.gp_stub->gs_un.gs_array;
     if (vis)
-        gobj_vis(&a2->a_gp.gp_un.gp_gobj, glist, 0);
+        gobj_vis(a2->a_gp.gp_un.gp_gobj, glist, 0);
     array_resize(array, n);
     if (vis)
-        gobj_vis(&a2->a_gp.gp_un.gp_gobj, glist, 1);
+        gobj_vis(a2->a_gp.gp_un.gp_gobj, glist, 1);
 }
 
 void word_free(t_word *wp, t_template *template);
@@ -1077,7 +1077,8 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
         t_float best = -1;
             /* if it has more than 2000 points, just check 1000 of them. */
         int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000);
-        t_float pxpix1, pxpix2, pypix, pwpix, dx, dy, dy2, dy3;
+        t_float pxpix1 = 0.0, pxpix2 = 0.0, pypix = 0.0, pwpix = 0.0,
+          dx, dy, dy2, dy3;
         for (i = 0; i < array->a_n; i += incr)
         {
             array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize,
@@ -1166,6 +1167,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
 
 /* from array-rev */
 
+#if 0 // this doesn't seem to be used anywhere -ag
             int hit = 0;
             if(array_joc)
             {
@@ -1173,6 +1175,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
             }
             else
                 hit = dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best;
+#endif
 /* end array-rev */
 
                 if (dy < dy2 && dy < dy3)
@@ -1311,6 +1314,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
     return (0);
 }
 
+#if 0 // this doesn't seem to be used anywhere -ag
 static void array_getrect(t_array *array, t_glist *glist,
     int *xp1, int *yp1, int *xp2, int *yp2)
 {
@@ -1354,6 +1358,7 @@ static void array_getrect(t_array *array, t_glist *glist,
     *xp2 = x2;
     *yp2 = y2;
 }
+#endif
 
 /* -------------------- widget behavior for garray ------------ */
 
@@ -1379,6 +1384,7 @@ static void garray_select(t_gobj *z, t_glist *glist, int state)
     //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n",
     //    glist_getcanvas(glist), x->x_glist, state);
 
+    extern void scalar_select(t_gobj *z, t_glist *owner, int state);
     scalar_select((t_gobj *)x->x_scalar, glist, state);
 }
 
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 7e52fa24f..6a7defc09 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -5483,7 +5483,7 @@ static void plot_getrect(t_gobj *z, t_glist *glist,
     if (x->x_canvas->gl_owner && x->x_canvas->gl_svg)
         svg_dogroupmtx(x->x_canvas, template, data, mtx1);
     //post("plot_getrect matrix: %g %g %g %g %g %g",
-    //  mtx1[0][0], mtx1[1][0], mtx1[0][1], mtx1[1][1], mtx1[0][2], mtx1[2][1]);
+    //  mtx1[0][0], mtx1[1][0], mtx1[0][1], mtx1[1][1], mtx1[0][2], mtx1[1][2]);
     int elemsize, yonset, wonset, xonset;
     t_canvas *elemtemplatecanvas;
     t_template *elemtemplate;
-- 
GitLab