From a078f19cf447ae9756e70056938e8bfc7685031a Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sat, 6 Nov 2021 05:15:25 +0000 Subject: [PATCH] Renamed a C library internal function setModuleBounded() to setModuleUnbounded(). --- c/qrcodegen-test.c | 16 ++++++++-------- c/qrcodegen.c | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/c/qrcodegen-test.c b/c/qrcodegen-test.c index 5b7ee23..4294bd1 100644 --- a/c/qrcodegen-test.c +++ b/c/qrcodegen-test.c @@ -56,7 +56,7 @@ void initializeFunctionModules(int version, uint8_t qrcode[]); int getAlignmentPatternPositions(int version, uint8_t result[7]); bool getModule(const uint8_t qrcode[], int x, int y); void setModule(uint8_t qrcode[], int x, int y, bool isDark); -void setModuleBounded(uint8_t qrcode[], int x, int y, bool isDark); +void setModuleUnbounded(uint8_t qrcode[], int x, int y, bool isDark); int calcSegmentBitLength(enum qrcodegen_Mode mode, size_t numChars); int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int version); @@ -469,12 +469,12 @@ static void testGetSetModule(void) { } // Set some out of bounds modules to light - setModuleBounded(qrcode, -1, -1, false); - setModuleBounded(qrcode, -1, 0, false); - setModuleBounded(qrcode, 0, -1, false); - setModuleBounded(qrcode, size, 5, false); - setModuleBounded(qrcode, 72, size, false); - setModuleBounded(qrcode, size, size, false); + setModuleUnbounded(qrcode, -1, -1, false); + setModuleUnbounded(qrcode, -1, 0, false); + setModuleUnbounded(qrcode, 0, -1, false); + setModuleUnbounded(qrcode, size, 5, false); + setModuleUnbounded(qrcode, 72, size, false); + setModuleUnbounded(qrcode, size, size, false); for (int y = 0; y < size; y++) { // Check all dark for (int x = 0; x < size; x++) assert(qrcodegen_getModule(qrcode, x, y) == true); @@ -520,7 +520,7 @@ static void testGetSetModuleRandomly(void) { if (isInBounds && rand() % 2 == 0) setModule(qrcode, x, y, newColor); else - setModuleBounded(qrcode, x, y, newColor); + setModuleUnbounded(qrcode, x, y, newColor); } numTestCases++; } diff --git a/c/qrcodegen.c b/c/qrcodegen.c index fc236b2..8d344cb 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -78,7 +78,7 @@ static void finderPenaltyAddHistory(int currentRunLength, int runHistory[7], int testable bool getModule(const uint8_t qrcode[], int x, int y); testable void setModule(uint8_t qrcode[], int x, int y, bool isDark); -testable void setModuleBounded(uint8_t qrcode[], int x, int y, bool isDark); +testable void setModuleUnbounded(uint8_t qrcode[], int x, int y, bool isDark); static bool getBit(int x, int i); testable int calcSegmentBitLength(enum qrcodegen_Mode mode, size_t numChars); @@ -467,9 +467,9 @@ static void drawLightFunctionModules(uint8_t qrcode[], int version) { if (abs(dy) > dist) dist = abs(dy); if (dist == 2 || dist == 4) { - setModuleBounded(qrcode, 3 + dx, 3 + dy, false); - setModuleBounded(qrcode, qrsize - 4 + dx, 3 + dy, false); - setModuleBounded(qrcode, 3 + dx, qrsize - 4 + dy, false); + setModuleUnbounded(qrcode, 3 + dx, 3 + dy, false); + setModuleUnbounded(qrcode, qrsize - 4 + dx, 3 + dy, false); + setModuleUnbounded(qrcode, 3 + dx, qrsize - 4 + dy, false); } } } @@ -788,7 +788,7 @@ testable void setModule(uint8_t qrcode[], int x, int y, bool isDark) { // Sets the module at the given coordinates, doing nothing if out of bounds. -testable void setModuleBounded(uint8_t qrcode[], int x, int y, bool isDark) { +testable void setModuleUnbounded(uint8_t qrcode[], int x, int y, bool isDark) { int qrsize = qrcode[0]; if (0 <= x && x < qrsize && 0 <= y && y < qrsize) setModule(qrcode, x, y, isDark);