2017-09-07 08:38 UTC Viktor Szakats (vszakats users.noreply.github.com)

* contrib/hbct/charsprd.c
  * contrib/hbct/dattime3.c
  * contrib/hbct/expand.c
  * contrib/hbct/misc2.c
  * contrib/hbct/screen2.c
  * contrib/hbcurl/core.c
  * contrib/hbfship/strpeek.c
  * contrib/hbnetio/netiocli.c
  * contrib/hbwin/olecore.c
  * contrib/rddads/adsx.c
  * contrib/rddads/rddads.h
  * contrib/rddsql/sqlmix.c
  * contrib/sddmy/core.c
  * contrib/sddpg/core.c
  * contrib/xhb/hbcompat.h
  * contrib/xhb/hbxml.c
  * contrib/xhb/xhb.h
  * src/common/hbstr.c
  * src/compiler/harbour.y
  * src/compiler/harbour.yyc
  * src/compiler/hbcmplib.c
  * src/macro/macrolex.c
  * src/rdd/dbffpt/dbffpt1.c
  * src/rdd/hbsix/sxcompr.c
  * src/rdd/hbsix/sxcrypt.c
  * src/rdd/hbsix/sxtable.c
  * src/rdd/hsx/hsx.c
  * src/rtl/cdpapi.c
  * src/rtl/gtcrs/gtcrs.c
  * src/rtl/gtxwc/gtxwc.c
  * src/rtl/hbtoken.c
  * src/rtl/net.c
  * src/rtl/netusr.c
  * src/vm/hvm.c
    * update HB_SIZE variable name prefixes to use `n` instead of `ul`
    % adjust some variables
    % sync variables scopes and some other minor things with 3.4 fork
This commit is contained in:
Viktor Szakats
2017-09-07 08:39:50 +00:00
parent f496daa711
commit d55bdd18b7
35 changed files with 661 additions and 614 deletions

View File

@@ -187,31 +187,31 @@ char * hb_strdup( const char * pszText )
char * hb_strndup( const char * pszText, HB_SIZE nLen )
{
char * pszDup;
HB_SIZE ul;
HB_SIZE nPos;
HB_TRACE( HB_TR_DEBUG, ( "hb_strndup(%.*s, %" HB_PFS "d)", ( int ) nLen, pszText, nLen ) );
ul = 0;
while( nLen-- && pszText[ ul ] )
++ul;
nPos = 0;
while( nLen-- && pszText[ nPos ] )
++nPos;
pszDup = ( char * ) hb_xgrab( ul + 1 );
memcpy( pszDup, pszText, ul );
pszDup[ ul ] = '\0';
pszDup = ( char * ) hb_xgrab( nPos + 1 );
memcpy( pszDup, pszText, nPos );
pszDup[ nPos ] = '\0';
return pszDup;
}
HB_SIZE hb_strnlen( const char * pszText, HB_SIZE nLen )
{
HB_SIZE ul = 0;
HB_SIZE nPos = 0;
HB_TRACE( HB_TR_DEBUG, ( "hb_strnlen(%.*s, %" HB_PFS "d)", ( int ) nLen, pszText, nLen ) );
while( nLen-- && *pszText++ )
++ul;
++nPos;
return ul;
return nPos;
}
char * hb_strduptrim( const char * pszText )
@@ -237,20 +237,20 @@ char * hb_strduptrim( const char * pszText )
HB_SIZE hb_strlentrim( const char * pszText )
{
HB_SIZE ul = 0;
HB_SIZE nPos = 0;
HB_TRACE( HB_TR_DEBUG, ( "hb_strlentrim(%s)", pszText ) );
while( pszText[ 0 ] == ' ' )
++pszText;
while( pszText[ ul ] )
++ul;
while( pszText[ nPos ] )
++nPos;
while( ul && pszText[ ul - 1 ] == ' ' )
--ul;
while( nPos && pszText[ nPos - 1 ] == ' ' )
--nPos;
return ul;
return nPos;
}
int hb_stricmp( const char * s1, const char * s2 )
@@ -1113,27 +1113,27 @@ char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE nLen )
char * hb_strRemEscSeq( char * str, HB_SIZE * pnLen )
{
HB_SIZE ul = *pnLen, nStripped = 0;
char * ptr, * dst, ch;
HB_SIZE nPos = *pnLen, nStripped = 0;
char * ptr, * dst;
ptr = dst = str;
while( ul )
while( nPos )
{
if( *ptr == '\\' )
break;
++ptr; ++dst;
--ul;
--nPos;
}
while( ul-- )
while( nPos-- )
{
ch = *ptr++;
char ch = *ptr++;
if( ch == '\\' )
{
++nStripped;
if( ul )
if( nPos )
{
ul--;
nPos--;
ch = *ptr++;
switch( ch )
{
@@ -1167,21 +1167,21 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pnLen )
case '6':
case '7':
ch -= '0';
if( ul && *ptr >= '0' && *ptr <= '7' )
if( nPos && *ptr >= '0' && *ptr <= '7' )
{
ch = ( ch << 3 ) | ( *ptr++ - '0' );
++nStripped;
if( --ul && *ptr >= '0' && *ptr <= '7' )
if( --nPos && *ptr >= '0' && *ptr <= '7' )
{
ch = ( ch << 3 ) | ( *ptr++ - '0' );
++nStripped;
--ul;
--nPos;
}
}
break;
case 'x':
ch = 0;
while( ul )
while( nPos )
{
if( *ptr >= '0' && *ptr <= '9' )
ch = ( ch << 4 ) | ( *ptr++ - '0' );
@@ -1192,7 +1192,7 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pnLen )
else
break;
++nStripped;
--ul;
--nPos;
}
break;
case '\\':
@@ -1223,9 +1223,9 @@ char * hb_compEncodeString( int iMethod, const char * szText, HB_SIZE * pnLen )
pBuffer[ *pnLen ] = '\0';
if( iMethod == 1 )
{
HB_SIZE ul;
for( ul = 0; ul < *pnLen; ul++ )
pBuffer[ ul ] ^= 0xF3;
HB_SIZE nPos;
for( nPos = 0; nPos < *pnLen; nPos++ )
pBuffer[ nPos ] ^= 0xF3;
}
return pBuffer;
}
@@ -1238,9 +1238,9 @@ char * hb_compDecodeString( int iMethod, const char * szText, HB_SIZE * pnLen )
pBuffer[ *pnLen ] = '\0';
if( iMethod == 1 )
{
HB_SIZE ul;
for( ul = 0; ul < *pnLen; ul++ )
pBuffer[ ul ] ^= 0xF3;
HB_SIZE nPos;
for( nPos = 0; nPos < *pnLen; nPos++ )
pBuffer[ nPos ] ^= 0xF3;
}
return pBuffer;
}

View File

@@ -2570,7 +2570,7 @@ static HB_COMP_CARGO2_FUNC( hb_compEnumEvalStart )
static void hb_compEnumStart( HB_COMP_DECL, PHB_EXPR pVars, PHB_EXPR pExprs, int descend )
{
HB_SIZE ulLen;
HB_SIZE nLen;
if( hb_compExprListLen( pVars ) != hb_compExprListLen( pExprs ) )
{
@@ -2578,15 +2578,15 @@ static void hb_compEnumStart( HB_COMP_DECL, PHB_EXPR pVars, PHB_EXPR pExprs, int
}
HB_COMP_PARAM->fDescend = descend < 0;
ulLen = hb_compExprListEval2( HB_COMP_PARAM, pVars, pExprs, hb_compEnumEvalStart );
nLen = hb_compExprListEval2( HB_COMP_PARAM, pVars, pExprs, hb_compEnumEvalStart );
if( ulLen > 255 )
if( nLen > 255 )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_TOOMANY, NULL, NULL );
}
else
{
hb_compGenPCode3( HB_P_ENUMSTART, ( HB_BYTE ) ( ulLen & 0xFF ), ( HB_BYTE ) ( descend > 0 ? 1 : 0 ), HB_COMP_PARAM );
hb_compGenPCode3( HB_P_ENUMSTART, ( HB_BYTE ) ( nLen & 0xFF ), ( HB_BYTE ) ( descend > 0 ? 1 : 0 ), HB_COMP_PARAM );
}
}
@@ -2708,13 +2708,13 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
PHB_SWITCHCMD pSwitch = pFunc->pSwitch;
PHB_EXPR pExpr = pSwitch->pExpr;
PHB_SWITCHCASE pCase, pTmp;
HB_SIZE ulExitPos, ulCountPos;
HB_SIZE nExitPos, nCountPos;
int iCount = 0;
/* skip switch pcode if there was no EXIT in the last CASE
* or in the DEFAULT case
*/
ulExitPos = hb_compGenJump( 0, HB_COMP_PARAM );
nExitPos = hb_compGenJump( 0, HB_COMP_PARAM );
hb_compGenJumpHere( pSwitch->nOffset + 1, HB_COMP_PARAM );
pCase = pSwitch->pCases;
@@ -2758,7 +2758,7 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
HB_BOOL fMacroText = ( HB_COMP_PARAM->supported & HB_COMPFLAG_MACROTEXT ) != 0;
pExpr = hb_compExprGenPush( pExpr, HB_COMP_PARAM );
ulCountPos = pFunc->nPCodePos + 1;
nCountPos = pFunc->nPCodePos + 1;
hb_compGenPCode3( HB_P_SWITCH, 0, 0, HB_COMP_PARAM );
HB_COMP_PARAM->fSwitchCase = HB_TRUE;
HB_COMP_PARAM->supported &= ~HB_COMPFLAG_MACROTEXT;
@@ -2780,14 +2780,14 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
hb_compGenJumpThere( hb_compGenJump( 0, HB_COMP_PARAM ),
pSwitch->nDefault, HB_COMP_PARAM );
}
HB_PUT_LE_UINT16( pFunc->pCode + ulCountPos, iCount );
HB_PUT_LE_UINT16( pFunc->pCode + nCountPos, iCount );
HB_COMP_PARAM->fSwitchCase = fSwitchCase;
if( fMacroText )
HB_COMP_PARAM->supported |= HB_COMPFLAG_MACROTEXT;
}
hb_compGenJumpHere( ulExitPos, HB_COMP_PARAM );
hb_compGenJumpHere( nExitPos, HB_COMP_PARAM );
if( pExpr )
HB_COMP_EXPR_FREE( pExpr );

