POV-Ray : Newsgroups : povray.unofficial.patches : compiling megapov.. : Re: compiling megapov.. Server Time
3 May 2024 10:32:57 EDT (-0400)
  Re: compiling megapov..  
From: Shihan
Date: 11 Nov 2006 09:15:01
Message: <web.4555dac4bb14a4e969dedb9b0@news.povray.org>
Nicolas Calimet <pov### [at] freefr> wrote:
> > #0  0x00000038ec873cb0 in strlen () from /lib64/libc.so.6
> > #1  0x00000038ec85dcae in fputs () from /lib64/libc.so.6
> > #2  0x00000000004407a6 in pov::POV_Std_Display_Init (w=Variable "w" is not
> > available.
> > ) at userdisp.cpp:66
>
>  OK, the problem was introduced in megapov and is simple to fix.
> Edit the file source/userdisp.cpp and change the line 65 from:
>  char *s = NULL;
> to
>  char *s = "";
> and the segmentation fault should go away.  Do the same at lines 97 and 117.
>
>  Even better, as the AVOID_EMPTY_STRING_WARNING megapov patch is quite
> ugly IMHO, you may apply the following *untested* patch (the code should work,
> but I cannot verify whether it will fill its purpose of avoiding a compiler
> warning).  Paste the following into  patchfile  and apply the patch as:
>
> patch -p0 < patchfile
>
>
> % cat patchfile
> --- userdisp.cpp.bak    2005-08-23 21:20:33.000000000 +0200
> +++ userdisp.cpp        2006-11-11 13:57:09.000000000 +0100
> @@ -62,8 +62,7 @@
>     Prev_X = 0;
>     Prev_Y = 0;
>     #ifdef AVOID_EMPTY_STRING_WARNING
> -    char *s = NULL;
> -    fprintf(stderr, "%s", s);
> +    fprintf(stderr, "%s", "");
>     #else
>       fprintf(stderr, "");
>     #endif
> @@ -94,8 +93,7 @@
>   void POV_Std_Display_Close()
>   {
>     #ifdef AVOID_EMPTY_STRING_WARNING
> -    char *s = NULL;
> -    fprintf(stderr, "%s", s);
> +    fprintf(stderr, "%s", "");
>     #else
>       fprintf(stderr, "");
>     #endif
> @@ -114,8 +112,7 @@
>       Prev_Y++;
>
>     #ifdef AVOID_EMPTY_STRING_WARNING
> -    char *s = NULL;
> -    fprintf(stderr, "%s", s);
> +    fprintf(stderr, "%s", "");
>     #else
>       fprintf(stderr, "");
>     #endif
>
>
>  Hope this helps,
>  - NC

Yes, this does indeed work, as does the -D. With the patch, -D is no longer
required.

Thanks heaps guys!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.