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
This commit is contained in:
Mindaugas Kavaliauskas
2010-11-12 02:35:12 +00:00
parent e3934dfeca
commit e2c01b7622
3 changed files with 20 additions and 12 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;