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 6df2b74 commit 1d73355
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 @@ -778,11 +778,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) * 2;
buffer = malloc(buffer_s);
if (buffer == NULL) {
Expand Down Expand Up @@ -967,8 +965,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 1d73355

Please sign in to comment.