Permalink
Browse files

ensure valid string concatenation

  • Loading branch information...
Dane Springmeyer
Dane Springmeyer committed Jul 5, 2012
1 parent d139e49 commit 49483fa2dd7ac2644e3a61d40c8016ce1cb4d137
Showing with 6 additions and 5 deletions.
  1. +6 −5 plugins/input/ogr/ogr_datasource.cpp
@@ -169,11 +169,12 @@ void ogr_datasource::bind() const
if (!layer_)
{
- std::string s("OGR Plugin: ");
- if (layer_by_name) s += "cannot find layer by name '" + *layer_by_name;
- else if (layer_by_index) s += "cannot find layer by index number '" + *layer_by_index;
- s += "' in dataset '" + dataset_name_ + "'";
- throw datasource_exception(s);
+ std::ostringstream s;
+ s << "OGR Plugin: ";
+ if (layer_by_name) s << "cannot find layer by name '" << *layer_by_name;
+ else if (layer_by_index) s << "cannot find layer by index number '" << *layer_by_index;
+ s << "' in dataset '" << dataset_name_ << "'";
+ throw datasource_exception(s.str());
}
// initialize envelope

0 comments on commit 49483fa

Please sign in to comment.