View File

@@ -7577,7 +7577,7 @@ static HB_COMP_CARGO2_FUNC( hb_compEnumEvalStart )
static void hb_compEnumStart( HB_COMP_DECL, PHB_EXPR pVars, PHB_EXPR pExprs, int descend )
{
HB_SIZE ulLen;
HB_SIZE nLen;
if( hb_compExprListLen( pVars ) != hb_compExprListLen( pExprs ) )
{
@@ -7585,15 +7585,15 @@ static void hb_compEnumStart( HB_COMP_DECL, PHB_EXPR pVars, PHB_EXPR pExprs, int
}
HB_COMP_PARAM->fDescend = descend < 0;
ulLen = hb_compExprListEval2( HB_COMP_PARAM, pVars, pExprs, hb_compEnumEvalStart );
nLen = hb_compExprListEval2( HB_COMP_PARAM, pVars, pExprs, hb_compEnumEvalStart );
if( ulLen > 255 )
if( nLen > 255 )
{
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_TOOMANY, NULL, NULL );
}
else
{
hb_compGenPCode3( HB_P_ENUMSTART, ( HB_BYTE ) ( ulLen & 0xFF ), ( HB_BYTE ) ( descend > 0 ? 1 : 0 ), HB_COMP_PARAM );
hb_compGenPCode3( HB_P_ENUMSTART, ( HB_BYTE ) ( nLen & 0xFF ), ( HB_BYTE ) ( descend > 0 ? 1 : 0 ), HB_COMP_PARAM );
}
}
@@ -7715,13 +7715,13 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
PHB_SWITCHCMD pSwitch = pFunc->pSwitch;
PHB_EXPR pExpr = pSwitch->pExpr;
PHB_SWITCHCASE pCase, pTmp;
HB_SIZE ulExitPos, ulCountPos;
HB_SIZE nExitPos, nCountPos;
int iCount = 0;
/* skip switch pcode if there was no EXIT in the last CASE
* or in the DEFAULT case
*/
ulExitPos = hb_compGenJump( 0, HB_COMP_PARAM );
nExitPos = hb_compGenJump( 0, HB_COMP_PARAM );
hb_compGenJumpHere( pSwitch->nOffset + 1, HB_COMP_PARAM );
pCase = pSwitch->pCases;
@@ -7765,7 +7765,7 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
HB_BOOL fMacroText = ( HB_COMP_PARAM->supported & HB_COMPFLAG_MACROTEXT ) != 0;
pExpr = hb_compExprGenPush( pExpr, HB_COMP_PARAM );
ulCountPos = pFunc->nPCodePos + 1;
nCountPos = pFunc->nPCodePos + 1;
hb_compGenPCode3( HB_P_SWITCH, 0, 0, HB_COMP_PARAM );
HB_COMP_PARAM->fSwitchCase = HB_TRUE;
HB_COMP_PARAM->supported &= ~HB_COMPFLAG_MACROTEXT;
@@ -7787,14 +7787,14 @@ static void hb_compSwitchEnd( HB_COMP_DECL )
hb_compGenJumpThere( hb_compGenJump( 0, HB_COMP_PARAM ),
pSwitch->nDefault, HB_COMP_PARAM );
}
HB_PUT_LE_UINT16( pFunc->pCode + ulCountPos, iCount );
HB_PUT_LE_UINT16( pFunc->pCode + nCountPos, iCount );
HB_COMP_PARAM->fSwitchCase = fSwitchCase;
if( fMacroText )
HB_COMP_PARAM->supported |= HB_COMPFLAG_MACROTEXT;
}
hb_compGenJumpHere( ulExitPos, HB_COMP_PARAM );
hb_compGenJumpHere( nExitPos, HB_COMP_PARAM );
if( pExpr )
HB_COMP_EXPR_FREE( pExpr );

View File

