On Wed, Sep 25, 2002 at 01:17:29PM -0500, Albert Chin wrote:
> On Wed, Sep 25, 2002 at 11:11:47AM +0400, Alexander V. Lukyanov wrote:
> > On Tue, Sep 24, 2002 at 07:56:02AM -0500, Albert Chin wrote:
> > >        : KeyValueDB::Pair(n,s->GetConnectURL())
> > >          ^^^^^^^^^^^^^^^^                      
> > > Error 182: "ConnectionSlot.cc", line 35 #
> > >     "ConnectionSlot::SlotValue::SlotValue(const char *,const char *)" cannot
> > >     access protected member class Pair.
> > 
> > This patch should fix it.
> 
> Thanks. That fixed it. Next problem:
> 
> aCC -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -I/opt/TWWfsw/readline42a/include -I/opt/TWWfsw/ncurses5/include
> -I/opt/TWWfsw/gettext011/include -I/opt/TWWfsw/libiconv18/include  +O2
> -AA -z +Onofltacc +ESlit +DAportable +Oentrysched +Odataprefetch
> +Onolimit -I/opt/TWWfsw/readline42a/include
> -I/opt/TWWfsw/ncurses5/include -c -o FileAccess.o `test -f
> 'FileAccess.cc' || echo './'`FileAccess.cc
> Error 203: "FileAccess.cc", line 758 # Cannot assign 'char *' with
> 'const char
>     *'.
>        slash=strchr(fn,'\\');
>              ^^^^^^^^^^^^^^^ 
> gmake[1]: *** [FileAccess.o] Error 2
> gmake[1]: Leaving directory `/opt/build/lftp-2.6.2/src'
> 
> This is because strchr has:
>  extern "C" const char* strchr(const char *, int);
>  
>  inline char* strchr(char *s, int c) {
>  return const_cast<char*> (strchr(const_cast<const char*>(s), c));
>  }
> 
> So, should I replace 'const char *' with 'char *' in:
>   void FileAccess::SetSuggestedFileName(const char *fn)

The patch below fixes it.

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
--- src/FileAccess.cc.orig      Wed Sep 25 13:44:49 2002
+++ src/FileAccess.cc   Wed Sep 25 14:26:35 2002
@@ -752,11 +752,7 @@
       return;
 
    // don't allow subdirectories.
-   char *slash=strchr(fn,'/');
-   if(slash)
-      return;
-   slash=strchr(fn,'\\');
-   if(slash)
+   if(strchr(fn,'/') || strchr(fn,'\\'))
       return;
    for(int i=0; fn[i]; i++)
    {

Reply via email to