summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-26 11:27:59 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-26 11:44:48 -0700
commit189b5c2f60f2eec4a8b5b95dbfb26c082e4a9d5d (patch)
tree9256d6c71cf7b3a4ee0b632f3323f23fdae55cc8 /src
parent878310b8912c83445ce7b12ee2b30a4489bf34f7 (diff)
downloadqtlocation-mapboxgl-189b5c2f60f2eec4a8b5b95dbfb26c082e4a9d5d.tar.gz
[core] Rewrite parsePropertyTransition to work around GCC 4.9 bug
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/style/property_parsing.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp
index 7994f245e8..362b0d7b5a 100644
--- a/src/mbgl/style/property_parsing.cpp
+++ b/src/mbgl/style/property_parsing.cpp
@@ -262,22 +262,25 @@ optional<std::vector<std::string>> parseConstant(const char* name, const JSValue
}
optional<PropertyTransition> parsePropertyTransition(const char *, const JSValue& value) {
- PropertyTransition transition;
- if (value.IsObject()) {
- bool parsed = false;
- if (value.HasMember("duration") && value["duration"].IsNumber()) {
- transition.duration.emplace(Milliseconds(value["duration"].GetUint()));
- parsed = true;
- }
- if (value.HasMember("delay") && value["delay"].IsNumber()) {
- transition.delay.emplace(Milliseconds(value["delay"].GetUint()));
- parsed = true;
- }
- if (!parsed) {
- return {};
- }
+ if (!value.IsObject()) {
+ return {};
+ }
+
+ optional<Duration> duration;
+ if (value.HasMember("duration") && value["duration"].IsNumber()) {
+ duration.emplace(Milliseconds(value["duration"].GetUint()));
}
- return transition;
+
+ optional<Duration> delay;
+ if (value.HasMember("delay") && value["delay"].IsNumber()) {
+ delay.emplace(Milliseconds(value["delay"].GetUint()));
+ }
+
+ if (!duration && !delay) {
+ return {};
+ }
+
+ return PropertyTransition(duration, delay);
}
} // namespace mbgl