qrencode: Update to 4.0.0
[feed/packages.git] / libs / qrencode / patches / 001-add-inline-svg.patch
1 From 7dd8a1b6f4efab84025c735195ad9d84f6477359 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bennett <JBennett@incomsystems.biz>
3 Date: Mon, 16 Oct 2017 11:59:23 -0500
4 Subject: [PATCH] Adds the --inline option, which omits the xml tag for SVG
5 output.
6
7 ---
8 qrenc.c | 11 +++++++++--
9 1 file changed, 9 insertions(+), 2 deletions(-)
10
11 diff --git a/qrenc.c b/qrenc.c
12 index ed83d8a..373352e 100644
13 --- a/qrenc.c
14 +++ b/qrenc.c
15 @@ -45,6 +45,7 @@ static int structured = 0;
16 static int rle = 0;
17 static int svg_path = 0;
18 static int micro = 0;
19 +static int inline_svg = 0;
20 static QRecLevel level = QR_ECLEVEL_L;
21 static QRencodeMode hint = QR_MODE_8;
22 static unsigned char fg_color[4] = {0, 0, 0, 255};
23 @@ -80,6 +81,7 @@ static const struct option options[] = {
24 {"margin" , required_argument, NULL, 'm'},
25 {"dpi" , required_argument, NULL, 'd'},
26 {"type" , required_argument, NULL, 't'},
27 + {"inline" , no_argument , NULL, 'I'},
28 {"structured" , no_argument , NULL, 'S'},
29 {"kanji" , no_argument , NULL, 'k'},
30 {"casesensitive", no_argument , NULL, 'c'},
31 @@ -95,7 +97,7 @@ static const struct option options[] = {
32 {NULL, 0, NULL, 0}
33 };
34
35 -static char *optstring = "ho:r:l:s:v:m:d:t:Skci8MV";
36 +static char *optstring = "ho:r:l:s:v:m:d:t:ISkci8MV";
37
38 static void usage(int help, int longopt, int status)
39 {
40 @@ -132,6 +134,7 @@ static void usage(int help, int longopt, int status)
41 " -t {PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8},\n"
42 " --type={PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}\n"
43 " specify the type of the generated image. (default=PNG)\n\n"
44 +" -I, --inline Only useful for SVG output, generates an svg without the XML tag\n"
45 " -S, --structured\n"
46 " make structured symbols. Version must be specified.\n\n"
47 " -k, --kanji assume that the input text contains kanji (shift-jis).\n\n"
48 @@ -551,7 +554,8 @@ static int writeSVG(const QRcode *qrcode, const char *outfile)
49 bg_opacity = (float)bg_color[3] / 255;
50
51 /* XML declaration */
52 - fputs( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", fp );
53 + if (!inline_svg)
54 + fputs( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", fp );
55
56 /* DTD
57 No document type specified because "while a DTD is provided in [the SVG]
58 @@ -1324,6 +1328,9 @@ int main(int argc, char **argv)
59 exit(EXIT_FAILURE);
60 }
61 break;
62 + case 'I':
63 + inline_svg = 1;
64 + break;
65 case 'S':
66 structured = 1;
67 break;