From e2c01b7622fbf031457084b2bb06db73ccbf584c Mon Sep 17 00:00:00 2001 From: Mindaugas Kavaliauskas Date: Fri, 12 Nov 2010 02:35:12 +0000 Subject: [PATCH] 2010-11-12 04:35 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/hbzebra/code39.c * harbour/contrib/hbzebra/eanupc.c ! fixed errors --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbzebra/code39.c | 21 ++++++++++++--------- harbour/contrib/hbzebra/eanupc.c | 6 +++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4b99a00112..a13422b53d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-12 04:35 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + * harbour/contrib/hbzebra/code39.c + * harbour/contrib/hbzebra/eanupc.c + ! fixed errors + 2010-11-12 01:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * package/winuni/mpkg_win_uni.bat ! Fixed to install all .hbc files inside the contrib diff --git a/harbour/contrib/hbzebra/code39.c b/harbour/contrib/hbzebra/code39.c index 92f0229452..470357317f 100644 --- a/harbour/contrib/hbzebra/code39.c +++ b/harbour/contrib/hbzebra/code39.c @@ -120,7 +120,7 @@ static int _code39_charno( char ch ) return -1; } -static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags ) +static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags, HB_BOOL fLast ) { int i, cnt = 0; @@ -133,7 +133,8 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags ) code >>= 1; } hb_bitbuffer_cat_int( pBits, 31, cnt < 3 ? 5 : 2 ); - hb_bitbuffer_cat_int( pBits, 0, 2 ); + if( ! fLast ) + hb_bitbuffer_cat_int( pBits, 0, 2 ); } else if( iFlags & HB_ZEBRA_FLAG_WIDE3 ) { @@ -144,7 +145,8 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags ) code >>= 1; } hb_bitbuffer_cat_int( pBits, 31, cnt < 3 ? 3 : 1 ); - hb_bitbuffer_cat_int( pBits, 0, 1 ); + if( ! fLast ) + hb_bitbuffer_cat_int( pBits, 0, 1 ); } else { @@ -155,7 +157,8 @@ static void _code39_add( PHB_BITBUFFER pBits, char code, int iFlags ) code >>= 1; } hb_bitbuffer_cat_int( pBits, 31, cnt < 3 ? 2 : 1 ); - hb_bitbuffer_cat_int( pBits, 0, 1 ); + if( ! fLast ) + hb_bitbuffer_cat_int( pBits, 0, 1 ); } } @@ -183,21 +186,21 @@ PHB_ZEBRA hb_zebra_create_code39( const char * szCode, HB_SIZE nLen, int iFlags pZebra->pBits = hb_bitbuffer_create(); - _code39_add( pZebra->pBits, 0x52, iFlags ); /* start */ + _code39_add( pZebra->pBits, 0x52, iFlags, HB_FALSE ); /* start */ csum = 0; for( i = 0; i < iLen; i++ ) { int no = _code39_charno( szCode[ i ] ); - _code39_add( pZebra->pBits, ( char ) s_code[ no ], iFlags ); + _code39_add( pZebra->pBits, ( char ) s_code[ no ], iFlags, HB_FALSE ); csum += no; } if( iFlags & HB_ZEBRA_FLAG_CHECKSUM ) - _code39_add( pZebra->pBits, ( char ) s_code[ csum % 43 ], iFlags ); + _code39_add( pZebra->pBits, ( char ) s_code[ csum % 43 ], iFlags, HB_FALSE ); - _code39_add( pZebra->pBits, 0x52, iFlags ); /* stop */ - hb_bitbuffer_cat_int( pZebra->pBits, 3, iFlags & HB_ZEBRA_FLAG_WIDE2_5 ? 2 : 1 ); + _code39_add( pZebra->pBits, 0x52, iFlags, HB_TRUE ); /* stop */ +// hb_bitbuffer_cat_int( pZebra->pBits, 3, iFlags & HB_ZEBRA_FLAG_WIDE2_5 ? 2 : 1 ); return pZebra; } diff --git a/harbour/contrib/hbzebra/eanupc.c b/harbour/contrib/hbzebra/eanupc.c index c6fcd4a390..8addabf38b 100644 --- a/harbour/contrib/hbzebra/eanupc.c +++ b/harbour/contrib/hbzebra/eanupc.c @@ -373,10 +373,10 @@ PHB_ZEBRA hb_zebra_create_upce( const char * szCode, HB_SIZE nLen, int iFlags ) for( i = 0; i < 6; i++ ) { - if( sumcode & ( 1 << ( i - 1 ) ) ) - hb_bitbuffer_cat_int( pZebra->pBits, s_gcode[ szCode[ i ] - '0' ], 7 ); - else + if( sumcode & ( 1 << i ) ) hb_bitbuffer_cat_int( pZebra->pBits, s_rcode[ szCode[ i ] - '0' ] ^ 0x7F, 7 ); + else + hb_bitbuffer_cat_int( pZebra->pBits, s_gcode[ szCode[ i ] - '0' ], 7 ); } hb_bitbuffer_cat_int( pZebra->pBits, 42, 6 ); /* stop */ return pZebra;