Renamed a C library internal function setModuleBounded() to setModuleUnbounded().

pull/134/head
Project Nayuki 3 years ago
parent c6fcc212d1
commit a078f19cf4

@ -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++;
}

@ -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);

Loading…
Cancel
Save