| 308 | |
| 309 | |
| 310 | bool DictionaryDoubleDecode(unordered_map<string, double>* dictionary, |
| 311 | const string& encoded_str) { |
| 312 | vector<pair<string, string> > items; |
| 313 | if (!DictionaryParse(encoded_str, &items)) |
| 314 | return false; |
| 315 | |
| 316 | dictionary->clear(); |
| 317 | for (const auto& item : items) { |
| 318 | char *error = nullptr; |
| 319 | const double value = strtod(item.second.c_str(), &error); |
| 320 | if (error == item.second.c_str() || *error != '\0') { |
| 321 | // parsing error |
| 322 | return false; |
| 323 | } |
| 324 | (*dictionary)[item.first] = value; |
| 325 | } |
| 326 | return true; |
| 327 | } |
nothing calls this directly
no test coverage detected