From 33af4e376e22430365918ce70daa34fd076192cb Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 5 May 2017 20:55:32 +0000 Subject: [PATCH] Updated C++ header code to be stricter by prepending std:: prefix for C standard library types. --- cpp/BitBuffer.hpp | 6 +++--- cpp/QrCode.hpp | 18 +++++++++--------- cpp/QrSegment.hpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cpp/BitBuffer.hpp b/cpp/BitBuffer.hpp index 56069dd..f91e428 100644 --- a/cpp/BitBuffer.hpp +++ b/cpp/BitBuffer.hpp @@ -37,7 +37,7 @@ class BitBuffer final { /*---- Fields ----*/ - private: std::vector data; + private: std::vector data; private: int bitLength; @@ -56,12 +56,12 @@ class BitBuffer final { // Returns a copy of all bytes, padding up to the nearest byte. - public: std::vector getBytes() const; + public: std::vector getBytes() const; // Appends the given number of bits of the given value to this sequence. // If 0 <= len <= 31, then this requires 0 <= val < 2^len. - public: void appendBits(uint32_t val, int len); + public: void appendBits(std::uint32_t val, int len); // Appends the data of the given segment to this bit buffer. diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 2df850d..cc891e3 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -75,7 +75,7 @@ class QrCode final { * bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. * The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version. */ - public: static QrCode encodeBinary(const std::vector &data, const Ecc &ecl); + public: static QrCode encodeBinary(const std::vector &data, const Ecc &ecl); /* @@ -122,7 +122,7 @@ class QrCode final { * and mask number. This is a cumbersome low-level constructor that should not be invoked directly by the user. * To go one level up, see the encodeSegments() function. */ - public: QrCode(int ver, const Ecc &ecl, const std::vector &dataCodewords, int mask); + public: QrCode(int ver, const Ecc &ecl, const std::vector &dataCodewords, int mask); /* @@ -187,12 +187,12 @@ class QrCode final { // Returns a new byte string representing the given data with the appropriate error correction // codewords appended to it, based on this object's version and error correction level. - private: std::vector appendErrorCorrection(const std::vector &data) const; + private: std::vector appendErrorCorrection(const std::vector &data) const; // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire // data area of this QR Code symbol. Function modules need to be marked off before this is called. - private: void drawCodewords(const std::vector &data); + private: void drawCodewords(const std::vector &data); // XORs the data modules in this QR Code with the given mask pattern. Due to XOR's mathematical @@ -242,8 +242,8 @@ class QrCode final { private: static const int PENALTY_N3; private: static const int PENALTY_N4; - private: static const int8_t ECC_CODEWORDS_PER_BLOCK[4][41]; - private: static const int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41]; + private: static const std::int8_t ECC_CODEWORDS_PER_BLOCK[4][41]; + private: static const std::int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41]; @@ -260,7 +260,7 @@ class QrCode final { // Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which // is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. - private: std::vector coefficients; + private: std::vector coefficients; /*-- Constructor --*/ @@ -278,14 +278,14 @@ class QrCode final { * Computes and returns the Reed-Solomon error correction codewords for the given sequence of data codewords. * The returned object is always a new byte array. This method does not alter this object's state (because it is immutable). */ - public: std::vector getRemainder(const std::vector &data) const; + public: std::vector getRemainder(const std::vector &data) const; /*-- Static function --*/ // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. - private: static uint8_t multiply(uint8_t x, uint8_t y); + private: static std::uint8_t multiply(std::uint8_t x, std::uint8_t y); }; diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 0ed9a5a..e1b7455 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -83,7 +83,7 @@ class QrSegment final { /* * Returns a segment representing the given binary data encoded in byte mode. */ - public: static QrSegment makeBytes(const std::vector &data); + public: static QrSegment makeBytes(const std::vector &data); /* @@ -130,7 +130,7 @@ class QrSegment final { public: const int numChars; /* The bits of this segment packed into a byte array in big endian. */ - public: const std::vector data; + public: const std::vector data; /* The length of this segment's encoded data, measured in bits. Satisfies ceil(bitLength / 8) = data.size(). */ public: const int bitLength; @@ -141,7 +141,7 @@ class QrSegment final { /* * Creates a new QR Code data segment with the given parameters and data. */ - public: QrSegment(const Mode &md, int numCh, const std::vector &b, int bitLen); + public: QrSegment(const Mode &md, int numCh, const std::vector &b, int bitLen); // Package-private helper function.