@@ -123,7 +123,6 @@ static void hb_compGenArgList( int iFirst, int iLast,
PHB_PP_MSG_FUNC * pMsgFunc )
{
PHB_ITEM pParam;
HB_SIZE ul, nLen;
int argc = 1, i;
const char ** argv;
@@ -156,15 +155,15 @@ static void hb_compGenArgList( int iFirst, int iLast,
{
if( HB_IS_ARRAY( pParam ) )
{
ul = hb_arrayLen( pParam );
if( ul )
HB_SIZE nPos = hb_arrayLen( pParam );
if( nPos )
{
do
{
if( hb_arrayGetType( pParam, ul ) & HB_IT_STRING )
if( hb_arrayGetType( pParam, nPos ) & HB_IT_STRING )
++argc;
}
while( --ul );
while( --nPos );
}
}
else if( HB_IS_STRING( pParam ) )
@@ -181,11 +180,11 @@ static void hb_compGenArgList( int iFirst, int iLast,
{
if( HB_IS_ARRAY( pParam ) )
{
nLen = hb_arrayLen( pParam );
for( ul = 1; ul <= nLen; ++ul )
HB_SIZE nPos, nLen = hb_arrayLen( pParam );
for( nPos = 1; nPos <= nLen; ++nPos )
{
if( hb_arrayGetType( pParam, ul ) & HB_IT_STRING )
argv[ argc++ ] = hb_arrayGetCPtr( pParam, ul );
if( hb_arrayGetType( pParam, nPos ) & HB_IT_STRING )
argv[ argc++ ] = hb_arrayGetCPtr( pParam, nPos );
}
}
else if( HB_IS_STRING( pParam ) )
@@ -231,7 +230,6 @@ HB_FUNC( HB_COMPILEBUF )
HB_FUNC( HB_COMPILEFROMBUF )
{
const char * szSource = hb_parc( 1 );
if( szSource )

View File

@@ -441,11 +441,11 @@ int hb_macro_yylex( YYSTYPE * yylval_ptr, PHB_MACRO pMacro )
if( pLex->nSrc < pLex->nLen &&
HB_ISDIGIT( pLex->pString[ pLex->nSrc ] ) )
{
HB_SIZE ul = pLex->nSrc;
while( ++ul < pLex->nLen &&
HB_ISDIGIT( pLex->pString[ ul ] ) ) {};
ul -= --pLex->nSrc;
return hb_lexNumConv( yylval_ptr, pLex, ul );
HB_SIZE nPos = pLex->nSrc;
while( ++nPos < pLex->nLen &&
HB_ISDIGIT( pLex->pString[ nPos ] ) ) {};
nPos -= --pLex->nSrc;
return hb_lexNumConv( yylval_ptr, pLex, nPos );
}
if( pLex->nLen - pLex->nSrc >= 4 &&
pLex->pString[ pLex->nSrc + 3 ] == '.' )

View File

@@ -1418,9 +1418,9 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS
{
if( iTrans == FPT_TRANS_CP && ulLen > 0 )
{
HB_SIZE ulSize = ulLen + 1;
HB_SIZE nSize = ulLen + 1;
HB_SIZE nLen = ulLen;
hb_cdpnDup3( pBuffer, ulLen, pBuffer, &nLen, &pBuffer, &ulSize,
hb_cdpnDup3( pBuffer, ulLen, pBuffer, &nLen, &pBuffer, &nSize,
pArea->area.cdPage, hb_vmCDP() );
ulLen = ( HB_ULONG ) nLen;
}
@@ -1837,9 +1837,9 @@ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY
{
if( iTrans == FPT_TRANS_CP && ulLen > 0 )
{
HB_SIZE ulSize = ulLen;
pszStr = hb_cdpnDup( pszStr, &ulSize, pArea->area.cdPage, hb_vmCDP() );
hb_itemPutCLPtr( pItem, pszStr, ulSize );
HB_SIZE nSize = ulLen;
pszStr = hb_cdpnDup( pszStr, &nSize, pArea->area.cdPage, hb_vmCDP() );
hb_itemPutCLPtr( pItem, pszStr, nSize );
}
else
hb_itemPutCL( pItem, pszStr, ulLen );
@@ -2766,9 +2766,9 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
if( iTrans == FPT_TRANS_CP && ulSize != 0 )
{
HB_SIZE nSize = ulSize;
HB_SIZE ulBufSize = ulSize + 1;
HB_SIZE nBufSize = ulSize + 1;
hb_cdpnDup3( pBuffer, ulSize, pBuffer, &nSize,
&pBuffer, &ulBufSize,
&pBuffer, &nBufSize,
pArea->area.cdPage, hb_vmCDP() );
ulSize = ( HB_ULONG ) nSize;
}
@@ -2792,9 +2792,9 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
if( iTrans == FPT_TRANS_CP && ulSize != 0 )
{
HB_SIZE nSize = ulSize;
HB_SIZE ulBufSize = ulSize + 1;
HB_SIZE nBufSize = ulSize + 1;
hb_cdpnDup3( pBuffer, ulSize, pBuffer, &nSize,
&pBuffer, &ulBufSize,
&pBuffer, &nBufSize,
pArea->area.cdPage, hb_vmCDP() );
ulSize = ( HB_ULONG ) nSize;
}
@@ -2886,9 +2886,9 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
if( iTrans == FPT_TRANS_CP && ulSize != 0 )
{
HB_SIZE nSize = ulSize;
HB_SIZE ulBufSize = ulSize + 1;
HB_SIZE nBufSize = ulSize + 1;
hb_cdpnDup3( pBuffer, ulSize, pBuffer, &nSize,
&pBuffer, &ulBufSize,
&pBuffer, &nBufSize,
pArea->area.cdPage, hb_vmCDP() );
ulSize = ( HB_ULONG ) nSize;
}
@@ -3800,21 +3800,21 @@ static HB_ERRCODE hb_fptPutVarField( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
}
else if( HB_IS_STRING( pItem ) )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
HB_SIZE nLen = hb_itemGetCLen( pItem );
pBlock = ( const HB_BYTE * ) hb_itemGetCPtr( pItem );
if( ulLen > HB_VF_CHAR )
ulLen = HB_VF_CHAR;
if( ulLen > 0 && ( pField->uiFlags & HB_FF_BINARY ) == 0 &&
if( nLen > HB_VF_CHAR )
nLen = HB_VF_CHAR;
if( nLen > 0 && ( pField->uiFlags & HB_FF_BINARY ) == 0 &&
hb_vmCDP() != pArea->area.cdPage )
{
pBlock = pAlloc = ( HB_BYTE * )
hb_cdpnDup( ( const char * ) pBlock, &ulLen,
hb_cdpnDup( ( const char * ) pBlock, &nLen,
hb_vmCDP(), pArea->area.cdPage );
if( ulLen > HB_VF_CHAR )
ulLen = HB_VF_CHAR;
if( nLen > HB_VF_CHAR )
nLen = HB_VF_CHAR;
}
uiType = ( HB_USHORT ) ulLen;
uiType = ( HB_USHORT ) nLen;
if( uiType <= pField->uiLen - 2 )
{
memcpy( pFieldBuf, pBlock, uiType );

View File

@@ -179,8 +179,7 @@ typedef struct _HB_LZSSX_COMPR
HB_SIZE outBuffPos;
HB_BOOL fOutFree;
HB_SIZE ulMaxSize;
HB_SIZE ulOutSize;
HB_SIZE nOutSize;
HB_BOOL fResult;
HB_BOOL fContinue;
@@ -227,8 +226,7 @@ static PHB_LZSSX_COMPR hb_LZSSxInit(
pCompr->outBuffPos = 0;
pCompr->fOutFree = ( pOutput != NULL && pDstBuf == NULL );
pCompr->ulMaxSize = 0;
pCompr->ulOutSize = 0;
pCompr->nOutSize = 0;
pCompr->fResult = HB_TRUE;
pCompr->fContinue = HB_FALSE;
@@ -256,7 +254,7 @@ static HB_BOOL hb_LZSSxFlush( PHB_LZSSX_COMPR pCompr )
}
else
{
pCompr->ulOutSize += pCompr->outBuffPos;
pCompr->nOutSize += pCompr->outBuffPos;
pCompr->outBuffPos = 0;
}
}

View File

@@ -1,10 +1,10 @@
/*
* SIX compatible functions:
* hb_sxEnCrypt()
* hb_sxDeCrypt()
* hb_sxEnCrypt()
* hb_sxDeCrypt()
*
* sx_Encrypt()
* sx_Decrypt()
* sx_Encrypt()
* sx_Decrypt()
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
@@ -90,17 +90,18 @@ void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE
{
HB_U32 ulSeed;
HB_U16 uiKey;
HB_UCHAR ucChar, ucShft;
HB_SIZE ul;
HB_SIZE nPos;
int i;
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
for( ul = 0, i = 0; ul < nLen; ul++ )
for( nPos = 0, i = 0; nPos < nLen; nPos++ )
{
ucChar = ( HB_UCHAR ) pSrc[ ul ];
HB_UCHAR ucChar, ucShft;
ucChar = ( HB_UCHAR ) pSrc[ nPos ];
ucShft = ( HB_UCHAR ) ( uiKey & 0x07 );
pDst[ ul ] = ( ( ucChar >> ucShft ) + ( ucChar << ( 8 - ucShft ) ) +
( uiKey & 0xFF ) );
pDst[ nPos ] = ( ( ucChar >> ucShft ) + ( ucChar << ( 8 - ucShft ) ) +
( uiKey & 0xFF ) );
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[ i ], &uiKey );
if( ++i == 7 )
i = 0;
@@ -111,16 +112,17 @@ void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE
{
HB_U32 ulSeed;
HB_U16 uiKey;
HB_UCHAR ucChar, ucShft;
HB_SIZE ul;
HB_SIZE nPos;
int i;
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
for( ul = 0, i = 0; ul < nLen; ul++ )
for( nPos = 0, i = 0; nPos < nLen; nPos++ )
{
ucChar = ( HB_UCHAR ) pSrc[ ul ] - ( uiKey & 0xFF );
HB_UCHAR ucChar, ucShft;
ucChar = ( HB_UCHAR ) pSrc[ nPos ] - ( uiKey & 0xFF );
ucShft = ( HB_UCHAR ) ( uiKey & 0x07 );
pDst[ ul ] = ( ( ucChar << ucShft ) + ( ucChar >> ( 8 - ucShft ) ) );
pDst[ nPos ] = ( ( ucChar << ucShft ) + ( ucChar >> ( 8 - ucShft ) ) );
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[ i ], &uiKey );
if( ++i == 7 )
i = 0;
@@ -131,7 +133,6 @@ static HB_BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, char * pKeyVal )
{
HB_BOOL fResult = HB_FALSE;
PHB_ITEM pItem = NULL;
HB_SIZE nKey;
if( ! ( hb_itemType( pKeyItem ) & HB_IT_STRING ) )
{
@@ -146,7 +147,7 @@ static HB_BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, char * pKeyVal )
}
if( hb_itemType( pKeyItem ) & HB_IT_STRING )
{
nKey = hb_itemGetCLen( pKeyItem );
HB_SIZE nKey = hb_itemGetCLen( pKeyItem );
if( nKey )
memcpy( pKeyVal, hb_itemGetCPtr( pKeyItem ), HB_MIN( nKey, 8 ) );
if( nKey < 8 )

View File

@@ -1,22 +1,22 @@
/*
* SIX compatible functions:
* sx_GetLocks()
* sx_IsFLocked()
* sx_IsReadonly()
* sx_IsShared()
* sx_IDType()
* sx_TableType()
* sx_TableName()
* sx_Rollback()
* sx_Rlock()
* sx_Unlock()
* sx_SetPass()
* sx_DbfEncrypt()
* sx_DbfDecrypt()
* sx_MemoPack()
* sx_SetTurbo()
* sx_TurboArea()
* _sxOpenInit() (internal function used by _sx_IniInit())
* sx_GetLocks()
* sx_IsFLocked()
* sx_IsReadonly()
* sx_IsShared()
* sx_IDType()
* sx_TableType()
* sx_TableName()
* sx_Rollback()
* sx_Rlock()
* sx_Unlock()
* sx_SetPass()
* sx_DbfEncrypt()
* sx_DbfDecrypt()
* sx_MemoPack()
* sx_SetTurbo()
* sx_TurboArea()
* _sxOpenInit() (internal function used by _sx_IniInit())
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
@@ -220,23 +220,23 @@ HB_FUNC( SX_RLOCK )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
HB_BOOL fResult = HB_FALSE;
PHB_ITEM pResult = NULL, pRecords;
PHB_ITEM pResult = NULL;
if( pArea )
{
PHB_ITEM pRecords = hb_param( 1, HB_IT_ARRAY );
DBLOCKINFO dbLockInfo;
dbLockInfo.fResult = HB_FALSE;
dbLockInfo.uiMethod = DBLM_MULTIPLE;
pRecords = hb_param( 1, HB_IT_ARRAY );
if( pRecords )
{
HB_SIZE ul, nLen = hb_arrayLen( pRecords );
HB_SIZE nPos, nLen = hb_arrayLen( pRecords );
pResult = hb_itemArrayNew( nLen );
for( ul = 1; ul <= nLen; ++ul )
for( nPos = 1; nPos <= nLen; ++nPos )
{
dbLockInfo.itmRecID = hb_arrayGetItemPtr( pRecords, ul );
dbLockInfo.itmRecID = hb_arrayGetItemPtr( pRecords, nPos );
SELF_LOCK( pArea, &dbLockInfo );
hb_arraySetL( pResult, ul, dbLockInfo.fResult );
hb_arraySetL( pResult, nPos, dbLockInfo.fResult );
}
}
else
@@ -262,10 +262,10 @@ HB_FUNC( SX_UNLOCK )
PHB_ITEM pRecords = hb_param( 1, HB_IT_ARRAY );
if( pRecords )
{
HB_SIZE ul, nLen = hb_arrayLen( pRecords );
for( ul = 1; ul <= nLen; ++ul )
HB_SIZE nPos, nLen = hb_arrayLen( pRecords );
for( nPos = 1; nPos <= nLen; ++nPos )
{
SELF_UNLOCK( pArea, hb_arrayGetItemPtr( pRecords, ul ) );
SELF_UNLOCK( pArea, hb_arrayGetItemPtr( pRecords, nPos ) );
}
}
else
@@ -301,7 +301,7 @@ HB_FUNC( SX_SETPASS )
( iPCount < 4 || HB_ISNUM( 4 ) ) )
{
/* Set pending password for table which will be open
* 3-rd and 4-th parameters are optional Harbour extensions
* 3rd and 4th parameters are optional Harbour extensions
* with RDD name and connection number.
*/
LPRDDNODE pRDDNode;

View File

@@ -499,7 +499,7 @@ static int hb_hsxStrCmp( const char * pSub, HB_SIZE nSub, const char * pStr, HB_
{
HB_BOOL fResult = HB_FALSE;
HB_UCHAR c1, c2;
HB_SIZE ul;
HB_SIZE nPos;
if( nSub == 0 )
return HSX_SUCCESSFALSE;
@@ -507,10 +507,10 @@ static int hb_hsxStrCmp( const char * pSub, HB_SIZE nSub, const char * pStr, HB_
while( ! fResult && nLen >= nSub )
{
fResult = HB_TRUE;
for( ul = 0; fResult && ul < nSub; ul++ )
for( nPos = 0; fResult && nPos < nSub; nPos++ )
{
c1 = ( HB_UCHAR ) pSub[ ul ];
c2 = ( HB_UCHAR ) pStr[ ul ];
c1 = ( HB_UCHAR ) pSub[ nPos ];
c2 = ( HB_UCHAR ) pStr[ nPos ];
if( fNoCase )
{
if( iFilter == 3 )
@@ -1284,7 +1284,7 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE nLen,
iResult = HSX_SUCCESSFALSE;
else
{
HB_SIZE ul, ull;
HB_SIZE nPos1, nPos2;
switch( iType )
{
@@ -1298,31 +1298,31 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE nLen,
break;
case HSX_VERIFY_AND:
iResult = HSX_SUCCESS;
for( ul = 0; ul < nSub && iResult == HSX_SUCCESS; ul++ )
for( nPos1 = 0; nPos1 < nSub && iResult == HSX_SUCCESS; nPos1++ )
{
while( szSub[ ul ] == ' ' && ul < nSub )
++ul;
ull = ul;
while( szSub[ ull ] != ' ' && ull < nSub )
++ull;
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, nLen,
while( szSub[ nPos1 ] == ' ' && nPos1 < nSub )
++nPos1;
nPos2 = nPos1;
while( szSub[ nPos2 ] != ' ' && nPos2 < nSub )
++nPos2;
iResult = hb_hsxStrCmp( &szSub[ nPos1 ], nPos2 - nPos1, szText, nLen,
pHSX->fIgnoreCase, pHSX->iFilterType );
ul = ull;
nPos1 = nPos2;
}
break;
#if 0
case HSX_VERIFY_OR:
iResult = HSX_SUCCESSFALSE;
for( ul = 0; ul < nSub && iResult == HSX_SUCCESSFALSE; ul++ )
for( nPos1 = 0; nPos1 < nSub && iResult == HSX_SUCCESSFALSE; nPos1++ )
{
while( szSub[ ul ] == ' ' && ul < nSub )
++ul;
ull = ul;
while( szSub[ ull ] != ' ' && ull < nSub )
++ull;
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, nLen,
while( szSub[ nPos1 ] == ' ' && nPos1 < nSub )
++nPos1;
nPos2 = nPos1;
while( szSub[ nPos2 ] != ' ' && nPos2 < nSub )
++nPos2;
iResult = hb_hsxStrCmp( &szSub[ nPos1 ], nPos2 - nPos1, szText, nLen,
pHSX->fIgnoreCase, pHSX->iFilterType );
ul = ull;
nPos1 = nPos2;
}
break;
#endif
@@ -1836,7 +1836,7 @@ HB_FUNC( HS_FILTER )
{
const char * szText = hb_parc( 2 );
char * pBuff = NULL;
HB_SIZE nLen = hb_parclen( 2 ), ull, ul;
HB_SIZE nLen = hb_parclen( 2 );
HB_ULONG ulRecords = 0;
int iHandle = -1, iResult = HSX_BADPARMS;
HB_BOOL fNew = HB_FALSE, fToken = HB_TRUE;
@@ -1894,17 +1894,19 @@ HB_FUNC( HS_FILTER )
/* to be SIX compatible divide given text on space delimited tokens */
if( fToken )
{
HB_SIZE nPos2, nPos1;
iResult = HSX_SUCCESS;
for( ul = 0; ul < nLen && iResult == HSX_SUCCESS; ul++ )
for( nPos1 = 0; nPos1 < nLen && iResult == HSX_SUCCESS; nPos1++ )
{
while( szText[ ul ] == ' ' && ul < nLen )
++ul;
ull = ul;
while( szText[ ull ] != ' ' && ull < nLen )
++ull;
iResult = hb_hsxFilter( iHandle, &szText[ ul ], ull - ul,
while( szText[ nPos1 ] == ' ' && nPos1 < nLen )
++nPos1;
nPos2 = nPos1;
while( szText[ nPos2 ] != ' ' && nPos2 < nLen )
++nPos2;
iResult = hb_hsxFilter( iHandle, &szText[ nPos1 ], nPos2 - nPos1,
hb_param( 3, HB_IT_ANY ), HSX_VERIFY_PHRASE );
ul = ull;
nPos1 = nPos2;
}
}
else

View File

@@ -295,10 +295,10 @@ static int hb_cdpStd_cmp( PHB_CODEPAGE cdp,
HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n1, n2;
HB_SIZE ul, nLen;
HB_SIZE nPos, nLen;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
for( nPos = 0; nPos < nLen; ++szFirst, ++szSecond, ++nPos )
{
if( *szFirst != *szSecond )
{
@@ -338,19 +338,19 @@ static int hb_cdpStd_cmpi( PHB_CODEPAGE cdp,
const char * szSecond, HB_SIZE nLenSecond,
HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n1, n2, u1, u2;
HB_SIZE ul, nLen;
int iRet = 0, iAcc = 0;
HB_SIZE nPos, nLen;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
for( nPos = 0; nPos < nLen; ++szFirst, ++szSecond, ++nPos )
{
u1 = cdp->upper[ ( HB_UCHAR ) *szFirst ];
u2 = cdp->upper[ ( HB_UCHAR ) *szSecond ];
int u1 = cdp->upper[ ( HB_UCHAR ) *szFirst ];
int u2 = cdp->upper[ ( HB_UCHAR ) *szSecond ];
if( u1 != u2 )
{
n1 = ( HB_UCHAR ) cdp->sort[ u1 ];
n2 = ( HB_UCHAR ) cdp->sort[ u2 ];
int n1 = ( HB_UCHAR ) cdp->sort[ u1 ];
int n2 = ( HB_UCHAR ) cdp->sort[ u2 ];
if( n1 != n2 )
{
iRet = ( n1 < n2 ) ? -1 : 1;
@@ -524,10 +524,11 @@ static HB_BOOL hb_cdpMulti_put( PHB_CODEPAGE cdp,
static int hb_cdpMulti_len( PHB_CODEPAGE cdp, HB_WCHAR wc )
{
int i, n = 1;
int n = 1;
if( wc )
{
int i;
for( i = 0; i < cdp->nMulti; ++i )
{
if( wc == cdp->multi[ i ].wcUp ||
@@ -566,18 +567,20 @@ static int hb_cdpMulti_cmp( PHB_CODEPAGE cdp,
const char * szSecond, HB_SIZE nLenSecond,
HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n, n1, n2;
HB_SIZE ul, nLen;
int iRet = 0, iAcc = 0, n;
HB_SIZE nPos, nLen;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
for( nPos = 0; nPos < nLen; ++szFirst, ++szSecond, ++nPos )
{
int n1, n2;
HB_UCHAR u1 = ( HB_UCHAR ) *szFirst;
HB_UCHAR u2 = ( HB_UCHAR ) *szSecond;
n1 = cdp->sort[ u1 ];
if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < nLenFirst - 1 ) &&
( nPos < nLenFirst - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMulti_weight( cdp, szFirst );
@@ -591,7 +594,7 @@ static int hb_cdpMulti_cmp( PHB_CODEPAGE cdp,
}
n2 = cdp->sort[ u2 ];
if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < nLenSecond - 1 ) &&
( nPos < nLenSecond - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMulti_weight( cdp, szSecond );
@@ -666,17 +669,19 @@ static int hb_cdpMulti_cmpi( PHB_CODEPAGE cdp,
const char * szSecond, HB_SIZE nLenSecond,
HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n, n1, n2, u1, u2;
HB_SIZE ul, nLen;
int iRet = 0, iAcc = 0;
HB_SIZE nPos, nLen;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
for( nPos = 0; nPos < nLen; ++szFirst, ++szSecond, ++nPos )
{
int n, u1, u2, n1, n2;
u1 = cdp->upper[ ( HB_UCHAR ) *szFirst ];
u2 = cdp->upper[ ( HB_UCHAR ) *szSecond ];
if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < nLenFirst - 1 ) &&
( nPos < nLenFirst - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMulti_weightI( cdp, szFirst );
@@ -694,7 +699,7 @@ static int hb_cdpMulti_cmpi( PHB_CODEPAGE cdp,
n1 = cdp->sort[ u1 ];
if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < nLenSecond - 1 ) &&
( nPos < nLenSecond - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMulti_weightI( cdp, szSecond );
@@ -1014,7 +1019,7 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE nLenFirst,
}
/*
* UTF8 conversions
* UTF-8 conversions
*/
int hb_cdpUTF8CharSize( HB_WCHAR wc )
{
@@ -1106,14 +1111,14 @@ HB_BOOL hb_cdpUTF8ToU16NextChar( HB_UCHAR ucChar, int * n, HB_WCHAR * pwc )
HB_SIZE hb_cdpUTF8StringLength( const char * pSrc, HB_SIZE nLen )
{
HB_SIZE ul, nDst;
HB_SIZE nPos, nDst;
HB_WCHAR wc;
int n = 0;
for( ul = nDst = 0; ul < nLen; )
for( nPos = nDst = 0; nPos < nLen; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ul ], &n, &wc ) )
++ul;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPos ], &n, &wc ) )
++nPos;
if( n == 0 )
++nDst;
}
@@ -1203,29 +1208,29 @@ HB_WCHAR hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos )
{
if( nLen )
{
HB_SIZE ul;
HB_SIZE nPos2;
HB_WCHAR wc = 0;
int n = 0;
for( ul = 0; ul < nLen && nPos; )
for( nPos2 = 0; nPos2 < nLen && nPos; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ul ], &n, &wc ) )
++ul;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPos2 ], &n, &wc ) )
++nPos2;
if( n == 0 )
--nPos;
}
if( ul < nLen )
if( nPos2 < nLen )
{
n = 0;
do
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ul ], &n, &wc ) )
++ul;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPos2 ], &n, &wc ) )
++nPos2;
if( n == 0 )
return wc;
}
while( ul < nLen );
while( nPos2 < nLen );
}
}
@@ -1236,37 +1241,39 @@ HB_WCHAR hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos )
char * hb_cdpUTF8StringSubstr( const char * pSrc, HB_SIZE nLen,
HB_SIZE nFrom, HB_SIZE nCount, HB_SIZE * pulDest )
{
HB_SIZE ul, nCnt, nDst = 0;
HB_SIZE nDst = 0;
HB_WCHAR wc;
int n;
char * pDst = NULL;
if( nCount && nLen )
{
HB_SIZE nPos;
n = 0;
for( ul = 0; ul < nLen && nFrom; )
for( nPos = 0; nPos < nLen && nFrom; )
{
if( hb_cdpUTF8ToU16NextChar( pSrc[ ul ], &n, &wc ) )
++ul;
if( hb_cdpUTF8ToU16NextChar( pSrc[ nPos ], &n, &wc ) )
++nPos;
if( n == 0 )
--nFrom;
}
if( ul < nLen )
if( nPos < nLen )
{
nFrom = ul;
HB_SIZE nCnt;
nFrom = nPos;
nCnt = nCount;
n = 0;
do
{
if( hb_cdpUTF8ToU16NextChar( pSrc[ ul ], &n, &wc ) )
++ul;
if( hb_cdpUTF8ToU16NextChar( pSrc[ nPos ], &n, &wc ) )
++nPos;
if( n == 0 )
--nCnt;
}
while( ul < nLen && nCnt );
while( nPos < nLen && nCnt );
nDst = ul - nFrom;
nDst = nPos - nFrom;
pDst = ( char * ) hb_xgrab( nDst + 1 );
memcpy( pDst, &pSrc[ nFrom ], nDst );
pDst[ nDst ] = '\0';
@@ -1290,10 +1297,10 @@ HB_BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, HB_UCHAR ch,
{
if( HB_CDPCHAR_LEN( cdp, *pwc ) == 1 )
{
HB_SIZE nS = 0;
HB_SIZE nSize = 0;
char c;
if( HB_CDPCHAR_PUT( cdp, &c, 1, &nS, *pwc ) )
if( HB_CDPCHAR_PUT( cdp, &c, 1, &nSize, *pwc ) )
*pwc = ( HB_UCHAR ) c;
}
}
@@ -1319,7 +1326,7 @@ HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp,
const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_SIZE ulS, ulD;
HB_SIZE nPosS, nPosD;
int i, n;
if( HB_CDP_ISUTF8( cdp ) )
@@ -1327,40 +1334,40 @@ HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp,
else if( HB_CDP_ISCUSTOM( cdp ) )
{
HB_WCHAR wc;
ulS = ulD = 0;
while( HB_CDPCHAR_GET( cdp, pSrc, nSrc, &ulS, &wc ) )
nPosS = nPosD = 0;
while( HB_CDPCHAR_GET( cdp, pSrc, nSrc, &nPosS, &wc ) )
{
i = hb_cdpUTF8CharSize( wc );
if( nMax && ulD + i > nMax )
if( nMax && nPosD + i > nMax )
break;
ulD += i;
nPosD += i;
}
}
else
{
const HB_WCHAR * uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc; ++nPosS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ nPosS ];
HB_WCHAR wc = uniCodes[ uc ];
if( wc == 0 )
wc = uc;
n = hb_cdpUTF8CharSize( wc );
if( nMax && ulD + n > nMax )
if( nMax && nPosD + n > nMax )
break;
ulD += n;
nPosD += n;
}
}
return ulD;
return nPosD;
}
HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp,
const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst )
{
HB_SIZE ulS, ulD, u;
HB_SIZE nPosS, nPosD, u;
if( HB_CDP_ISUTF8( cdp ) )
{
@@ -1374,14 +1381,14 @@ HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp,
else if( HB_CDP_ISCUSTOM( cdp ) )
{
HB_WCHAR wc;
ulS = ulD = 0;
while( ulD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &ulS, &wc ) )
nPosS = nPosD = 0;
while( nPosD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &nPosS, &wc ) )
{
u = hb_cdpUTF8CharSize( wc );
if( ulD + u <= nDst )
if( nPosD + u <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += u;
hb_cdpU16CharToUTF8( &pDst[ nPosD ], wc );
nPosD += u;
}
else
break;
@@ -1390,35 +1397,35 @@ HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp,
else
{
const HB_WCHAR * uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; ++nPosS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ nPosS ];
HB_WCHAR wc = uniCodes[ uc ];
if( wc == 0 )
wc = uc;
u = hb_cdpUTF8CharSize( wc );
if( ulD + u <= nDst )
if( nPosD + u <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += u;
hb_cdpU16CharToUTF8( &pDst[ nPosD ], wc );
nPosD += u;
}
else
break;
}
}
if( ulD < nDst )
pDst[ ulD ] = '\0';
if( nPosD < nDst )
pDst[ nPosD ] = '\0';
return ulD;
return nPosD;
}
HB_SIZE hb_cdpStrToUTF8Disp( PHB_CODEPAGE cdp,
const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst )
{
HB_SIZE ulS, ulD, u;
HB_SIZE nPosS, nPosD, u;
if( HB_CDP_ISUTF8( cdp ) )
{
@@ -1432,16 +1439,16 @@ HB_SIZE hb_cdpStrToUTF8Disp( PHB_CODEPAGE cdp,
else if( HB_CDP_ISCUSTOM( cdp ) )
{
HB_WCHAR wc;
ulS = ulD = 0;
while( ulD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &ulS, &wc ) )
nPosS = nPosD = 0;
while( nPosD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &nPosS, &wc ) )
{
if( wc < 32 )
wc = s_uniCtrls[ wc ];
u = hb_cdpUTF8CharSize( wc );
if( ulD + u <= nDst )
if( nPosD + u <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += u;
hb_cdpU16CharToUTF8( &pDst[ nPosD ], wc );
nPosD += u;
}
else
break;
@@ -1450,73 +1457,73 @@ HB_SIZE hb_cdpStrToUTF8Disp( PHB_CODEPAGE cdp,
else
{
const HB_WCHAR * uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; ++nPosS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ nPosS ];
HB_WCHAR wc = uniCodes[ uc ];
if( wc == 0 )
wc = uc < 32 ? s_uniCtrls[ uc ] : s_uniCodes[ uc ];
u = hb_cdpUTF8CharSize( wc );
if( ulD + u <= nDst )
if( nPosD + u <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += u;
hb_cdpU16CharToUTF8( &pDst[ nPosD ], wc );
nPosD += u;
}
else
break;
}
}
if( ulD < nDst )
pDst[ ulD ] = '\0';
if( nPosD < nDst )
pDst[ nPosD ] = '\0';
return ulD;
return nPosD;
}
HB_SIZE hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_WCHAR wc = 0;
HB_SIZE ulS, ulD;
HB_SIZE nPosS, nPosD;
int n = 0, i;
if( HB_CDP_ISUTF8( cdp ) )
return ( nMax && nSrc > nMax ) ? nMax : nSrc;
else if( HB_CDP_ISCUSTOM( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc; )
for( nPosS = nPosD = 0; nPosS < nSrc; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
++ulS;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPosS ], &n, &wc ) )
++nPosS;
if( n == 0 )
{
i = HB_CDPCHAR_LEN( cdp, wc );
if( nMax && ulD + i > nMax )
if( nMax && nPosD + i > nMax )
break;
ulD += i;
nPosD += i;
}
}
}
else
{
for( ulS = ulD = 0; ulS < nSrc; )
for( nPosS = nPosD = 0; nPosS < nSrc; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
++ulS;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPosS ], &n, &wc ) )
++nPosS;
if( n == 0 )
{
++ulD;
if( nMax && ulD >= nMax )
++nPosD;
if( nMax && nPosD >= nMax )
break;
}
}
}
return ulD;
return nPosD;
}
HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp,
@@ -1525,7 +1532,7 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp,
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc = 0;
HB_SIZE ulS, ulD;
HB_SIZE nPosS, nPosD;
int n = 0;
if( HB_CDP_ISUTF8( cdp ) )
@@ -1539,14 +1546,14 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp,
}
else if( HB_CDP_ISCUSTOM( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
++ulS;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPosS ], &n, &wc ) )
++nPosS;
if( n == 0 )
{
if( ! HB_CDPCHAR_PUT( cdp, pDst, nDst, &ulD, wc ) )
if( ! HB_CDPCHAR_PUT( cdp, pDst, nDst, &nPosD, wc ) )
break;
}
}
@@ -1558,25 +1565,25 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
++ulS;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPosS ], &n, &wc ) )
++nPosS;
if( n == 0 )
{
if( wc <= wcMax && uniTrans[ wc ] )
pDst[ ulD++ ] = uniTrans[ wc ];
pDst[ nPosD++ ] = uniTrans[ wc ];
else
pDst[ ulD++ ] = wc >= 0x100 ? '?' : ( HB_UCHAR ) wc;
pDst[ nPosD++ ] = wc >= 0x100 ? '?' : ( HB_UCHAR ) wc;
}
}
}
if( ulD < nDst )
pDst[ ulD ] = '\0';
if( nPosD < nDst )
pDst[ nPosD ] = '\0';
return ulD;
return nPosD;
}
/*
@@ -1724,8 +1731,6 @@ HB_SIZE hb_cdpStrAsU16Len( PHB_CODEPAGE cdp,
const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_SIZE ulS, ulD;
if( HB_CDP_ISUTF8( cdp ) )
{
nSrc = hb_cdpUTF8StringLength( pSrc, nSrc );
@@ -1733,14 +1738,15 @@ HB_SIZE hb_cdpStrAsU16Len( PHB_CODEPAGE cdp,
else if( HB_CDP_ISCUSTOM( cdp ) )
{
HB_WCHAR wc;
ulS = ulD = 0;
while( HB_CDPCHAR_GET( cdp, pSrc, nSrc, &ulS, &wc ) )
HB_SIZE nPosS, nPosD;
nPosS = nPosD = 0;
while( HB_CDPCHAR_GET( cdp, pSrc, nSrc, &nPosS, &wc ) )
{
++ulD;
if( nMax && ulD >= nMax )
++nPosD;
if( nMax && nPosD >= nMax )
break;
}
return ulD;
return nPosD;
}
return ( nMax && nSrc > nMax ) ? nMax : nSrc;
@@ -1758,32 +1764,32 @@ HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, int iEndian,
HB_WCHAR * pDst, HB_SIZE nDst )
{
const HB_WCHAR * uniCodes;
HB_SIZE ulS, ulD;
HB_SIZE nPosS, nPosD;
if( HB_CDP_ISUTF8( cdp ) )
{
HB_WCHAR wc = 0;
int n = 0;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
++ulS;
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ nPosS ], &n, &wc ) )
++nPosS;
if( n == 0 )
{
#if defined( HB_CDP_ENDIAN_SWAP )
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
pDst[ ulD++ ] = wc;
pDst[ nPosD++ ] = wc;
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
HB_PUT_LE_UINT16( &pDst[ ulD ], wc );
HB_PUT_LE_UINT16( &pDst[ nPosD ], wc );
else if( iEndian == HB_CDP_ENDIAN_BIG )
HB_PUT_BE_UINT16( &pDst[ ulD ], wc );
HB_PUT_BE_UINT16( &pDst[ nPosD ], wc );
else
pDst[ ulD ] = wc;
++ulD;
pDst[ nPosD ] = wc;
++nPosD;
#endif
}
}
@@ -1791,30 +1797,30 @@ HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, int iEndian,
else if( HB_CDP_ISCUSTOM( cdp ) )
{
HB_WCHAR wc;
ulS = ulD = 0;
while( ulD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &ulS, &wc ) )
nPosS = nPosD = 0;
while( nPosD < nDst && HB_CDPCHAR_GET( cdp, pSrc, nSrc, &nPosS, &wc ) )
{
#if defined( HB_CDP_ENDIAN_SWAP )
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
pDst[ ulD++ ] = wc;
pDst[ nPosD++ ] = wc;
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
HB_PUT_LE_UINT16( &pDst[ ulD ], wc );
HB_PUT_LE_UINT16( &pDst[ nPosD ], wc );
else if( iEndian == HB_CDP_ENDIAN_BIG )
HB_PUT_BE_UINT16( &pDst[ ulD ], wc );
HB_PUT_BE_UINT16( &pDst[ nPosD ], wc );
else
pDst[ ulD ] = wc;
++ulD;
pDst[ nPosD ] = wc;
++nPosD;
#endif
}
}
else
{
uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; ++nPosS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ nPosS ];
HB_WCHAR wc = uniCodes[ uc ];
if( wc == 0 )
@@ -1822,23 +1828,23 @@ HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, int iEndian,
#if defined( HB_CDP_ENDIAN_SWAP )
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
pDst[ ulD++ ] = wc;
pDst[ nPosD++ ] = wc;
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
HB_PUT_LE_UINT16( &pDst[ ulD ], wc );
HB_PUT_LE_UINT16( &pDst[ nPosD ], wc );
else if( iEndian == HB_CDP_ENDIAN_BIG )
HB_PUT_BE_UINT16( &pDst[ ulD ], wc );
HB_PUT_BE_UINT16( &pDst[ nPosD ], wc );
else
pDst[ ulD ] = wc;
++ulD;
pDst[ nPosD ] = wc;
++nPosD;
#endif
}
}
if( ulD < nDst )
pDst[ ulD ] = '\0';
if( nPosD < nDst )
pDst[ nPosD ] = '\0';
return ulD;
return nPosD;
}
HB_WCHAR * hb_cdpnStrDupU16( PHB_CODEPAGE cdp, int iEndian,
@@ -1868,33 +1874,33 @@ HB_SIZE hb_cdpU16AsStrLen( PHB_CODEPAGE cdp,
const HB_WCHAR * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_SIZE ulS, ulD;
HB_SIZE nPosS, nPosD;
int i;
if( HB_CDP_ISUTF8( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc; ++nPosS )
{
i = hb_cdpUTF8CharSize( pSrc[ ulS ] );
if( nMax && ulD + i > nMax )
i = hb_cdpUTF8CharSize( pSrc[ nPosS ] );
if( nMax && nPosD + i > nMax )
break;
ulD += i;
nPosD += i;
}
}
else if( HB_CDP_ISCUSTOM( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc; ++nPosS )
{
i = HB_CDPCHAR_LEN( cdp, pSrc[ ulS ] );
if( nMax && ulD + i > nMax )
i = HB_CDPCHAR_LEN( cdp, pSrc[ nPosS ] );
if( nMax && nPosD + i > nMax )
break;
ulD += i;
nPosD += i;
}
}
else
ulD = ( nMax && nSrc > nMax ) ? nMax : nSrc;
nPosD = ( nMax && nSrc > nMax ) ? nMax : nSrc;
return ulD;
return nPosD;
}
HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, int iEndian,
@@ -1903,30 +1909,30 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, int iEndian,
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc;
HB_SIZE ulS, ulD;
int i;
HB_SIZE nPosS, nPosD;
if( HB_CDP_ISUTF8( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc; ++nPosS )
{
int i;
#if defined( HB_CDP_ENDIAN_SWAP )
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
wc = HB_GET_LE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_LE_UINT16( &pSrc[ nPosS ] );
else if( iEndian == HB_CDP_ENDIAN_BIG )
wc = HB_GET_BE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_BE_UINT16( &pSrc[ nPosS ] );
else
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
#endif
i = hb_cdpUTF8CharSize( wc );
if( ulD + i <= nDst )
if( nPosD + i <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += i;
hb_cdpU16CharToUTF8( &pDst[ nPosD ], wc );
nPosD += i;
}
else
break;
@@ -1934,21 +1940,21 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, int iEndian,
}
else if( HB_CDP_ISCUSTOM( cdp ) )
{
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc; ++nPosS )
{
#if defined( HB_CDP_ENDIAN_SWAP )
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
wc = HB_GET_LE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_LE_UINT16( &pSrc[ nPosS ] );
else if( iEndian == HB_CDP_ENDIAN_BIG )
wc = HB_GET_BE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_BE_UINT16( &pSrc[ nPosS ] );
else
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
#endif
if( ! HB_CDPCHAR_PUT( cdp, pDst, nDst, &ulD, wc ) )
if( ! HB_CDPCHAR_PUT( cdp, pDst, nDst, &nPosD, wc ) )
break;
}
}
@@ -1959,31 +1965,31 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, int iEndian,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
for( nPosS = nPosD = 0; nPosS < nSrc && nPosD < nDst; ++nPosS )
{
#if defined( HB_CDP_ENDIAN_SWAP )
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
if( iEndian == HB_CDP_ENDIAN_SWAP )
wc = HB_SWAP_UINT16( wc );
#else
if( iEndian == HB_CDP_ENDIAN_LITTLE )
wc = HB_GET_LE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_LE_UINT16( &pSrc[ nPosS ] );
else if( iEndian == HB_CDP_ENDIAN_BIG )
wc = HB_GET_BE_UINT16( &pSrc[ ulS ] );
wc = HB_GET_BE_UINT16( &pSrc[ nPosS ] );
else
wc = pSrc[ ulS ];
wc = pSrc[ nPosS ];
#endif
if( wc <= wcMax && uniTrans[ wc ] )
pDst[ ulD++ ] = uniTrans[ wc ];
pDst[ nPosD++ ] = uniTrans[ wc ];
else
pDst[ ulD++ ] = wc >= 0x100 ? '?' : ( HB_UCHAR ) wc;
pDst[ nPosD++ ] = wc >= 0x100 ? '?' : ( HB_UCHAR ) wc;
}
}
if( ulD < nDst )
pDst[ ulD ] = '\0';
if( nPosD < nDst )
pDst[ nPosD ] = '\0';
return ulD;
return nPosD;
}
@@ -2005,11 +2011,11 @@ HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE nSrc, HB_SIZE nMax,
return hb_cdpStrAsUTF8Len( cdpIn, pSrc, nSrc, nMax );
else if( HB_CDP_ISCUSTOM( cdpIn ) || HB_CDP_ISCUSTOM( cdpOut ) )
{
HB_SIZE ulS;
HB_SIZE nPosS;
HB_WCHAR wc;
ulS = nSize = 0;
while( HB_CDPCHAR_GET( cdpIn, pSrc, nSrc, &ulS, &wc ) )
nPosS = nSize = 0;
while( HB_CDPCHAR_GET( cdpIn, pSrc, nSrc, &nPosS, &wc ) )
{
int i = HB_CDPCHAR_LEN( cdpOut, wc );
if( nMax && nSize + i > nMax )
@@ -2042,11 +2048,11 @@ HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE nSrc,
return hb_cdpStrToUTF8( cdpIn, pSrc, nSrc, pDst, nDst );
else if( HB_CDP_ISCUSTOM( cdpIn ) || HB_CDP_ISCUSTOM( cdpOut ) )
{
HB_SIZE ulS;
HB_SIZE nPosS;
HB_WCHAR wc;
ulS = nSize = 0;
while( nSize < nDst && HB_CDPCHAR_GET( cdpIn, pSrc, nSrc, &ulS, &wc ) )
nPosS = nSize = 0;
while( nSize < nDst && HB_CDPCHAR_GET( cdpIn, pSrc, nSrc, &nPosS, &wc ) )
{
if( ! HB_CDPCHAR_PUT( cdpOut, pDst, nDst, &nSize, wc ) )
break;
@@ -3142,7 +3148,7 @@ HB_BOOL hb_cdpRegisterRaw( PHB_CODEPAGE cdp )
{
PHB_CODEPAGE * cdp_ptr;
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpRegisterRaw(%p)", cdp ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpRegisterRaw(%p)", ( void * ) cdp ) );
cdp_ptr = hb_cdpFindPos( cdp->id );
if( *cdp_ptr == NULL )
@@ -3238,7 +3244,7 @@ PHB_CODEPAGE hb_cdpFindExt( const char * id )
HB_BOOL hb_cdpIsUTF8( PHB_CODEPAGE cdp )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpIsUTF8(%p)", cdp ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpIsUTF8(%p)", ( void * ) cdp ) );
if( cdp == NULL )
cdp = hb_vmCDP();
@@ -3250,7 +3256,7 @@ PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdp )
{
PHB_CODEPAGE cdpOld;
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelect(%p)", cdp ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_cdpSelect(%p)", ( void * ) cdp ) );
cdpOld = hb_vmCDP();
if( cdp )

View File

@@ -2456,35 +2456,35 @@ static const char * hb_gt_crs_Version( PHB_GT pGT, int iType )
/* *********************************************************************** */
static void hb_gt_crs_OutStd( PHB_GT pGT, const char * szStr, HB_SIZE ulLen )
static void hb_gt_crs_OutStd( PHB_GT pGT, const char * szStr, HB_SIZE nLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_OutStd(%p,%s,%lu)", pGT, szStr, ulLen ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_OutStd(%p,%s,%lu)", ( void * ) pGT, szStr, nLen ) );
if( s_ioBase )
{
if( s_ioBase->stdoutfd == -1 )
HB_GTSELF_WRITECON( pGT, szStr, ulLen );
HB_GTSELF_WRITECON( pGT, szStr, nLen );
else
gt_outstd( s_ioBase, szStr, ulLen );
gt_outstd( s_ioBase, szStr, nLen );
}
else
HB_GTSUPER_OUTSTD( pGT, szStr, ulLen );
HB_GTSUPER_OUTSTD( pGT, szStr, nLen );
}
/* *********************************************************************** */
static void hb_gt_crs_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE ulLen )
static void hb_gt_crs_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE nLen )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_OutErr(%p,%s,%lu)", pGT, szStr, ulLen ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_OutErr(%p,%s,%lu)", ( void * ) pGT, szStr, nLen ) );
if( s_ioBase )
{
if( s_ioBase->stderrfd == -1 )
HB_GTSELF_WRITECON( pGT, szStr, ulLen );
HB_GTSELF_WRITECON( pGT, szStr, nLen );
else
gt_outerr( s_ioBase, szStr, ulLen );
gt_outerr( s_ioBase, szStr, nLen );
}
else
HB_GTSUPER_OUTERR( pGT, szStr, ulLen );
HB_GTSUPER_OUTERR( pGT, szStr, nLen );
}
/* *********************************************************************** */

