diff --git a/c/qrcodegen-demo.c b/c/qrcodegen-demo.c index 1a0eb96..4bcd19d 100644 --- a/c/qrcodegen-demo.c +++ b/c/qrcodegen-demo.c @@ -141,7 +141,7 @@ static void printQr(const uint8_t qrcode[], int version) { int border = 4; for (int y = -border; y < size + border; y++) { for (int x = -border; x < size + border; x++) { - fputs((qrcodegen_getModule(qrcode, version, x, y) ? "##" : " "), stdout); + fputs((qrcodegen_getModule(qrcode, x, y) ? "##" : " "), stdout); } fputs("\n", stdout); } diff --git a/c/qrcodegen-worker.c b/c/qrcodegen-worker.c index 299dd10..bed457d 100644 --- a/c/qrcodegen-worker.c +++ b/c/qrcodegen-worker.c @@ -101,7 +101,7 @@ int main(void) { int size = qrcodegen_getSize(version); for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) - printf("%d\n", qrcodegen_getModule(qrcode, version, x, y) ? 1 : 0); + printf("%d\n", qrcodegen_getModule(qrcode, x, y) ? 1 : 0); } } free(qrcode); diff --git a/c/qrcodegen.c b/c/qrcodegen.c index a356bd1..3ebdcf7 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -775,8 +775,8 @@ int qrcodegen_getSize(int version) { // Public function - see documentation comment in header file. -bool qrcodegen_getModule(const uint8_t qrcode[], int version, int x, int y) { - int qrsize = qrcodegen_getSize(version); +bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y) { + int qrsize = qrcode[0]; return (0 <= x && x < qrsize && 0 <= y && y < qrsize) && getModule(qrcode, x, y); } diff --git a/c/qrcodegen.h b/c/qrcodegen.h index c56c292..9f98a4b 100644 --- a/c/qrcodegen.h +++ b/c/qrcodegen.h @@ -115,4 +115,4 @@ int qrcodegen_getSize(int version); * true for white or false for black. The top left corner has the coordinates (x=0, y=0). * If the given coordinates are out of bounds, then false (white) is returned. */ -bool qrcodegen_getModule(const uint8_t qrcode[], int version, int x, int y); +bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);