diff options
author | Waley Chen <waleycz@gmail.com> | 2016-07-20 17:07:55 -0400 |
---|---|---|
committer | Waley Chen <waleycz@gmail.com> | 2016-07-20 17:07:55 -0400 |
commit | 4f763e1509ab88aef9c9e7db45d9699f94382bf2 (patch) | |
tree | 9927b1b779c2fa5692777a0e56eb442245acf50b /src/mongo/util/itoa.cpp | |
parent | f3aebd17867f7e36b6c671fccf3adc0e20531afb (diff) | |
download | mongo-4f763e1509ab88aef9c9e7db45d9699f94382bf2.tar.gz |
SERVER-21554 Coverity analysis defect 76764: Macro compares unsigned to 0
Diffstat (limited to 'src/mongo/util/itoa.cpp')
-rw-r--r-- | src/mongo/util/itoa.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/util/itoa.cpp b/src/mongo/util/itoa.cpp index 88b9a574707..e19048b87ed 100644 --- a/src/mongo/util/itoa.cpp +++ b/src/mongo/util/itoa.cpp @@ -1036,6 +1036,8 @@ const char kIndexTable[] = "999\0"; } // namespace +constexpr size_t ItoA::kBufSize; + ItoA::ItoA(std::uint32_t val) { if (val < 10u) { _str = kIndexTable + (2 * val); @@ -1052,13 +1054,12 @@ ItoA::ItoA(std::uint32_t val) { auto pos = len; while (val > 0) { + dassert(pos > 0); --pos; _buf[pos] = static_cast<char>((val % 10) + static_cast<std::uint32_t>('0')); val /= 10; } - invariant(pos >= 0); - _str = _buf + pos; _len = len - pos; } |