View File

@@ -309,7 +309,7 @@ typedef struct
static void hb_gt_xwc_ProcessMessages( PXWND_DEF wnd, HB_BOOL fSync );
static void hb_gt_xwc_InvalidatePts( PXWND_DEF wnd, int left, int top, int right, int bottom );
static void hb_gt_xwc_InvalidateChar( PXWND_DEF wnd, int left, int top, int right, int bottom );
static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char * szData, HB_SIZE ulSize, HB_BOOL fCopy );
static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char * szData, HB_SIZE nSize, HB_BOOL fCopy );
/************************ globals ********************************/
@@ -3379,14 +3379,14 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent * evt )
if( cdpin && cdpin != wnd->utf8CDP )
{
HB_SIZE ulLen = wnd->ClipboardSize;
HB_SIZE nLen = wnd->ClipboardSize;
unsigned char * pBuffer = ( unsigned char * )
hb_cdpnDup( ( const char * ) wnd->ClipboardData, &ulLen,
hb_cdpnDup( ( const char * ) wnd->ClipboardData, &nLen,
wnd->utf8CDP, cdpin );
XChangeProperty( wnd->dpy, req->requestor, req->property,
s_atomString, 8, PropModeReplace,
pBuffer, ulLen );
pBuffer, nLen );
hb_xfree( pBuffer );
}
else
@@ -4384,11 +4384,11 @@ static void hb_gt_xwc_ClearSelection( PXWND_DEF wnd )
/* *********************************************************************** */
static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char * szData, HB_SIZE ulSize, HB_BOOL fCopy )
static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char * szData, HB_SIZE nSize, HB_BOOL fCopy )
{
HB_XWC_XLIB_LOCK( wnd->dpy );
if( ulSize == 0 )
if( nSize == 0 )
hb_gt_xwc_ClearSelection( wnd );
if( wnd->ClipboardData != NULL )
@@ -4397,17 +4397,17 @@ static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char * szData, HB_SIZE
wnd->ClipboardData = NULL;
}
wnd->ClipboardSize = ulSize;
wnd->ClipboardSize = nSize;
wnd->ClipboardTime = wnd->lastEventTime;
wnd->ClipboardOwner = HB_FALSE;
if( ulSize > 0 )
if( nSize > 0 )
{
if( fCopy )
{
wnd->ClipboardData = ( unsigned char * ) hb_xgrab( ulSize + 1 );
memcpy( wnd->ClipboardData, szData, ulSize );
wnd->ClipboardData[ ulSize ] = '\0';
wnd->ClipboardData = ( unsigned char * ) hb_xgrab( nSize + 1 );
memcpy( wnd->ClipboardData, szData, nSize );
wnd->ClipboardData[ nSize ] = '\0';
}
else
wnd->ClipboardData = ( unsigned char * ) HB_UNCONST( szData );

View File

@@ -60,12 +60,12 @@ static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE nDelim,
int iFlags )
{
HB_SIZE ul = 0, nTokens = 1;
HB_SIZE nPos = 0, nTokens = 1;
char cQuote = 0;
while( ul < nLen )
while( nPos < nLen )
{
char ch = szLine[ ul ];
char ch = szLine[ nPos ];
if( cQuote )
{
@@ -81,21 +81,21 @@ static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen,
( ch == '\n' || ch == '\r' ) )
{
++nTokens;
if( ul + 1 < nLen && szLine[ ul + 1 ] == ( ch == '\n' ? '\r' : '\n' ) )
++ul;
if( nPos + 1 < nLen && szLine[ nPos + 1 ] == ( ch == '\n' ? '\r' : '\n' ) )
++nPos;
}
else if( nDelim && ch == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
( nDelim == 1 || ! memcmp( szLine + nPos, szDelim, nDelim ) ) )
{
++nTokens;
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
while( nPos + 1 < nLen && szLine[ nPos + 1 ] == szDelim[ 0 ] )
++nPos;
}
ul += nDelim - 1;
nPos += nDelim - 1;
}
++ul;
++nPos;
}
return nTokens;
@@ -105,12 +105,12 @@ static const char * hb_tokenGet( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE * pnDelim,
int iFlags, HB_SIZE nToken, HB_SIZE * pnLen )
{
HB_SIZE ul, nStart, nDelim = *pnDelim;
HB_SIZE nPos, nStart, nDelim = *pnDelim;
char cQuote = 0;
for( ul = nStart = 0; ul < nLen; ++ul )
for( nPos = nStart = 0; nPos < nLen; ++nPos )
{
char ch = szLine[ ul ];
char ch = szLine[ nPos ];
if( cQuote )
{
@@ -125,37 +125,37 @@ static const char * hb_tokenGet( const char * szLine, HB_SIZE nLen,
else if( ( iFlags & _HB_TOK_EOL_DELIM ) != 0 &&
( ch == '\n' || ch == '\r' ) )
{
HB_SIZE nL = ( ul + 1 < nLen &&
szLine[ ul + 1 ] == ( ch == '\n' ? '\r' : '\n' ) ) ? 1 : 0;
HB_SIZE nL = ( nPos + 1 < nLen &&
szLine[ nPos + 1 ] == ( ch == '\n' ? '\r' : '\n' ) ) ? 1 : 0;
if( --nToken == 0 )
{
*pnDelim = nL + 1;
*pnLen = ul - nStart;
*pnLen = nPos - nStart;
return szLine + nStart;
}
ul += nL;
nStart = ul + 1;
nPos += nL;
nStart = nPos + 1;
}
else if( nDelim && ch == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
( nDelim == 1 || ! memcmp( szLine + nPos, szDelim, nDelim ) ) )
{
if( --nToken == 0 )
{
*pnLen = ul - nStart;
*pnLen = nPos - nStart;
return szLine + nStart;
}
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
while( nPos + 1 < nLen && szLine[ nPos + 1 ] == szDelim[ 0 ] )
++nPos;
}
ul += nDelim - 1;
nStart = ul + 1;
nPos += nDelim - 1;
nStart = nPos + 1;
}
}
if( --nToken == 0 )
{
*pnLen = ul - nStart;
*pnLen = nPos - nStart;
return szLine + nStart;
}
*pnLen = 0;
@@ -171,12 +171,12 @@ static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE nLen,
if( nTokens )
{
HB_SIZE ul, nStart, nToken;
HB_SIZE nPos, nStart, nToken;
char cQuote = 0;
for( ul = nStart = nToken = 0; ul < nLen; ++ul )
for( nPos = nStart = nToken = 0; nPos < nLen; ++nPos )
{
char ch = szLine[ ul ];
char ch = szLine[ nPos ];
if( cQuote )
{
@@ -191,25 +191,25 @@ static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE nLen,
else if( ( iFlags & _HB_TOK_EOL_DELIM ) != 0 &&
( ch == '\n' || ch == '\r' ) )
{
hb_arraySetCL( pArray, ++nToken, szLine + nStart, ul - nStart );
if( ul + 1 < nLen && szLine[ ul + 1 ] == ( ch == '\n' ? '\r' : '\n' ) )
++ul;
nStart = ul + 1;
hb_arraySetCL( pArray, ++nToken, szLine + nStart, nPos - nStart );
if( nPos + 1 < nLen && szLine[ nPos + 1 ] == ( ch == '\n' ? '\r' : '\n' ) )
++nPos;
nStart = nPos + 1;
}
else if( nDelim && ch == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
( nDelim == 1 || ! memcmp( szLine + nPos, szDelim, nDelim ) ) )
{
hb_arraySetCL( pArray, ++nToken, szLine + nStart, ul - nStart );
hb_arraySetCL( pArray, ++nToken, szLine + nStart, nPos - nStart );
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
while( nPos + 1 < nLen && szLine[ nPos + 1 ] == szDelim[ 0 ] )
++nPos;
}
ul += nDelim - 1;
nStart = ul + 1;
nPos += nDelim - 1;
nStart = nPos + 1;
}
}
hb_arraySetCL( pArray, ++nToken, szLine + nStart, ul - nStart );
hb_arraySetCL( pArray, ++nToken, szLine + nStart, nPos - nStart );
}
return pArray;

View File

@@ -109,11 +109,11 @@ char * hb_netname( void )
{
#if defined( HB_OS_WIN )
DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1;
DWORD dwLen = MAX_COMPUTERNAME_LENGTH + 1;
TCHAR lpValue[ MAX_COMPUTERNAME_LENGTH + 1 ];
lpValue[ 0 ] = TEXT( '\0' );
GetComputerName( lpValue, &ulLen );
GetComputerName( lpValue, &dwLen );
lpValue[ MAX_COMPUTERNAME_LENGTH ] = TEXT( '\0' );
if( lpValue[ 0 ] )

View File

@@ -92,11 +92,11 @@ char * hb_username( void )
{
#if defined( HB_OS_WIN )
DWORD ulLen = 256;
DWORD dwLen = 256;
TCHAR lpValue[ 256 ];
lpValue[ 0 ] = TEXT( '\0' );
GetUserName( lpValue, &ulLen );
GetUserName( lpValue, &dwLen );
lpValue[ 255 ] = TEXT( '\0' );
if( lpValue[ 0 ] )

View File

@@ -5784,12 +5784,13 @@ static void hb_vmPushAParams( void )
pArray = hb_stackItemFromTop( -1 );
if( HB_IS_ARRAY( pArray ) )
{
HB_SIZE nLen = pArray->item.asArray.value->nLen, ul;
HB_SIZE nLen = pArray->item.asArray.value->nLen;
if( nLen )
{
for( ul = 1; ul < nLen; ++ul )
hb_vmPush( pArray->item.asArray.value->pItems + ul );
HB_SIZE nPos;
for( nPos = 1; nPos < nLen; ++nPos )
hb_vmPush( pArray->item.asArray.value->pItems + nPos );
pCount = hb_stackAllocItem();
hb_itemCopy( pCount, pArray->item.asArray.value->pItems );
hb_itemMove( pArray, pCount );