diff options
author | Konstantin Trushin <konstantin.trushin@gmail.com> | 2016-03-13 14:07:39 +0300 |
---|---|---|
committer | Konstantin Trushin <konstantin.trushin@gmail.com> | 2016-03-13 14:07:39 +0300 |
commit | 305882489c1d59de91b4abf311a3324abbcad972 (patch) | |
tree | f49b821006d5d5b33963b671d2bc0710c1533184 /include/rapidjson/pointer.h | |
parent | d454d21409a72b8736f3a5927d0f6f2fde8f4a45 (diff) |
do potentially precision-losing conversions explicitly
Diffstat (limited to 'include/rapidjson/pointer.h')
-rw-r--r-- | include/rapidjson/pointer.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h index eddeab42..94449381 100644 --- a/include/rapidjson/pointer.h +++ b/include/rapidjson/pointer.h @@ -987,11 +987,11 @@ private: src_++; Ch c = 0; for (int j = 0; j < 2; j++) { - c <<= 4; + c = static_cast<Ch>(c << 4); Ch h = *src_; - if (h >= '0' && h <= '9') c += h - '0'; - else if (h >= 'A' && h <= 'F') c += h - 'A' + 10; - else if (h >= 'a' && h <= 'f') c += h - 'a' + 10; + if (h >= '0' && h <= '9') c = static_cast<Ch>(c + h - '0'); + else if (h >= 'A' && h <= 'F') c = static_cast<Ch>(c + h - 'A' + 10); + else if (h >= 'a' && h <= 'f') c = static_cast<Ch>(c + h - 'a' + 10); else { valid_ = false; return 0; |