mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Avoid another string construction
This commit is contained in:
@@ -159,7 +159,11 @@ bool mvt_tile::decode(const std::string &message, bool &was_compressed) {
|
|||||||
case 1: /* string */
|
case 1: /* string */
|
||||||
value.type = mvt_string;
|
value.type = mvt_string;
|
||||||
value.s = string_pool;
|
value.s = string_pool;
|
||||||
value.set_string_value(value_reader.get_string());
|
{
|
||||||
|
auto v = value_reader.get_view();
|
||||||
|
std::string_view sv(v.data(), v.size());
|
||||||
|
value.set_string_value(sv);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* float */
|
case 2: /* float */
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ struct mvt_value {
|
|||||||
return s->c_str() + numeric_value.string_value.off;
|
return s->c_str() + numeric_value.string_value.off;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_string_value(const std::string &val) {
|
void set_string_value(const std::string_view &val) {
|
||||||
if (s == nullptr) {
|
if (s == nullptr) {
|
||||||
s = std::make_shared<std::string>();
|
s = std::make_shared<std::string>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user