On Wed, Sep 25, 2002 at 01:17:29PM -0500, Albert Chin wrote:
> 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));
> }
Cute, but very nonstandard ... it shouldn't be there by default. (But
perhaps it's something worth using ourselves; it does help const safety.)
> So, should I replace 'const char *' with 'char *' in:
> void FileAccess::SetSuggestedFileName(const char *fn)
No, try the attached.
--
Glenn Maynard
Index: FileAccess.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/FileAccess.cc,v
retrieving revision 1.103
diff -u -r1.103 FileAccess.cc
--- FileAccess.cc 2002/08/09 11:43:41 1.103
+++ FileAccess.cc 2002/09/25 20:16:42
@@ -752,7 +752,7 @@
return;
// don't allow subdirectories.
- char *slash=strchr(fn,'/');
+ const char *slash=strchr(fn,'/');
if(slash)
return;
slash=strchr(fn,'\\');