[gimp] selection-to-path: Fix an uninitialized variable



commit 1a025e4fbd56afe7c55bd33579c072da7565550e
Author: Mukund Sivaraman <muks banu com>
Date:   Fri May 6 19:47:41 2011 +0530

    selection-to-path: Fix an uninitialized variable

 plug-ins/selection-to-path/fit.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/selection-to-path/fit.c b/plug-ins/selection-to-path/fit.c
index 26f1f3a..747db0c 100644
--- a/plug-ins/selection-to-path/fit.c
+++ b/plug-ins/selection-to-path/fit.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <string.h>
 #include <float.h>
 #include <math.h>
 #include <assert.h>
@@ -1111,6 +1112,13 @@ fit_with_least_squares (curve_type curve)
   real previous_error = FLT_MAX;
   real improvement = FLT_MAX;
 
+  /* FIXME: Initialize best_spline to zeroes. This is strictly not
+     necessary as best_spline is always set in the loop below. But the
+     compiler thinks it isn't and warns. Ideally, the code should be
+     rewritten such that best_spline and best_error are initialized with
+     the first values before the loop begins. */
+  memset (&best_spline, 0, sizeof best_spline);
+
 /*   LOG ("\nFitting with least squares:\n"); */
 
   /* Phoenix reduces the number of points with a ``linear spline



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]