[core] Fix out of range exception for string compare

This commit is contained in:
Vladimir Kondrashov
2018-08-13 11:25:33 -07:00
committed by Konstantin Käfer
parent 16e6ca86fa
commit 9ecb0997ef
3 changed files with 4 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ std::unique_ptr<AsyncRequest> AssetFileSource::request(const Resource& resource,
}
bool AssetFileSource::acceptsURL(const std::string& url) {
return std::equal(assetProtocol.begin(), assetProtocol.end(), url.begin());
return 0 == url.rfind(assetProtocol, 0);
}
} // namespace mbgl

View File

@@ -75,7 +75,7 @@ std::unique_ptr<AsyncRequest> LocalFileSource::request(const Resource& resource,
}
bool LocalFileSource::acceptsURL(const std::string& url) {
return std::equal(fileProtocol.begin(), fileProtocol.end(), url.begin());
return 0 == url.rfind(fileProtocol, 0);
}
} // namespace mbgl

View File

@@ -17,7 +17,7 @@ bool isFeatureConstant(const Expression& expression) {
return false;
} else if (name == "has" && parameterCount && *parameterCount == 1) {
return false;
} else if (std::equal(std::begin(filter), std::end(filter) - 1, name.begin())) {
} else if (0 == name.rfind(filter, 0)) {
// Legacy filters begin with "filter-" and are never constant.
return false;
} else if (
@@ -28,7 +28,7 @@ bool isFeatureConstant(const Expression& expression) {
return false;
}
}
if (expression.getKind() == Kind::CollatorExpression) {
// Although the results of a Collator expression with fixed arguments
// generally shouldn't change between executions, we can't serialize them