| 269 | } |
| 270 | |
| 271 | bool DictionaryInt32Decode(unordered_map<string, int32>* dictionary, |
| 272 | const string& encoded_str) { |
| 273 | vector<pair<string, string> > items; |
| 274 | if (!DictionaryParse(encoded_str, &items)) |
| 275 | return false; |
| 276 | |
| 277 | dictionary->clear(); |
| 278 | for (const auto& item : items) { |
| 279 | char *error = nullptr; |
| 280 | const int32 value = strto32(item.second.c_str(), &error, 0); |
| 281 | if (error == item.second.c_str() || *error != '\0') { |
| 282 | // parsing error |
| 283 | return false; |
| 284 | } |
| 285 | (*dictionary)[item.first] = value; |
| 286 | } |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | bool DictionaryInt64Decode(unordered_map<string, int64>* dictionary, |
| 291 | const string& encoded_str) { |
nothing calls this directly
no test coverage detected