On Thursday 05 June 2008 07:44:11 François Perrad wrote:

> I'm not sure.
> Since r26988, I've same failure on Windows, with mingw gcc-3.4.2, and
> perl 5.8.8 (build 822 from ActiveState).
>
> The following patch solves (or hides) the problem
> Index: src/string.c
> ===================================================================
> --- src/string.c      (revision 28084)
> +++ src/string.c      (working copy)
> @@ -284,7 +284,7 @@
>       for (i = 0; i < n_parrot_cstrings; ++i) {
>           interp->const_cstring_table[i] = string_make_direct(interp,
>                   parrot_cstrings[i].string,
> -                parrot_cstrings[i].len,
> +                strlen(parrot_cstrings[i].string),
>                   PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET,
>                   PObj_external_FLAG|PObj_constant_FLAG);
>       }
>
> Now, I start to investigate where are the difference with the following
> code :
>   for (i = 0; i < n_parrot_cstrings; ++i) {
>       if (strlen(parrot_cstrings[i].string) != parrot_cstrings[i].len) {
>           printf("string_init %d %d 0x%08x %s\n",
>                  strlen(parrot_cstrings[i].string),
>                  parrot_cstrings[i].len,
>                  parrot_cstrings[i].hash_val,
>                  parrot_cstrings[i].string);
>       }
>       interp->const_cstring_table[i] = string_make_direct(interp,
>               parrot_cstrings[i].string,
>               strlen(parrot_cstrings[i].string),
>               PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET,
>               PObj_external_FLAG|PObj_constant_FLAG);
>   }
>
> I obtain the following ouput (note the newline):
> string_init 1 2 0x00000c38 \
> string_init 3 4 0x00334876 ?%d
> string_init 1 2 0x00000c4a
>
> string_init 1 4 0x003477f8 "
> string_init 2 3 0x000193b0 \x
> string_init 2 3 0x000193ad \u
> string_init 0 2 0x00000c0c
>
> I suspect a problem in c2str.pl string only on Windows, something like a
> missing or bad binmode.

Look at get_length() in tools/build/c2str.pl.  If that's the problem (and it 
looks like it is), that's the place to fix it.

-- c

Reply via email to