From fb4002001eccc9a13e145ff0e3f2f5143a889c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Ihle?= Date: Tue, 30 Jul 2019 17:06:48 +0200 Subject: [PATCH] Fix output of FNC1 in first position needed for GS1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ¼diger Ihle --- qrinput.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qrinput.c b/qrinput.c index f6a3a3cd..2c2fab94 100644 --- a/qrinput.c +++ b/qrinput.c @@ -729,6 +729,16 @@ static int QRinput_encodeModeStructure(QRinput_List *entry, BitStream *bstream, * FNC1 *****************************************************************************/ +static int QRinput_encodeModeFNC1First(BitStream *bstream) +{ + int ret; + + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_FNC1FIRST); + if(ret < 0) return -1; + + return 0; +} + static int QRinput_checkModeFNC1Second(int size) { if(size != 1) return -1; @@ -818,7 +828,7 @@ static int QRinput_encodeModeECI(QRinput_List *entry, BitStream *bstream) int QRinput_check(QRencodeMode mode, int size, const unsigned char *data) { - if((mode == QR_MODE_FNC1FIRST && size < 0) || size <= 0) return -1; + if(mode != QR_MODE_FNC1FIRST && size <= 0) return -1; switch(mode) { case QR_MODE_NUM: @@ -1046,6 +1056,9 @@ static int QRinput_encodeBitStream(QRinput_List *entry, BitStream *bstream, int case QR_MODE_ECI: ret = QRinput_encodeModeECI(entry, bstream); break; + case QR_MODE_FNC1FIRST: + ret = QRinput_encodeModeFNC1First(bstream); + break; case QR_MODE_FNC1SECOND: ret = QRinput_encodeModeFNC1Second(entry, bstream); break;