[Mesa-dev] [PATCH 1/3] clover: fix _logs string creation

EdB edb+mesa at sigluy.net
Mon Aug 18 03:01:10 PDT 2014


On Monday, August 18, 2014 09:20:03 AM Francisco Jerez wrote:
> EdB <edb+mesa at sigluy.net> writes:
> > compact::string is not \0 terminated.
> > size() need to be used for std::string creation
> > ---
> > 
> >  src/gallium/state_trackers/clover/core/program.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/gallium/state_trackers/clover/core/program.cpp
> > b/src/gallium/state_trackers/clover/core/program.cpp index
> > e09c3aa..3f504d5 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.c_str(), log.size()) });
> > 
> >           } catch (const build_error &) {
> > 
> > -            _logs.insert({ &dev, std::string(log.c_str()) });
> > +            _logs.insert({ &dev, std::string(log.c_str(), log.size()) });
> 
> Both of these should just be using the conversion operator.  See
> attachment.

Agreed, I was highlighting the problem.
Yours is better.

Thanks

> 
> >              throw;
> >           
> >           }
> >        
> >        }
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list