From 58046f902f9d34e47dffbfbee894d83cbb864c83 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 5 May 2017 20:56:32 +0000 Subject: [PATCH] Updated some C++ implementation code to be stricter by prepending std:: prefix for C standard library types. --- cpp/BitBuffer.cpp | 4 ++-- cpp/QrSegment.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/BitBuffer.cpp b/cpp/BitBuffer.cpp index 8f94eb4..058b5d3 100644 --- a/cpp/BitBuffer.cpp +++ b/cpp/BitBuffer.cpp @@ -37,12 +37,12 @@ int BitBuffer::getBitLength() const { } -std::vector BitBuffer::getBytes() const { +std::vector BitBuffer::getBytes() const { return data; } -void BitBuffer::appendBits(uint32_t val, int len) { +void BitBuffer::appendBits(std::uint32_t val, int len) { if (len < 0 || len > 32 || (len < 32 && (val >> len) != 0)) throw "Value out of range"; if (len > INT_MAX - bitLength) diff --git a/cpp/QrSegment.cpp b/cpp/QrSegment.cpp index cd514d5..c2a4667 100644 --- a/cpp/QrSegment.cpp +++ b/cpp/QrSegment.cpp @@ -137,7 +137,7 @@ int QrSegment::getTotalBits(const std::vector &segs, int version) { if (version < 1 || version > 40) throw "Version number out of range"; int result = 0; - for (size_t i = 0; i < segs.size(); i++) { + for (std::size_t i = 0; i < segs.size(); i++) { const QrSegment &seg(segs.at(i)); int ccbits = seg.mode.numCharCountBits(version); // Fail if segment length value doesn't fit in the length field's bit-width