David Binderman <dcb...@hotmail.com> writes:

> [subversion-1.9.0-beta1/subversion/bindings/javahl/native/JNIUtil.cpp:583]:
> (error) Dangerous usage of c_str(). The value returned by c_str() is
> invalid after this call.
>
>
> #ifdef SVN_DEBUG
> #ifndef SVN_ERR__TRACING
>   if (err->file)
>     {
>       std::ostringstream buf;
>       buf << err->file;
>       if (err->line> 0)
>         buf << ':' << err->line;
>       source = buf.str().c_str();
>     }
> #endif
> #endif
>
> Luckily, it's only debug code, but you might want to fix it anyway.

Yes, that is wrong.  How did you find this?  I would not expect a
compiler to ever see this bit of code as svn_error.h has:

#ifdef SVN_DEBUG
#define SVN_ERR__TRACING
#endif

I can change that bit of JNIUtil.cpp code to junk and it still builds.

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*

Reply via email to