According to Geoff Hutchison:
> [EMAIL PROTECTED] wrote:
> >  > I'm still in the process of cleaning up the build with gcc-2.95, which
> >  > finds some new compilation errors.
> > 
> >  What about adding -Wall everywhere ?
> 
> On a day-to-day basis, I compile with '-W -Wall' and send the stderr to
> a file. Periodically I'll sift through the file and clean out some
> warnings (thus the messages about fixing compiler 'warnings').
> 
> In this case, gcc-2.95 is much more strict about requiring standard C++,
> so some constructs that were flagged as warnings became errors and
> halted the compilation. I fixed those, though I'm not really happy about
> this. The previous call to cgi() discarded const, which is forbidden
> now. Even if I changed the cgi() call sequence, it seemed like I'd need
> to have a strcpy somewhere. It looks wrong to me, though it does work.
> 
> 
> ***************
> *** 102,108 ****
>       //
>       // Parse the CGI parameters.
>       //
> !     cgi               input(optind < ac ? av[optind] : "");
>   
>       //
>       // Compile the URL limit pattern.
> --- 102,110 ----
>       //
>       // Parse the CGI parameters.
>       //
> !     char      *input_str;
> !     strcpy(input_str, (optind < ac ? av[optind] : ""));
> !     cgi               input(input_str);
>   
>       //
>       // Compile the URL limit pattern.

It is wrong.  You can't strcpy to an uninitialised char *.  You'll end up
clobbering a random memory location!  You could use a String as Loic
suggested, but perhaps this will do the trick:

    char        none[] = "";
    cgi         input(optind < ac ? av[optind] : none);

I'm assuming that the warning was because of the "" (which is const char *)
as an argument to cgi(), which can't be const char * because it's declared
simply as char *.  The intermediate variable none should avoid the problem.
If that doesn't work, how about:

    char        none[] = "";
    char        *input_str = (optind < ac ? av[optind] : none);
    cgi         input(input_str);

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to