pspp-dev
[Top][All Lists]
Advanced

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

Re: new warnings


From: Ben Pfaff
Subject: Re: new warnings
Date: Mon, 30 Jul 2012 23:18:49 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Ben Pfaff <address@hidden> writes:

> I see some new warnings on master.  This one looks serious:
>
> src/data/ods-reader.c: In function ‘ods_open_reader’:
> src/data/ods-reader.c:596: error: passing argument 1 of 
> ‘ods_file_casereader_destroy’ from incompatible pointer type
> src/data/ods-reader.c:120: note: expected ‘struct casereader *’ but argument 
> is of type ‘struct zip_reader *’

Looking more closely at this one, I guess we can just pass NULL
for that argument, since the function doesn't use it.

I don't see anything that destroys struct ods_reader's dict in
the successful case, so perhaps the dict_destroy() should be
moved into ods_file_casereader_destroy() so it gets executed in
both cases?

> This one seems probably less serious:
>
> src/language/stats/factor.c: In function ‘idata_free’:
> src/language/stats/factor.c:209: error: passing argument 1 of 
> ‘gsl_matrix_free’ discards qualifiers from pointer target type
> /usr/include/gsl/gsl_matrix_double.h:96: note: expected ‘struct gsl_matrix *’ 
> but argument is of type ‘const struct gsl_matrix *’

I pushed a commit to fix this one:

>From 8ff8dc1996d072491c4381cf24a7202be927b08a Mon Sep 17 00:00:00 2001
From: Ben Pfaff <address@hidden>
Date: Mon, 30 Jul 2012 23:16:39 -0700
Subject: [PATCH] FACTOR: Fix warning about discarding const qualifier.

---
 src/language/stats/factor.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/language/stats/factor.c b/src/language/stats/factor.c
index 568eb4d..36a49d3 100644
--- a/src/language/stats/factor.c
+++ b/src/language/stats/factor.c
@@ -35,6 +35,7 @@
 #include "language/lexer/lexer.h"
 #include "language/lexer/value-parser.h"
 #include "language/lexer/variable-parser.h"
+#include "libpspp/cast.h"
 #include "libpspp/message.h"
 #include "libpspp/misc.h"
 #include "math/correlation.h"
@@ -206,7 +207,7 @@ idata_free (struct idata *id)
   if (id->cov != NULL)
     gsl_matrix_free (id->cov);
   if (id->corr != NULL)
-    gsl_matrix_free (id->corr);
+    gsl_matrix_free (CONST_CAST (gsl_matrix *, id->corr));
 
   free (id);
 }
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]