Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix output of FNC1 in first position needed for GS1 #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion qrinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down