On Fri, 2014-09-05 at 15:51 +0200, EdB wrote: > On Friday, September 05, 2014 09:30:52 AM Francisco Jerez wrote: > > Jan Vesely <[email protected]> writes: > > > It's unsafe as compat::string is not null terminated. > > > Fixes garbage log on successful build. > > > > > > Signed-off-by: Jan Vesely <[email protected]> > > > --- > > > > > > It's obviously not needed in program::build, but I'm not sure > > > if runtime_error solution is the best one. > > > > Meh, I've just pushed the fix for c_str() I submitted to the list weeks > > ago: > > > > http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4539274b6478249d52e99fa342 > > 43daacf48be80 > > > > Thanks. > > For reference, we discuss it on this thread: > http://lists.freedesktop.org/archives/mesa-dev/2014-August/065114.html
thanks for pointing me to this. don't know why I missed it.
I sent my rb to the other half of the patch.
jan
>
>
> >
> > > src/gallium/state_trackers/clover/core/program.cpp | 4 ++--
> > > src/gallium/state_trackers/clover/util/compat.cpp | 2 +-
> > > src/gallium/state_trackers/clover/util/compat.hpp | 5 -----
> > > 3 files changed, 3 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/src/gallium/state_trackers/clover/core/program.cpp
> > > b/src/gallium/state_trackers/clover/core/program.cpp index
> > > 30a1f0e..3e9abec 100644
> > > --- a/src/gallium/state_trackers/clover/core/program.cpp
> > > +++ b/src/gallium/state_trackers/clover/core/program.cpp
> > > @@ -61,9 +61,9 @@ program::build(const ref_vector<device> &devs, const
> > > char *opts) {>
> > > dev.ir_target(),
> > > build_opts(dev),
> > > log));
> > >
> > > _binaries.insert({ &dev, module });
> > >
> > > - _logs.insert({ &dev, std::string(log.c_str()) });
> > > + _logs.insert({ &dev, std::string(log) });
> > >
> > > } catch (const build_error &) {
> > >
> > > - _logs.insert({ &dev, std::string(log.c_str()) });
> > > + _logs.insert({ &dev, std::string(log) });
> > >
> > > throw;
> > >
> > > }
> > >
> > > }
> > >
> > > diff --git a/src/gallium/state_trackers/clover/util/compat.cpp
> > > b/src/gallium/state_trackers/clover/util/compat.cpp index
> > > 80d5b3e..afba92e 100644
> > > --- a/src/gallium/state_trackers/clover/util/compat.cpp
> > > +++ b/src/gallium/state_trackers/clover/util/compat.cpp
> > > @@ -34,5 +34,5 @@ exception::what() const {
> > >
> > > const char *
> > > runtime_error::what() const {
> > >
> > > - return _what.c_str();
> > > + return ((std::string)_what).c_str();
> > >
> > > }
> > >
> > > diff --git a/src/gallium/state_trackers/clover/util/compat.hpp
> > > b/src/gallium/state_trackers/clover/util/compat.hpp index
> > > 50e1c7d..b3668c5 100644
> > > --- a/src/gallium/state_trackers/clover/util/compat.hpp
> > > +++ b/src/gallium/state_trackers/clover/util/compat.hpp
> > > @@ -280,11 +280,6 @@ namespace clover {
> > >
> > > }
> > >
> > > const char *
> > >
> > > - c_str() const {
> > > - return begin();
> > > - }
> > > -
> > > - const char *
> > >
> > > find(const string &s) const {
> > >
> > > for (size_t i = 0; i + s.size() < size(); ++i) {
> > >
> > > if (!std::memcmp(begin() + i, s.begin(), s.size()))
>
--
Jan Vesely <[email protected]>
signature.asc
Description: This is a digitally signed message part
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
