Changed C API function qrcodegen_getModule() to remove version argument, updated runnable programs.

pull/11/head
Project Nayuki 8 years ago
parent 12bd5401ab
commit df1c49cc39

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

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

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

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

Loading…
Cancel
Save