John Darrington <[email protected]> writes: > On Fri, Sep 17, 2010 at 09:36:27PM -0700, Ben Pfaff wrote: > case_str_rw() returns uint8_t * but it was being assigned to a char *. > Changing the type of the variable fixes the problem. > > The real problem here is the call to memcpy just a few lines down. > memcpy is as bad (worse?) than a cast, because it uses void * so > avoids typechecking. This memcpy should be doing some recoding.
OK, how about the following then? Thanks, Ben. --8<--------------------------cut here-------------------------->8-- From: Ben Pfaff <[email protected]> Date: Sun, 19 Sep 2010 20:55:46 -0700 Subject: [PATCH] RECODE: Suppress warning about conversion using CHAR_CAST_BUG. --- src/language/xforms/recode.c | 39 ++++++++++++++++++++------------------- 1 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/language/xforms/recode.c b/src/language/xforms/recode.c index f4a19a9..aa051fe 100644 --- a/src/language/xforms/recode.c +++ b/src/language/xforms/recode.c @@ -20,24 +20,25 @@ #include <math.h> #include <stdlib.h> -#include <data/case.h> -#include <data/data-in.h> -#include <data/format.h> -#include <data/dictionary.h> -#include <data/procedure.h> -#include <data/transformations.h> -#include <data/variable.h> -#include <language/command.h> -#include <language/lexer/lexer.h> -#include <language/lexer/value-parser.h> -#include <language/lexer/variable-parser.h> -#include <libpspp/assertion.h> -#include <libpspp/compiler.h> -#include <libpspp/message.h> -#include <libpspp/pool.h> -#include <libpspp/str.h> - -#include "xalloc.h" +#include "data/case.h" +#include "data/data-in.h" +#include "data/dictionary.h" +#include "data/format.h" +#include "data/procedure.h" +#include "data/transformations.h" +#include "data/variable.h" +#include "language/command.h" +#include "language/lexer/lexer.h" +#include "language/lexer/value-parser.h" +#include "language/lexer/variable-parser.h" +#include "libpspp/assertion.h" +#include "libpspp/cast.h" +#include "libpspp/compiler.h" +#include "libpspp/message.h" +#include "libpspp/pool.h" +#include "libpspp/str.h" + +#include "gl/xalloc.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -680,7 +681,7 @@ recode_trns_proc (void *trns_, struct ccase **c, casenumber case_idx UNUSED) } else { - char *dst = case_str_rw (*c, dst_var); + char *dst = CHAR_CAST_BUG (char *, case_str_rw (*c, dst_var)); if (out != NULL) { if (!out->copy_input) -- 1.7.1 _______________________________________________ pspp-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/pspp-dev
