Skip to content

Commit

Permalink
writeANSI, writeASCII: do not reset size
Browse files Browse the repository at this point in the history
We're reseting size to 1 in writeANSI and writeASCII, this may be
problematic if someone use qrencode as a library.

Let's just ignore it in ASCII/ANSI mode instead.
  • Loading branch information
sgn committed Jan 22, 2021
1 parent 176de82 commit 461d4e8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions qrenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,11 +777,9 @@ static int writeANSI(const QRcode *qrcode, const char *outfile)
white_s = strlen(white);
black_s = strlen(black);

size = 1;

fp = openFile(outfile);

realwidth = (qrcode->width + margin * 2) * size;
realwidth = qrcode->width + margin * 2;
buffer_s = (realwidth * (white_s > black_s ? white_s : black_s)) * 2;
buffer = malloc(buffer_s);
if (buffer == NULL) {
Expand Down Expand Up @@ -966,8 +964,6 @@ static int writeASCII(const QRcode *qrcode, const char *outfile, int invert)
white = '#';
}

size = 1;

fp = openFile(outfile);

realwidth = (qrcode->width + margin * 2) * 2;
Expand Down

0 comments on commit 461d4e8

Please sign in to comment.