On 04/30/08 Thomas Regner uttered the following other thing:
> Hello,
>
> the code in cs/ does not pass it's testsuite on amd64 machines, at least not
> on mine and a quick search on the net confirmed that others have the problem
> too.
>
> The crc32 result is assigned to a long field and therfore does not "wrap
> around" (get negative).
>
> I was able to solve this issue by explicitly casting the ne_crc()-result to
> INT32 (as typedef'ed in neo_misc.h) when assigned to result->n (a long
> field).
>
> The code compiles and runs just fine and passes the testsuite.
>
> The simple patch:
> ---------------------%<--------------------
> *** cs/csparse.c.orig 2007-07-12 04:37:34.000000000 +0200
> --- cs/csparse.c 2008-04-30 20:39:42.000000000 +0200
> ***************
> *** 3717,3723 ****
> if (val.op_type & (CS_TYPE_VAR | CS_TYPE_STRING))
> {
> char *s = arg_eval(parse, &val);
> ! if (s) result->n = ne_crc((unsigned char *)s, strlen(s));
> }
> if (val.alloc) free(val.s);
> return STATUS_OK;
> --- 3717,3723 ----
> if (val.op_type & (CS_TYPE_VAR | CS_TYPE_STRING))
> {
> char *s = arg_eval(parse, &val);
> ! if (s) result->n = (INT32) ne_crc((unsigned char *)s, strlen(s));
> }
> if (val.alloc) free(val.s);
> return STATUS_OK;
> ---------------------%<--------------------
>
> If there is a problem with this I don't see, please comment so that I can
> search for another solution.
Yeah, that seems like a fine result. I've known about the issue, but
didn't have a good idea of the "right" solution... the crc result would
be different, but its not necessarily "wrong".
Brandon
--
"The family seems to have two predominant functions: to provide
warmth and love in time of need and to drive each other insane."
-- Donald G. Smith
http://www.fiction.net/blong/