From 18f9b7c6ce785ac5bea1b6782b228ac3d1e5a0f8 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Mon, 26 Feb 2018 20:21:23 +0000 Subject: [PATCH] Tweaked C++ code for style and robustness. --- cpp/QrCode.hpp | 2 +- cpp/QrCodeGeneratorWorker.cpp | 2 +- cpp/QrSegment.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index e868014..14a3f61 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -280,7 +280,7 @@ class QrCode final { * Creates a Reed-Solomon ECC generator for the given degree. This could be implemented * as a lookup table over all possible parameter values, instead of as an algorithm. */ - public: ReedSolomonGenerator(int degree); + public: explicit ReedSolomonGenerator(int degree); /*-- Method --*/ diff --git a/cpp/QrCodeGeneratorWorker.cpp b/cpp/QrCodeGeneratorWorker.cpp index d00b03c..2e14607 100644 --- a/cpp/QrCodeGeneratorWorker.cpp +++ b/cpp/QrCodeGeneratorWorker.cpp @@ -60,7 +60,7 @@ int main() { for (int i = 0; i < length; i++) { int b; std::cin >> b; - data.push_back((uint8_t)b); + data.push_back(static_cast(b)); isAscii &= 0 < b && b < 128; } diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 779f063..2b9eb66 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -147,7 +147,7 @@ class QrSegment final { private: std::vector data; - /*---- Constructor ----*/ + /*---- Constructors ----*/ /* * Creates a new QR Code data segment with the given parameters and data.