Hi Alex,
It works perfect.
Thanks for gearbox it's a great software. I hope we can contribute soon to
the project.
David.
On Tue, Feb 23, 2010 at 6:18 PM, Alex Brooks <a.brooks@...
> wrote:
> Hi David,
>
> Thanks for the bug report.
>
> How about this:
>
> const char *
> Exception::basename( const char *s ) const
> {
> #ifndef WIN32
> char *slashPos = strrchr( s, '/' );
> #else
> char *slashPos = strrchr( s, '\\' );
> #endif
> if ( slashPos == NULL )
> return s; // no slash found
> else
> return slashPos+1;
> };
>
> Will this work?
> On my system the filenames always have slashes so I can't test, but I've
> checked this version into svn -- let me know if you have any problems.
>
>
> Alex
>
> On Wed, 24 Feb 2010, David Lobato wrote:
> > Hi,
> >
> > I'm a developer in the Robotics Research Group at URJC [1]. We are
> > currently using gearbox in our software.
> > I think I've found a bug in exceptions.cpp:
> >
> > const char *
> > Exception::basename( const char *s ) const
> > {
> > #ifndef WIN32
> > return strrchr( s, '/' )+1;
> > #else
> > return strrchr( s, '\\' )+1;
> > #endif
> > };
> >
> > std::string
> > Exception::toMessageString( const char *file, const char *line, const
> > std::string &message ) const
> > {
> > std::string msg = "\n *** ERROR(";
> > // not to confuse our local basename() with gbxutilacfr::basename()
> > msg += this->basename(file);
> > msg += ":";
> > msg += line;
> > msg += "): " + message;
> > return msg;
> > }
> >
> >
> > In basename it is supposed that s contains a "/" or "\\" for WIN32, but
> > this is not true always so strrchr returns NULL+1 in this cases.
> > In our system gcc compiles files with absolute paths, so __FILE__ is
> > substituted with a file name without any slash, making my programs
> SEGFAULT
> > whenever an exception is thrown.
> >
> > The bug could be solved easily checking the return of strrchr.
> >
> > Thanks,
> > David.
> >
> >
> > [1] http://jderobot.org/index.php/Main_Page
>
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gearbox-users mailing list
> Gearbox-users@...
> https://lists.sourceforge.net/lists/listinfo/gearbox-users
>
|