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:
@@ -10,6 +10,45 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
2017-08-25 17:57 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com)
|
||||
* contrib/gtwvg/gtwgud.c
|
||||
* contrib/gtwvg/gtwvgd.c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* CT3 string function: CharSpread()
|
||||
* CT3 string function: CharSpread()
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
*
|
||||
@@ -62,22 +62,22 @@ HB_FUNC( CHARSPREAD )
|
||||
else
|
||||
{
|
||||
const char * szText = hb_parc( 1 );
|
||||
char * szDest, cDelim = ' ';
|
||||
HB_ISIZ nTokens = 0, iRepl, iRest, iFirst, i;
|
||||
HB_SIZE ul, nDst, nRest;
|
||||
char cDelim = ' ';
|
||||
HB_ISIZ nTokens = 0;
|
||||
HB_SIZE nPos;
|
||||
|
||||
if( HB_ISCHAR( 3 ) )
|
||||
cDelim = hb_parc( 3 )[ 0 ];
|
||||
else if( HB_ISNUM( 3 ) )
|
||||
cDelim = ( char ) hb_parni( 3 );
|
||||
|
||||
for( ul = 0; ul < nLen; ++ul )
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
{
|
||||
if( szText[ ul ] == cDelim )
|
||||
if( szText[ nPos ] == cDelim )
|
||||
{
|
||||
nTokens++;
|
||||
while( ul + 1 < nLen && szText[ ul + 1 ] == cDelim )
|
||||
++ul;
|
||||
while( nPos + 1 < nLen && szText[ nPos + 1 ] == cDelim )
|
||||
++nPos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,19 +85,25 @@ HB_FUNC( CHARSPREAD )
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
else
|
||||
{
|
||||
HB_ISIZ iRepl, iRest, iFirst;
|
||||
HB_SIZE nDst, nRest;
|
||||
char * szDest;
|
||||
|
||||
nRest = ( HB_SIZE ) nSize - nLen;
|
||||
iRepl = nRest / nTokens;
|
||||
iRest = nRest % nTokens;
|
||||
iFirst = ( iRest + 1 ) >> 1;
|
||||
iRest >>= 1;
|
||||
szDest = ( char * ) hb_xgrab( nSize + 1 );
|
||||
for( nDst = ul = 0; ul < nLen; ++ul )
|
||||
for( nDst = nPos = 0; nPos < nLen; ++nPos )
|
||||
{
|
||||
szDest[ nDst++ ] = szText[ ul ];
|
||||
if( szText[ ul ] == cDelim )
|
||||
szDest[ nDst++ ] = szText[ nPos ];
|
||||
if( szText[ nPos ] == cDelim )
|
||||
{
|
||||
while( ul + 1 < nLen && szText[ ul + 1 ] == cDelim )
|
||||
szDest[ nDst++ ] = szText[ ++ul ];
|
||||
HB_ISIZ i;
|
||||
|
||||
while( nPos + 1 < nLen && szText[ nPos + 1 ] == cDelim )
|
||||
szDest[ nDst++ ] = szText[ ++nPos ];
|
||||
i = iRepl;
|
||||
if( iFirst )
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* CT3 Date & Time functions:
|
||||
* WaitPeriod(), TimeValid(), SetTime(), SetDate()
|
||||
* WaitPeriod(), TimeValid(), SetTime(), SetDate()
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
*
|
||||
@@ -45,7 +45,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* stime exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
/* stime() exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
#ifndef _SVID_SOURCE
|
||||
# define _SVID_SOURCE
|
||||
#endif
|
||||
@@ -101,18 +101,19 @@ static HB_BOOL _hb_timeValid( const char * szTime, HB_SIZE nLen, int * piDecode
|
||||
if( nLen == 2 || nLen == 5 || nLen == 8 || nLen == 11 )
|
||||
{
|
||||
static const int sc_iMax[] = { 23, 59, 59, 99 };
|
||||
int i, iVal;
|
||||
HB_SIZE ul;
|
||||
int i;
|
||||
HB_SIZE nPos;
|
||||
|
||||
fValid = HB_TRUE;
|
||||
for( ul = 0; fValid && ul < nLen; ++ul )
|
||||
for( nPos = 0; fValid && nPos < nLen; ++nPos )
|
||||
{
|
||||
fValid = ul % 3 == 2 ? szTime[ ul ] == ':' :
|
||||
( szTime[ ul ] >= '0' && szTime[ ul ] <= '9' );
|
||||
fValid = nPos % 3 == 2 ? szTime[ nPos ] == ':' :
|
||||
( szTime[ nPos ] >= '0' && szTime[ nPos ] <= '9' );
|
||||
}
|
||||
for( ul = 0, i = 0; fValid && ul < nLen; ul += 3, ++i )
|
||||
for( nPos = 0, i = 0; fValid && nPos < nLen; nPos += 3, ++i )
|
||||
{
|
||||
iVal = 10 * ( szTime[ ul ] - '0' ) + ( szTime[ ul + 1 ] - '0' );
|
||||
int iVal;
|
||||
iVal = 10 * ( szTime[ nPos ] - '0' ) + ( szTime[ nPos + 1 ] - '0' );
|
||||
fValid = iVal <= sc_iMax[ i ];
|
||||
if( piDecode )
|
||||
piDecode[ i ] = iVal;
|
||||
@@ -144,7 +145,7 @@ HB_FUNC( SETTIME )
|
||||
st.wMilliseconds = ( WORD ) iTime[ 3 ] * 10;
|
||||
fResult = SetLocalTime( &st );
|
||||
#elif defined( HB_OS_LINUX ) && ! defined( HB_OS_ANDROID ) && ! defined( __WATCOMC__ )
|
||||
/* stime exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
/* stime() exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
HB_ULONG lNewTime;
|
||||
time_t tm;
|
||||
|
||||
@@ -179,7 +180,7 @@ HB_FUNC( SETDATE )
|
||||
st.wDayOfWeek = ( WORD ) hb_dateJulianDOW( lDate );
|
||||
fResult = SetLocalTime( &st );
|
||||
#elif defined( HB_OS_LINUX ) && ! defined( HB_OS_ANDROID ) && ! defined( __WATCOMC__ )
|
||||
/* stime exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
/* stime() exists only in SVr4, SVID, X/OPEN and Linux */
|
||||
long lNewDate;
|
||||
time_t tm;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* CT3 string function: Expand()
|
||||
* CT3 string function: Expand()
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
*
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
HB_FUNC( EXPAND )
|
||||
{
|
||||
HB_SIZE nLen = hb_parclen( 1 ), ulSize, ul;
|
||||
HB_SIZE nLen = hb_parclen( 1 );
|
||||
|
||||
if( nLen > 0 )
|
||||
{
|
||||
@@ -59,6 +59,7 @@ HB_FUNC( EXPAND )
|
||||
{
|
||||
char * szDest, * szPtr, cRepl;
|
||||
int iRepl, i;
|
||||
HB_SIZE nSize, nPos;
|
||||
|
||||
iRepl = hb_parni( 2 );
|
||||
i = hb_pcount();
|
||||
@@ -83,16 +84,16 @@ HB_FUNC( EXPAND )
|
||||
else
|
||||
cRepl = ' ';
|
||||
}
|
||||
ulSize = ( nLen - 1 ) * ( iRepl + 1 ) + 1;
|
||||
szPtr = szDest = ( char * ) hb_xgrab( ulSize + 1 );
|
||||
nSize = ( nLen - 1 ) * ( iRepl + 1 ) + 1;
|
||||
szPtr = szDest = ( char * ) hb_xgrab( nSize + 1 );
|
||||
*szPtr++ = szText[ 0 ];
|
||||
for( ul = 1; ul < nLen; ++ul )
|
||||
for( nPos = 1; nPos < nLen; ++nPos )
|
||||
{
|
||||
for( i = 0; i < iRepl; ++i )
|
||||
*szPtr++ = cRepl;
|
||||
*szPtr++ = szText[ ul ];
|
||||
*szPtr++ = szText[ nPos ];
|
||||
}
|
||||
hb_retclen_buffer( szDest, ulSize );
|
||||
hb_retclen_buffer( szDest, nSize );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* CT3 Miscellaneous functions: - Complement(), Nul()
|
||||
* CT3 Miscellaneous functions: Complement(), Nul()
|
||||
*
|
||||
* Copyright 2005 Pavel Tsarenko <tpe2@mail.ru>
|
||||
*
|
||||
@@ -55,15 +55,16 @@ HB_FUNC( COMPLEMENT )
|
||||
{
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem ), ulPos;
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem );
|
||||
|
||||
if( nLen > 0 )
|
||||
{
|
||||
const char * szSrc = hb_itemGetCPtr( pItem );
|
||||
char * szBuffer = ( char * ) hb_xgrab( nLen + 1 );
|
||||
HB_SIZE nPos;
|
||||
|
||||
for( ulPos = 0; ulPos < nLen; ulPos++ )
|
||||
szBuffer[ ulPos ] = ~szSrc[ ulPos ];
|
||||
for( nPos = 0; nPos < nLen; nPos++ )
|
||||
szBuffer[ nPos ] = ~szSrc[ nPos ];
|
||||
hb_retclen_buffer( szBuffer, nLen );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* CT3 video functions:
|
||||
*
|
||||
* SayDown(), SaySpread(), SayMoveIn(), ScreenStr(), StrScreen()
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
@@ -57,9 +56,7 @@ HB_FUNC( SAYDOWN )
|
||||
if( nLen )
|
||||
{
|
||||
int iRow, iCol, iMaxRow, iMaxCol;
|
||||
long lDelay;
|
||||
|
||||
lDelay = hb_parnldef( 2, 4 );
|
||||
long lDelay = hb_parnldef( 2, 4 );
|
||||
|
||||
hb_gtGetPos( &iRow, &iCol );
|
||||
if( HB_ISNUM( 3 ) )
|
||||
@@ -113,7 +110,6 @@ HB_FUNC( SAYSPREAD )
|
||||
|
||||
if( nLen )
|
||||
{
|
||||
HB_SIZE nPos, ul;
|
||||
int iRow, iCol, iMaxRow, iMaxCol;
|
||||
long lDelay;
|
||||
|
||||
@@ -130,6 +126,7 @@ HB_FUNC( SAYSPREAD )
|
||||
|
||||
if( iRow >= 0 && iCol >= 0 && iRow <= iMaxRow && iCol <= iMaxCol )
|
||||
{
|
||||
HB_SIZE nPos;
|
||||
int iColor = hb_gtGetCurrColor();
|
||||
|
||||
nPos = nLen >> 1;
|
||||
@@ -143,8 +140,9 @@ HB_FUNC( SAYSPREAD )
|
||||
hb_gtBeginWrite();
|
||||
do
|
||||
{
|
||||
for( ul = 0; ul < nLen && iCol + ( int ) ul <= iMaxCol; ++ul )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) ul, iColor, 0, pwText[ nPos + ul ] );
|
||||
HB_SIZE nPos2;
|
||||
for( nPos2 = 0; nPos2 < nLen && iCol + ( int ) nPos2 <= iMaxCol; ++nPos2 )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) nPos2, iColor, 0, pwText[ nPos + nPos2 ] );
|
||||
nLen += 2;
|
||||
if( lDelay )
|
||||
{
|
||||
@@ -171,8 +169,7 @@ HB_FUNC( SAYMOVEIN )
|
||||
|
||||
if( nLen )
|
||||
{
|
||||
HB_SIZE nChars, ul;
|
||||
int iRow, iCol, iMaxRow, iMaxCol, iNewCol;
|
||||
int iRow, iCol, iMaxRow, iMaxCol;
|
||||
long lDelay;
|
||||
HB_BOOL fBack;
|
||||
|
||||
@@ -189,7 +186,9 @@ HB_FUNC( SAYMOVEIN )
|
||||
|
||||
if( iRow >= 0 && iCol >= 0 && iRow <= iMaxRow && iCol <= iMaxCol )
|
||||
{
|
||||
HB_SIZE nChars;
|
||||
int iColor = hb_gtGetCurrColor();
|
||||
int iNewCol;
|
||||
|
||||
iNewCol = iCol + ( int ) nLen;
|
||||
if( fBack )
|
||||
@@ -201,19 +200,21 @@ HB_FUNC( SAYMOVEIN )
|
||||
hb_gtBeginWrite();
|
||||
do
|
||||
{
|
||||
HB_SIZE nPos;
|
||||
|
||||
if( fBack )
|
||||
{
|
||||
if( iCol <= iMaxCol )
|
||||
{
|
||||
for( ul = 0; ul < nChars; ++ul )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) ul, iColor, 0, pwText[ ul ] );
|
||||
for( nPos = 0; nPos < nChars; ++nPos )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) nPos, iColor, 0, pwText[ nPos ] );
|
||||
}
|
||||
--iCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ul = 0; ul < nChars; ++ul )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) ul, iColor, 0, pwText[ ul ] );
|
||||
for( nPos = 0; nPos < nChars; ++nPos )
|
||||
hb_gtPutChar( iRow, iCol + ( int ) nPos, iColor, 0, pwText[ nPos ] );
|
||||
--pwText;
|
||||
}
|
||||
if( ( int ) nChars + iCol <= iMaxCol )
|
||||
@@ -236,20 +237,16 @@ HB_FUNC( SAYMOVEIN )
|
||||
hb_retc_null();
|
||||
}
|
||||
|
||||
HB_FUNC( CLEARSLOW )
|
||||
HB_FUNC( CLEARSLOW ) /* TODO: Unicode support */
|
||||
{
|
||||
int iMaxRow = hb_gtMaxRow();
|
||||
int iMaxCol = hb_gtMaxCol();
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
long lDelay = hb_parnl( 1 );
|
||||
int iTop = hb_parni( 2 );
|
||||
int iLeft = hb_parni( 3 );
|
||||
int iBottom = hb_parnidef( 4, iMaxRow );
|
||||
int iRight = hb_parnidef( 5, iMaxCol );
|
||||
HB_UCHAR ucChar;
|
||||
long lDelay;
|
||||
|
||||
lDelay = hb_parnl( 1 );
|
||||
|
||||
iTop = hb_parni( 2 );
|
||||
iLeft = hb_parni( 3 );
|
||||
iBottom = hb_parnidef( 4, iMaxRow );
|
||||
iRight = hb_parnidef( 5, iMaxCol );
|
||||
|
||||
if( HB_ISNUM( 6 ) )
|
||||
ucChar = ( HB_UCHAR ) hb_parni( 6 );
|
||||
@@ -321,11 +318,11 @@ HB_FUNC( CLEARSLOW )
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( SCREENSTR )
|
||||
HB_FUNC( SCREENSTR ) /* TODO: Unicode support */
|
||||
{
|
||||
int iRow, iCol, iMaxRow, iMaxCol, iC;
|
||||
char * pBuffer, * szText;
|
||||
HB_SIZE nSize, ulCount = HB_SIZE_MAX;
|
||||
int iRow, iCol, iMaxRow, iMaxCol;
|
||||
char * pBuffer;
|
||||
HB_SIZE nCount = HB_SIZE_MAX;
|
||||
|
||||
hb_gtGetPos( &iRow, &iCol );
|
||||
if( HB_ISNUM( 1 ) )
|
||||
@@ -333,21 +330,22 @@ HB_FUNC( SCREENSTR )
|
||||
if( HB_ISNUM( 2 ) )
|
||||
iCol = hb_parni( 2 );
|
||||
if( HB_ISNUM( 3 ) )
|
||||
ulCount = hb_parns( 3 );
|
||||
nCount = hb_parns( 3 );
|
||||
iMaxRow = hb_gtMaxRow();
|
||||
iMaxCol = hb_gtMaxCol();
|
||||
|
||||
if( iRow >= 0 && iRow <= iMaxRow && iCol >= 0 && iCol <= iMaxCol && ulCount )
|
||||
if( iRow >= 0 && iRow <= iMaxRow && iCol >= 0 && iCol <= iMaxCol && nCount )
|
||||
{
|
||||
nSize = ( HB_SIZE ) ( iMaxRow - iRow + 1 ) * ( iMaxCol - iCol + 1 );
|
||||
if( nSize > ulCount )
|
||||
nSize = ulCount;
|
||||
ulCount = nSize;
|
||||
char * szText;
|
||||
HB_SIZE nSize = ( HB_SIZE ) ( iMaxRow - iRow + 1 ) * ( iMaxCol - iCol + 1 );
|
||||
if( nSize > nCount )
|
||||
nSize = nCount;
|
||||
nCount = nSize;
|
||||
nSize <<= 1;
|
||||
szText = pBuffer = ( char * ) hb_xgrab( nSize + 1 );
|
||||
do
|
||||
{
|
||||
iC = iCol;
|
||||
int iC = iCol;
|
||||
do
|
||||
{
|
||||
int iColor;
|
||||
@@ -357,9 +355,9 @@ HB_FUNC( SCREENSTR )
|
||||
*szText++ = ( char ) usChar;
|
||||
*szText++ = ( char ) iColor;
|
||||
}
|
||||
while( --ulCount && ++iC <= iMaxCol );
|
||||
while( --nCount && ++iC <= iMaxCol );
|
||||
}
|
||||
while( ulCount && ++iRow <= iMaxRow );
|
||||
while( nCount && ++iRow <= iMaxRow );
|
||||
|
||||
hb_retclen_buffer( pBuffer, nSize );
|
||||
}
|
||||
@@ -367,7 +365,7 @@ HB_FUNC( SCREENSTR )
|
||||
hb_retc_null();
|
||||
}
|
||||
|
||||
HB_FUNC( STRSCREEN ) /* TODO: Unicode support */
|
||||
HB_FUNC( STRSCREEN ) /* TODO: Unicode support */
|
||||
{
|
||||
HB_SIZE nLen = hb_parclen( 1 );
|
||||
|
||||
@@ -377,7 +375,7 @@ HB_FUNC( STRSCREEN ) /* TODO: Unicode support */
|
||||
if( nLen )
|
||||
{
|
||||
const char * szText = hb_parc( 1 );
|
||||
int iRow, iCol, iMaxRow, iMaxCol, iC;
|
||||
int iRow, iCol, iMaxRow, iMaxCol;
|
||||
|
||||
hb_gtGetPos( &iRow, &iCol );
|
||||
if( HB_ISNUM( 2 ) )
|
||||
@@ -392,7 +390,7 @@ HB_FUNC( STRSCREEN ) /* TODO: Unicode support */
|
||||
hb_gtBeginWrite();
|
||||
do
|
||||
{
|
||||
iC = iCol;
|
||||
int iC = iCol;
|
||||
do
|
||||
{
|
||||
HB_USHORT usChar = ( HB_UCHAR ) *szText++;
|
||||
@@ -410,10 +408,7 @@ HB_FUNC( STRSCREEN ) /* TODO: Unicode support */
|
||||
hb_retc_null();
|
||||
}
|
||||
|
||||
/*
|
||||
* __hbct_DspTime() is helper functions for ShowTime()
|
||||
*/
|
||||
HB_FUNC( __HBCT_DSPTIME )
|
||||
HB_FUNC( __HBCT_DSPTIME ) /* Helper function for ShowTime() */
|
||||
{
|
||||
int iRow, iCol;
|
||||
int iColor, iLen;
|
||||
|
||||
@@ -1013,12 +1013,12 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
{
|
||||
PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, ulPos + 1 );
|
||||
PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, nPos + 1 );
|
||||
|
||||
curl_formadd( &hb_curl->pHTTPPOST_First,
|
||||
&hb_curl->pHTTPPOST_Last,
|
||||
@@ -1047,11 +1047,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pHTTPHEADER = curl_slist_append( hb_curl->pHTTPHEADER, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pHTTPHEADER = curl_slist_append( hb_curl->pHTTPHEADER, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, hb_curl->pHTTPHEADER );
|
||||
}
|
||||
@@ -1067,11 +1067,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pHTTP200ALIASES = curl_slist_append( hb_curl->pHTTP200ALIASES, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pHTTP200ALIASES = curl_slist_append( hb_curl->pHTTP200ALIASES, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, hb_curl->pHTTP200ALIASES );
|
||||
}
|
||||
@@ -1130,11 +1130,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pMAIL_RCPT = curl_slist_append( hb_curl->pMAIL_RCPT, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pMAIL_RCPT = curl_slist_append( hb_curl->pMAIL_RCPT, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_MAIL_RCPT, hb_curl->pMAIL_RCPT );
|
||||
}
|
||||
@@ -1169,11 +1169,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pQUOTE = curl_slist_append( hb_curl->pQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pQUOTE = curl_slist_append( hb_curl->pQUOTE, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, hb_curl->pQUOTE );
|
||||
}
|
||||
@@ -1188,11 +1188,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pPOSTQUOTE = curl_slist_append( hb_curl->pPOSTQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pPOSTQUOTE = curl_slist_append( hb_curl->pPOSTQUOTE, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_POSTQUOTE, hb_curl->pPOSTQUOTE );
|
||||
}
|
||||
@@ -1207,11 +1207,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pQUOTE = curl_slist_append( hb_curl->pPREQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pQUOTE = curl_slist_append( hb_curl->pPREQUOTE, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_PREQUOTE, hb_curl->pPREQUOTE );
|
||||
}
|
||||
@@ -1443,11 +1443,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pRESOLVE = curl_slist_append( hb_curl->pRESOLVE, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pRESOLVE = curl_slist_append( hb_curl->pRESOLVE, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_RESOLVE, hb_curl->pRESOLVE );
|
||||
}
|
||||
@@ -1608,11 +1608,11 @@ HB_FUNC( CURL_EASY_SETOPT )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE ulArrayLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nPos;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
|
||||
for( ulPos = 0; ulPos < ulArrayLen; ++ulPos )
|
||||
hb_curl->pTELNETOPTIONS = curl_slist_append( hb_curl->pTELNETOPTIONS, hb_arrayGetCPtr( pArray, ulPos + 1 ) );
|
||||
for( nPos = 0; nPos < nLen; ++nPos )
|
||||
hb_curl->pTELNETOPTIONS = curl_slist_append( hb_curl->pTELNETOPTIONS, hb_arrayGetCPtr( pArray, nPos + 1 ) );
|
||||
|
||||
res = curl_easy_setopt( hb_curl->curl, CURLOPT_TELNETOPTIONS, hb_curl->pTELNETOPTIONS );
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ HB_FUNC( STRPEEK )
|
||||
|
||||
if( pText && HB_ISNUM( 2 ) )
|
||||
{
|
||||
HB_SIZE ulPos = hb_parns( 2 );
|
||||
HB_SIZE nPos = hb_parns( 2 );
|
||||
|
||||
if( ulPos > 0 && ulPos <= hb_itemGetCLen( pText ) )
|
||||
hb_retni( ( unsigned char ) hb_itemGetCPtr( pText )[ ulPos - 1 ] );
|
||||
if( nPos > 0 && nPos <= hb_itemGetCLen( pText ) )
|
||||
hb_retni( ( unsigned char ) hb_itemGetCPtr( pText )[ nPos - 1 ] );
|
||||
else
|
||||
hb_retni( 0 );
|
||||
}
|
||||
@@ -74,13 +74,13 @@ HB_FUNC( STRPOKE )
|
||||
|
||||
if( pText && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
|
||||
{
|
||||
HB_SIZE ulPos = hb_parns( 2 ), ulLen;
|
||||
HB_SIZE nPos = hb_parns( 2 ), nLen;
|
||||
char * pszText;
|
||||
|
||||
if( ulPos > 0 && hb_itemGetWriteCL( pText, &pszText, &ulLen ) &&
|
||||
ulPos <= ulLen )
|
||||
if( nPos > 0 && hb_itemGetWriteCL( pText, &pszText, &nLen ) &&
|
||||
nPos <= nLen )
|
||||
{
|
||||
pszText[ ulPos - 1 ] = ( char ) ( hb_parni( 3 ) & 0xff );
|
||||
pszText[ nPos - 1 ] = ( char ) ( hb_parni( 3 ) & 0xff );
|
||||
}
|
||||
hb_itemReturn( pText );
|
||||
}
|
||||
|
||||
@@ -2316,10 +2316,10 @@ static int s_fileLockTest( PHB_FILE pFile, HB_FOFFSET ulStart, HB_FOFFSET ulLen,
|
||||
return iResult;
|
||||
}
|
||||
|
||||
static HB_SIZE s_fileRead( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
static HB_SIZE s_fileRead( PHB_FILE pFile, void * data, HB_SIZE nSize,
|
||||
HB_MAXINT timeout )
|
||||
{
|
||||
HB_SIZE ulResult = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
|
||||
if( s_fileConLock( pFile->conn ) )
|
||||
{
|
||||
@@ -2327,23 +2327,23 @@ static HB_SIZE s_fileRead( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_READ );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], pFile->fd );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ulSize );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], nSize );
|
||||
HB_PUT_LE_UINT64( &msgbuf[ 10 ], timeout );
|
||||
memset( msgbuf + 18, '\0', sizeof( msgbuf ) - 18 );
|
||||
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, NULL, 0, HB_TRUE, HB_FALSE ) )
|
||||
{
|
||||
HB_ERRCODE errCode = ( HB_ERRCODE ) HB_GET_LE_UINT32( &msgbuf[ 8 ] );
|
||||
ulResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
if( ulResult > 0 && ulResult != ( HB_SIZE ) FS_ERROR )
|
||||
nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
if( nResult > 0 && nResult != ( HB_SIZE ) FS_ERROR )
|
||||
{
|
||||
if( ulResult > ulSize ) /* error, it should not happen, enemy attack? */
|
||||
if( nResult > nSize ) /* error, it should not happen, enemy attack? */
|
||||
{
|
||||
pFile->conn->errcode = errCode = NETIO_ERR_WRONG_FILE_SIZE;
|
||||
hb_errRT_NETIO( EG_DATAWIDTH, 1011, 0, NULL, HB_ERR_FUNCNAME );
|
||||
ulResult = 0;
|
||||
nResult = 0;
|
||||
}
|
||||
else if( s_fileRecvAll( pFile->conn, data, ( long ) ulResult ) != ( long ) ulResult )
|
||||
else if( s_fileRecvAll( pFile->conn, data, ( long ) nResult ) != ( long ) nResult )
|
||||
{
|
||||
pFile->conn->errcode = hb_socketGetError();
|
||||
errCode = NETIO_ERR_READ;
|
||||
@@ -2355,13 +2355,13 @@ static HB_SIZE s_fileRead( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
s_fileConUnlock( pFile->conn );
|
||||
}
|
||||
|
||||
return ulResult;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
static HB_SIZE s_fileWrite( PHB_FILE pFile, const void * data, HB_SIZE ulSize,
|
||||
static HB_SIZE s_fileWrite( PHB_FILE pFile, const void * data, HB_SIZE nSize,
|
||||
HB_MAXINT timeout )
|
||||
{
|
||||
HB_SIZE ulResult = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
|
||||
if( s_fileConLock( pFile->conn ) )
|
||||
{
|
||||
@@ -2369,25 +2369,25 @@ static HB_SIZE s_fileWrite( PHB_FILE pFile, const void * data, HB_SIZE ulSize,
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_WRITE );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], pFile->fd );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ( long ) ulSize );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ( long ) nSize );
|
||||
HB_PUT_LE_UINT64( &msgbuf[ 10 ], timeout );
|
||||
memset( msgbuf + 18, '\0', sizeof( msgbuf ) - 18 );
|
||||
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, data, ( long ) ulSize, HB_TRUE, HB_FALSE ) )
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, data, ( long ) nSize, HB_TRUE, HB_FALSE ) )
|
||||
{
|
||||
ulResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
hb_fsSetError( ( HB_ERRCODE ) HB_GET_LE_UINT32( &msgbuf[ 8 ] ) );
|
||||
}
|
||||
s_fileConUnlock( pFile->conn );
|
||||
}
|
||||
|
||||
return ulResult;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * data, HB_SIZE nSize,
|
||||
HB_FOFFSET llOffset )
|
||||
{
|
||||
HB_SIZE ulResult = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
|
||||
if( s_fileConLock( pFile->conn ) )
|
||||
{
|
||||
@@ -2395,23 +2395,23 @@ static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_READAT );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], pFile->fd );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ulSize );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], nSize );
|
||||
HB_PUT_LE_UINT64( &msgbuf[ 10 ], llOffset );
|
||||
memset( msgbuf + 18, '\0', sizeof( msgbuf ) - 18 );
|
||||
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, NULL, 0, HB_TRUE, HB_FALSE ) )
|
||||
{
|
||||
HB_ERRCODE errCode = ( HB_ERRCODE ) HB_GET_LE_UINT32( &msgbuf[ 8 ] );
|
||||
ulResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
if( ulResult > 0 && ulResult != ( HB_SIZE ) FS_ERROR )
|
||||
nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
if( nResult > 0 && nResult != ( HB_SIZE ) FS_ERROR )
|
||||
{
|
||||
if( ulResult > ulSize ) /* error, it should not happen, enemy attack? */
|
||||
if( nResult > nSize ) /* error, it should not happen, enemy attack? */
|
||||
{
|
||||
pFile->conn->errcode = errCode = NETIO_ERR_WRONG_FILE_SIZE;
|
||||
hb_errRT_NETIO( EG_DATAWIDTH, 1009, 0, NULL, HB_ERR_FUNCNAME );
|
||||
ulResult = 0;
|
||||
nResult = 0;
|
||||
}
|
||||
else if( s_fileRecvAll( pFile->conn, data, ( long ) ulResult ) != ( long ) ulResult )
|
||||
else if( s_fileRecvAll( pFile->conn, data, ( long ) nResult ) != ( long ) nResult )
|
||||
{
|
||||
pFile->conn->errcode = hb_socketGetError();
|
||||
errCode = NETIO_ERR_READ;
|
||||
@@ -2423,13 +2423,13 @@ static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * data, HB_SIZE ulSize,
|
||||
s_fileConUnlock( pFile->conn );
|
||||
}
|
||||
|
||||
return ulResult;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * data, HB_SIZE ulSize,
|
||||
static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * data, HB_SIZE nSize,
|
||||
HB_FOFFSET llOffset )
|
||||
{
|
||||
HB_SIZE ulResult = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
|
||||
if( s_fileConLock( pFile->conn ) )
|
||||
{
|
||||
@@ -2437,19 +2437,19 @@ static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * data, HB_SIZE ulSize,
|
||||
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_WRITEAT );
|
||||
HB_PUT_LE_UINT16( &msgbuf[ 4 ], pFile->fd );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ( long ) ulSize );
|
||||
HB_PUT_LE_UINT32( &msgbuf[ 6 ], ( long ) nSize );
|
||||
HB_PUT_LE_UINT64( &msgbuf[ 10 ], llOffset );
|
||||
memset( msgbuf + 18, '\0', sizeof( msgbuf ) - 18 );
|
||||
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, data, ( long ) ulSize, HB_TRUE, HB_FALSE ) )
|
||||
if( s_fileSendMsg( pFile->conn, msgbuf, data, ( long ) nSize, HB_TRUE, HB_FALSE ) )
|
||||
{
|
||||
ulResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] );
|
||||
hb_fsSetError( ( HB_ERRCODE ) HB_GET_LE_UINT32( &msgbuf[ 8 ] ) );
|
||||
}
|
||||
s_fileConUnlock( pFile->conn );
|
||||
}
|
||||
|
||||
return ulResult;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
static HB_BOOL s_fileTruncAt( PHB_FILE pFile, HB_FOFFSET llOffset )
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static void hb_oleSafeArrayToItem( PHB_ITEM pItem, SAFEARRAY * pSafeArray,
|
||||
SafeArrayGetUBound( pSafeArray, iDim, &lTo ) == S_OK &&
|
||||
lFrom <= lTo )
|
||||
{
|
||||
HB_SIZE ul = 0;
|
||||
HB_SIZE nIndex = 0;
|
||||
|
||||
hb_arrayNew( pItem, lTo - lFrom + 1 );
|
||||
if( iDim == iDims )
|
||||
@@ -1153,7 +1153,7 @@ static void hb_oleSafeArrayToItem( PHB_ITEM pItem, SAFEARRAY * pSafeArray,
|
||||
{
|
||||
if( vt != VT_VARIANT )
|
||||
V_VT( &vItem ) = vt; /* it's reserved in VT_DECIMAL structure */
|
||||
hb_oleVariantToItemEx( hb_arrayGetItemPtr( pItem, ++ul ), &vItem, uiClass );
|
||||
hb_oleVariantToItemEx( hb_arrayGetItemPtr( pItem, ++nIndex ), &vItem, uiClass );
|
||||
VariantClear( &vItem );
|
||||
}
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ static void hb_oleSafeArrayToItem( PHB_ITEM pItem, SAFEARRAY * pSafeArray,
|
||||
do
|
||||
{
|
||||
plIndex[ iDim - 1 ] = lFrom;
|
||||
hb_oleSafeArrayToItem( hb_arrayGetItemPtr( pItem, ++ul ),
|
||||
hb_oleSafeArrayToItem( hb_arrayGetItemPtr( pItem, ++nIndex ),
|
||||
pSafeArray, iDims, iDim + 1, plIndex, vt, uiClass );
|
||||
}
|
||||
while( ++lFrom <= lTo );
|
||||
|
||||
@@ -190,12 +190,12 @@ static PMIXKEY mixKeyNew( PHB_ITEM pItem, HB_ULONG ulRecNo, HB_BYTE bType, HB_US
|
||||
{
|
||||
case 'C':
|
||||
{
|
||||
HB_SIZE ul = hb_itemGetCLen( pItem );
|
||||
if( ul > ( HB_SIZE ) uiLen )
|
||||
ul = uiLen;
|
||||
memcpy( pKey->val, hb_itemGetCPtr( pItem ), ul );
|
||||
if( ul < ( HB_SIZE ) uiLen )
|
||||
memset( pKey->val + ul, ' ', ( HB_SIZE ) uiLen - ul );
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem );
|
||||
if( nLen > ( HB_SIZE ) uiLen )
|
||||
nLen = uiLen;
|
||||
memcpy( pKey->val, hb_itemGetCPtr( pItem ), nLen );
|
||||
if( nLen < ( HB_SIZE ) uiLen )
|
||||
memset( pKey->val + nLen, ' ', ( HB_SIZE ) uiLen - nLen );
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
@@ -783,9 +783,9 @@ static HB_ERRCODE adsxSeek( ADSXAREAP pArea, HB_BOOL bSoftSeek, PHB_ITEM pKey, H
|
||||
|
||||
if( pArea->pTagCurrent->bType == 'C' )
|
||||
{
|
||||
HB_SIZE ul = hb_itemGetCLen( pKey );
|
||||
if( ul < ( HB_SIZE ) uiLen )
|
||||
uiLen = ( HB_USHORT ) ul;
|
||||
HB_SIZE nLen = hb_itemGetCLen( pKey );
|
||||
if( nLen < ( HB_SIZE ) uiLen )
|
||||
uiLen = ( HB_USHORT ) nLen;
|
||||
}
|
||||
|
||||
/* reset any pending relations - I hope ACE make the same and the problem
|
||||
|
||||
@@ -197,8 +197,8 @@ extern ADSAREAP hb_adsGetWorkAreaPointer( void );
|
||||
|
||||
#ifdef ADS_USE_OEM_TRANSLATION
|
||||
extern HB_BOOL hb_ads_bOEM;
|
||||
extern char * hb_adsOemToAnsi( const char * pcString, HB_SIZE ulLen );
|
||||
extern char * hb_adsAnsiToOem( const char * pcString, HB_SIZE ulLen );
|
||||
extern char * hb_adsOemToAnsi( const char * pcString, HB_SIZE nLen );
|
||||
extern char * hb_adsAnsiToOem( const char * pcString, HB_SIZE nLen );
|
||||
extern void hb_adsOemAnsiFree( char * pcString );
|
||||
|
||||
/* NOTE: Undocumented ACE function. */
|
||||
|
||||
@@ -151,15 +151,15 @@ static PMIXKEY hb_mixKeyPutItem( PMIXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRecNo,
|
||||
{
|
||||
case 'C':
|
||||
{
|
||||
HB_SIZE ul = hb_itemGetCLen( pItem );
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem );
|
||||
|
||||
if( ul > ( HB_SIZE ) pTag->uiKeyLen )
|
||||
ul = pTag->uiKeyLen;
|
||||
if( nLen > ( HB_SIZE ) pTag->uiKeyLen )
|
||||
nLen = pTag->uiKeyLen;
|
||||
|
||||
memcpy( pKey->val, hb_itemGetCPtr( pItem ), ul );
|
||||
memcpy( pKey->val, hb_itemGetCPtr( pItem ), nLen );
|
||||
|
||||
if( ul < ( HB_SIZE ) pTag->uiKeyLen )
|
||||
memset( pKey->val + ul, ' ', ( HB_SIZE ) pTag->uiKeyLen - ul );
|
||||
if( nLen < ( HB_SIZE ) pTag->uiKeyLen )
|
||||
memset( pKey->val + nLen, ' ', ( HB_SIZE ) pTag->uiKeyLen - nLen );
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -333,13 +333,11 @@ static void hb_mixTagPrintNode( PMIXTAG pTag, PMIXNODE pNode, int iLevel )
|
||||
|
||||
static PMIXNODE hb_mixTagCreateNode( PMIXTAG pTag, HB_BOOL fLeaf )
|
||||
{
|
||||
PMIXNODE pNode;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize = ( fLeaf ? sizeof( MIXNODELEAF ) : sizeof( MIXNODE ) ) + MIX_NODE_ORDER * pTag->uiTotalLen;
|
||||
PMIXNODE pNode = ( PMIXNODE ) hb_xgrabz( nSize );
|
||||
|
||||
ulSize = ( fLeaf ? sizeof( MIXNODELEAF ) : sizeof( MIXNODE ) ) + MIX_NODE_ORDER * pTag->uiTotalLen;
|
||||
|
||||
pNode = ( PMIXNODE ) hb_xgrabz( ulSize );
|
||||
pNode->Leaf = fLeaf ? 1 : 0;
|
||||
|
||||
return pNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -491,14 +491,14 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
|
||||
char szBuffer[ 64 ];
|
||||
HB_BOOL bError;
|
||||
PHB_ITEM pError;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
bError = HB_FALSE;
|
||||
uiIndex--;
|
||||
pField = pArea->area.lpFields + uiIndex;
|
||||
|
||||
pValue = pSDDData->pNatRecord[ uiIndex ];
|
||||
ulLen = pSDDData->pNatLength[ uiIndex ];
|
||||
nLen = pSDDData->pNatLength[ uiIndex ];
|
||||
|
||||
/* NULL => NIL (?) */
|
||||
if( ! pValue )
|
||||
@@ -516,22 +516,22 @@ static HB_ERRCODE mysqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
|
||||
|
||||
/* Expand strings to field length */
|
||||
pStr = ( char * ) hb_xgrab( pField->uiLen + 1 );
|
||||
memcpy( pStr, pValue, ulLen );
|
||||
memcpy( pStr, pValue, nLen );
|
||||
|
||||
if( ( HB_SIZE ) pField->uiLen > ulLen )
|
||||
memset( pStr + ulLen, ' ', pField->uiLen - ulLen );
|
||||
if( ( HB_SIZE ) pField->uiLen > nLen )
|
||||
memset( pStr + nLen, ' ', pField->uiLen - nLen );
|
||||
|
||||
pStr[ pField->uiLen ] = '\0';
|
||||
hb_itemPutCRaw( pItem, pStr, pField->uiLen );
|
||||
#else
|
||||
/* Do not expand strings */
|
||||
hb_itemPutCL( pItem, pValue, ulLen );
|
||||
hb_itemPutCL( pItem, pValue, nLen );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case HB_FT_MEMO:
|
||||
hb_itemPutCL( pItem, pValue, ulLen );
|
||||
hb_itemPutCL( pItem, pValue, nLen );
|
||||
hb_itemSetCMemo( pItem );
|
||||
break;
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
|
||||
char * pValue;
|
||||
HB_BOOL bError;
|
||||
PHB_ITEM pError;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
bError = HB_FALSE;
|
||||
uiIndex--;
|
||||
@@ -508,18 +508,18 @@ static HB_ERRCODE pgsqlGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM
|
||||
return HB_SUCCESS;
|
||||
|
||||
pValue = PQgetvalue( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex );
|
||||
ulLen = ( HB_SIZE ) PQgetlength( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex );
|
||||
nLen = ( HB_SIZE ) PQgetlength( pSDDData->pResult, pArea->ulRecNo - 1, uiIndex );
|
||||
|
||||
/* printf( "fieldget recno:%d index:%d value:%s len:%d\n", pArea->ulRecNo, uiIndex, pValue, ulLen ); */
|
||||
/* printf( "fieldget recno:%d index:%d value:%s len:%d\n", pArea->ulRecNo, uiIndex, pValue, nLen ); */
|
||||
|
||||
switch( pField->uiType )
|
||||
{
|
||||
case HB_FT_STRING:
|
||||
hb_itemPutCL( pItem, pValue, ulLen );
|
||||
hb_itemPutCL( pItem, pValue, nLen );
|
||||
break;
|
||||
|
||||
case HB_FT_MEMO:
|
||||
hb_itemPutCL( pItem, pValue, ulLen );
|
||||
hb_itemPutCL( pItem, pValue, nLen );
|
||||
hb_itemSetCMemo( pItem );
|
||||
break;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#ifdef __XHARBOUR__
|
||||
|
||||
#define hb_retc_buffer( szText ) hb_retcAdopt( ( szText ) )
|
||||
#define hb_retclen_buffer( szText, ulLen ) hb_retclenAdopt( ( szText ), ( ulLen ) )
|
||||
#define hb_retclen_buffer( szText, nLen ) hb_retclenAdopt( ( szText ), ( nLen ) )
|
||||
#define hb_retc_const( szText ) hb_retcStatic( ( szText ) )
|
||||
|
||||
#define hb_storclen_buffer hb_storclenAdopt
|
||||
@@ -100,7 +100,7 @@
|
||||
#else
|
||||
|
||||
#define hb_retcAdopt( szText ) hb_retc_buffer( ( szText ) )
|
||||
#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( ( szText ), ( ulLen ) )
|
||||
#define hb_retclenAdopt( szText, nLen ) hb_retclen_buffer( ( szText ), ( nLen ) )
|
||||
#define hb_retcStatic( szText ) hb_retc_const( ( szText ) )
|
||||
|
||||
#define hb_storclenAdopt hb_storclen_buffer
|
||||
|
||||
@@ -2261,7 +2261,7 @@ HB_FUNC( HBXML_DATAREAD )
|
||||
PHB_ITEM pRoot;
|
||||
MXML_REFIL refil;
|
||||
char buffer[ 512 ], * buf;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
if( pDoc == NULL || pParam == NULL ||
|
||||
( ! HB_IS_STRING( pParam ) && ! HB_IS_NUMERIC( pParam ) ) )
|
||||
@@ -2270,8 +2270,8 @@ HB_FUNC( HBXML_DATAREAD )
|
||||
return;
|
||||
}
|
||||
|
||||
if( hb_itemGetWriteCL( pParam, &buf, &ulLen ) )
|
||||
mxml_refil_setup( &refil, NULL, buf, ulLen, ulLen );
|
||||
if( hb_itemGetWriteCL( pParam, &buf, &nLen ) )
|
||||
mxml_refil_setup( &refil, NULL, buf, nLen, nLen );
|
||||
else /* can only be an integer, that is, a file handle */
|
||||
{
|
||||
mxml_refil_setup( &refil,
|
||||
|
||||
@@ -54,7 +54,7 @@ HB_EXTERN_BEGIN
|
||||
|
||||
/* functions in hboutdbg.c */
|
||||
extern HB_EXPORT HB_BOOL hb_OutDebugName( PHB_ITEM pName );
|
||||
extern HB_EXPORT void hb_OutDebug( const char * szMsg, HB_SIZE ulMsgLen );
|
||||
extern HB_EXPORT void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen );
|
||||
|
||||
/* functions in dbgfxc.c */
|
||||
extern HB_EXPORT HB_BOOL hb_ToOutDebugOnOff( HB_BOOL bOnOff );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 ] == '.' )
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
380
src/rtl/cdpapi.c
380
src/rtl/cdpapi.c
@@ -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 )
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
/* *********************************************************************** */
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 ] )
|
||||
|
||||
@@ -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 ] )
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user