2010-02-09 14:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/hbregex.c
    ! Added distinctive error codes to different RTEs.
    % Deleted English strings from error messages.

  * include/clipdefs.h
    ! Fixed for OS/2 after recent changes. (type collision of legacy
      types with OS/2 system types)

  * src/rtl/strxor.c
  * src/rtl/trim.c
  * src/rtl/transfrm.c
  * src/rtl/strzero.c
  * src/rtl/strtran.c
  * src/rtl/strc.c
  * src/rtl/space.c
  * src/rtl/trace.c
  * src/rtl/soundex.c
  * src/rtl/valtostr.c
    * Size variables renamed to have 'n' prefix instead of
      'ul' and 'l'.
This commit is contained in:
Viktor Szakats
2010-02-09 13:27:39 +00:00
parent 9bdccf121d
commit 39b4e1f6f8
13 changed files with 189 additions and 170 deletions

View File

@@ -17,6 +17,28 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-09 14:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbregex.c
! Added distinctive error codes to different RTEs.
% Deleted English strings from error messages.
* include/clipdefs.h
! Fixed for OS/2 after recent changes. (type collision of legacy
types with OS/2 system types)
* src/rtl/strxor.c
* src/rtl/trim.c
* src/rtl/transfrm.c
* src/rtl/strzero.c
* src/rtl/strtran.c
* src/rtl/strc.c
* src/rtl/space.c
* src/rtl/trace.c
* src/rtl/soundex.c
* src/rtl/valtostr.c
* Size variables renamed to have 'n' prefix instead of
'ul' and 'l'.
2010-02-09 09:35 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbfbird/firebird.c
! Fixed warning after recent GC conversion on 64-bit non-Windows
@@ -520,7 +542,7 @@
- Retest hbfimage on *nix, delete hacks [DONE]
- Replace current windows.h inclusion hack with regular method [DONE]
- Delete hacks dealing with former type chaos:
HB_CLIPPER_INT_ITEMS, HB_DONT_DEFINE_BASIC_TYPES, HB_DONT_DEFINE_BOOL, HB_DONT_DEFINE_BYTE, HB_DONT_DEFINE_LONG
HB_DONT_DEFINE_BASIC_TYPES, HB_DONT_DEFINE_BOOL, HB_DONT_DEFINE_BYTE, HB_DONT_DEFINE_LONG
- Normalize HB_BYTE vs. HB_UCHAR usage
- Type cleanups, f.e. HB_SIZE vs. HB_ULONG
- Add new special types (see above)

View File

@@ -62,7 +62,7 @@
/* New types */
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
typedef unsigned char BYTE;
#endif
typedef BYTE * BYTEP;
@@ -71,7 +71,7 @@ typedef BYTEP BYTEPP;
typedef BYTEP PBYTE;
#endif
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
typedef short SHORT;
#endif
typedef SHORT * SHORTP;
@@ -79,7 +79,7 @@ typedef SHORT * SHORTP;
typedef SHORTP PSHORT;
#endif
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
typedef unsigned short USHORT;
#endif
typedef USHORT * USHORTP;
@@ -88,12 +88,12 @@ typedef USHORTP PUSHORT;
#endif
#if !( defined( HB_OS_WIN ) && defined( HB_OS_WIN_USED ) )
typedef unsigned int WORD;
typedef WORD * WORDP;
typedef WORDP PWORD;
typedef unsigned int WORD;
typedef WORD * WORDP;
typedef WORDP PWORD;
#endif
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
typedef long LONG;
#endif
typedef LONG * LONGP;
@@ -101,7 +101,7 @@ typedef LONG * LONGP;
typedef LONGP PLONG;
#endif
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
typedef unsigned long ULONG;
#endif
typedef ULONG * ULONGP;
@@ -113,7 +113,7 @@ typedef unsigned long DWORD;
typedef DWORD * DWORDP;
typedef DWORDP PDWORD;
#if defined( HB_LEGACY_TYPES_OFF )
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) ) && defined( HB_LEGACY_TYPES_OFF )
#undef BOOL
typedef USHORT BOOL;
#endif
@@ -126,13 +126,13 @@ typedef void * NEARP;
typedef NEARP * NEARPP;
#if !( defined( HB_OS_WIN ) && defined( HB_OS_WIN_USED ) )
typedef void * FARP;
typedef FARP * FARPP;
typedef FARP VOIDP;
typedef void * FARP;
typedef FARP * FARPP;
typedef FARP VOIDP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef FARP PVOID;
typedef FARP PVOID;
#endif
typedef HB_VMHANDLE HANDLE;
typedef HB_VMHANDLE HANDLE;
#endif
#define ERRCODE HB_ERRCODE
@@ -148,16 +148,16 @@ typedef FUNCP * FUNCPP;
#define CLIPPER HARBOUR
#if defined( HB_LEGACY_TYPES_OFF )
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE 1
# undef FALSE
# define FALSE 0
# undef TRUE
# define TRUE 1
#endif
#ifndef NIL
#define NIL '\0'
# define NIL '\0'
#endif
#ifndef NULL
#define NULL 0
# define NULL 0
#endif
/* Old types */

View File

@@ -157,14 +157,13 @@ HB_FUNC( HB_REGEXCOMP )
HB_SIZE ulLen = hb_parclen( 1 );
if( ulLen == 0 )
hb_errRT_BASE_SubstR( EG_ARG, 3012, "Wrong parameter count/type",
HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
else
{
int iFlags = HBREG_EXTENDED;
PHB_REGEX pRegEx;
if( !hb_parldef( 2, 1 ) )
if( ! hb_parldef( 2, 1 ) )
iFlags |= HBREG_ICASE;
if( hb_parl( 3 ) )
iFlags |= HBREG_NEWLINE;
@@ -192,17 +191,16 @@ HB_FUNC( HB_ATX )
int iPCount = hb_pcount();
pString = hb_param( 2, HB_IT_STRING );
if( !pString )
if( ! pString )
{
hb_errRT_BASE_SubstR( EG_ARG, 3012, "Wrong parameters",
HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
hb_errRT_BASE_SubstR( EG_ARG, 3013, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
return;
}
pszString = hb_itemGetCPtr( pString );
ulLen = hb_itemGetCLen( pString );
pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ),
!hb_parldef( 3, 1 ) ? HBREG_ICASE : 0 );
if( !pRegEx )
if( ! pRegEx )
return;
ulStart = hb_parnl( 4 );
@@ -253,8 +251,7 @@ static HB_BOOL hb_regex( int iRequest )
pString = hb_param( 2, HB_IT_STRING );
if( !pString )
{
hb_errRT_BASE_SubstR( EG_ARG, 3012, "Wrong parameters",
HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
hb_errRT_BASE_SubstR( EG_ARG, 3014, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
return HB_FALSE;
}
pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ),

View File

@@ -69,12 +69,12 @@ HB_FUNC( SOUNDEX )
if( pString )
{
const char * pszString = hb_itemGetCPtr( pString );
HB_SIZE ulLen = hb_itemGetCLen( pString );
HB_SIZE nLen = hb_itemGetCLen( pString );
HB_SIZE nPos = 0;
HB_SIZE nResultPos = 0;
char cCharPrev = '0';
while( nPos < ulLen && nResultPos < SOUNDEX_LEN_MAX )
while( nPos < nLen && nResultPos < SOUNDEX_LEN_MAX )
{
char cChar = pszString[ nPos ];

View File

@@ -62,19 +62,19 @@ HB_FUNC( SPACE )
if( pItem )
{
HB_ISIZ lLen = hb_itemGetNL( pItem );
HB_ISIZ nLen = hb_itemGetNL( pItem );
if( lLen > 0 )
if( nLen > 0 )
{
char * szResult = ( char * ) hb_xgrab( lLen + 1 );
char * szResult = ( char * ) hb_xgrab( nLen + 1 );
/* NOTE: String overflow could never occure since a string can
be as large as ULONG_MAX, and the maximum length that
can be specified is LONG_MAX here. [vszakats] */
/* hb_errRT_BASE( EG_STROVERFLOW, 1233, NULL, HB_ERR_FUNCNAME ); */
hb_xmemset( szResult, ' ', lLen );
hb_retclen_buffer( szResult, lLen );
hb_xmemset( szResult, ' ', nLen );
hb_retclen_buffer( szResult, nLen );
}
else
hb_retc_null();

View File

@@ -64,13 +64,13 @@ HB_FUNC( HB_STRDECODESCAPE )
if( pText )
{
HB_SIZE ulLen = hb_itemGetCLen( pText );
if( ulLen > 0 )
HB_SIZE nLen = hb_itemGetCLen( pText );
if( nLen > 0 )
{
char * str = ( char * ) hb_xgrab( ulLen + 1 );
hb_xmemcpy( str, hb_itemGetCPtr( pText ), ulLen + 1 );
hb_strRemEscSeq( str, &ulLen );
hb_retclen_buffer( str, ulLen );
char * str = ( char * ) hb_xgrab( nLen + 1 );
hb_xmemcpy( str, hb_itemGetCPtr( pText ), nLen + 1 );
hb_strRemEscSeq( str, &nLen );
hb_retclen_buffer( str, nLen );
}
else
hb_itemReturn( pText );
@@ -92,65 +92,65 @@ HB_FUNC( HB_STRCDECODE )
if( pText )
{
HB_SIZE ulLen = hb_itemGetCLen( pText );
HB_SIZE nLen = hb_itemGetCLen( pText );
HB_BOOL fCont = hb_parl( 2 );
if( ulLen > 0 )
if( nLen > 0 )
{
const char * pszSrc = hb_itemGetCPtr( pText );
char * pszDst = ( char * ) hb_xgrab( ulLen + 1 );
HB_SIZE ulDst = 0, ul;
char * pszDst = ( char * ) hb_xgrab( nLen + 1 );
HB_SIZE nDst = 0, n;
for( ;; )
{
if( !fCont )
{
while( ulLen && HB_ISSPACE( *pszSrc ) )
while( nLen && HB_ISSPACE( *pszSrc ) )
{
++pszSrc;
--ulLen;
--nLen;
}
if( ulLen && *pszSrc == '"' )
if( nLen && *pszSrc == '"' )
{
++pszSrc;
--ulLen;
--nLen;
fCont = HB_TRUE;
}
}
if( !fCont || !ulLen )
if( ! fCont || ! nLen )
break;
ul = 0;
while( ul < ulLen )
n = 0;
while( n < nLen )
{
char c = pszSrc[ ul ];
char c = pszSrc[ n ];
if( c == '"' )
{
fCont = HB_FALSE;
break;
}
pszDst[ ulDst + ul ] = c;
if( ++ul < ulLen && c == '\\' )
pszDst[ nDst + n ] = c;
if( ++n < nLen && c == '\\' )
{
pszDst[ ulDst + ul ] = pszSrc[ ul ];
++ul;
pszDst[ nDst + n ] = pszSrc[ n ];
++n;
}
}
if( ul > 0 )
if( n > 0 )
{
pszSrc += ul;
ulLen -= ul;
hb_strRemEscSeq( pszDst + ulDst, &ul );
ulDst += ul;
pszSrc += n;
nLen -= n;
hb_strRemEscSeq( pszDst + nDst, &n );
nDst += n;
}
if( !fCont )
{
++pszSrc;
--ulLen;
--nLen;
}
}
if( ulLen == 0 && ( !fCont || HB_ISBYREF( 2 ) ) )
if( nLen == 0 && ( !fCont || HB_ISBYREF( 2 ) ) )
{
hb_retclen_buffer( pszDst, ulDst );
hb_retclen_buffer( pszDst, nDst );
hb_storl( fCont, 2 );
}
else

View File

@@ -68,70 +68,70 @@ HB_FUNC( STRTRAN )
if( pText && pSeek )
{
const char * szText = hb_itemGetCPtr( pText );
HB_SIZE ulText = hb_itemGetCLen( pText );
HB_SIZE ulSeek = hb_itemGetCLen( pSeek );
HB_SIZE nText = hb_itemGetCLen( pText );
HB_SIZE nSeek = hb_itemGetCLen( pSeek );
if( ulSeek && ulSeek <= ulText )
if( nSeek && nSeek <= nText )
{
const char * szSeek = hb_itemGetCPtr( pSeek );
const char * szReplace;
HB_SIZE ulStart;
HB_SIZE nStart;
ulStart = ( HB_ISNUM( 4 ) ? hb_parnl( 4 ) : 1 );
nStart = ( HB_ISNUM( 4 ) ? hb_parnl( 4 ) : 1 );
if( !ulStart )
if( nStart == 0 )
{
/* Clipper seems to work this way */
hb_retc_null();
}
else if( ulStart > 0 )
else if( nStart > 0 )
{
PHB_ITEM pReplace = hb_param( 3, HB_IT_STRING );
HB_SIZE ulReplace;
HB_SIZE ulCount;
HB_SIZE nReplace;
HB_SIZE nCount;
HB_BOOL bAll;
if( pReplace )
{
szReplace = hb_itemGetCPtr( pReplace );
ulReplace = hb_itemGetCLen( pReplace );
nReplace = hb_itemGetCLen( pReplace );
}
else
{
szReplace = ""; /* shouldn't matter that we don't allocate */
ulReplace = 0;
nReplace = 0;
}
if( HB_ISNUM( 5 ) )
{
ulCount = hb_parnl( 5 );
nCount = hb_parnl( 5 );
bAll = HB_FALSE;
}
else
{
ulCount = 0;
nCount = 0;
bAll = HB_TRUE;
}
if( bAll || ulCount > 0 )
if( bAll || nCount > 0 )
{
HB_SIZE ulFound = 0;
HB_SIZE nFound = 0;
HB_ISIZ lReplaced = 0;
HB_SIZE i = 0;
HB_SIZE ulLength = ulText;
HB_SIZE ulStop = ulText - ulSeek + 1;
HB_SIZE nLength = nText;
HB_SIZE nStop = nText - nSeek + 1;
while( i < ulStop )
while( i < nStop )
{
if( ( bAll || lReplaced < ( HB_ISIZ ) ulCount ) &&
! memcmp( szText + i, szSeek, ulSeek ) )
if( ( bAll || lReplaced < ( HB_ISIZ ) nCount ) &&
! memcmp( szText + i, szSeek, nSeek ) )
{
ulFound++;
if( ulFound >= ulStart )
nFound++;
if( nFound >= nStart )
{
lReplaced++;
ulLength = ulLength - ulSeek + ulReplace;
i += ulSeek;
nLength = nLength - nSeek + nReplace;
i += nSeek;
}
else
i++;
@@ -140,24 +140,24 @@ HB_FUNC( STRTRAN )
i++;
}
if( ulFound )
if( nFound )
{
char * szResult = ( char * ) hb_xgrab( ulLength + 1 );
char * szResult = ( char * ) hb_xgrab( nLength + 1 );
char * szPtr = szResult;
ulFound = 0;
nFound = 0;
i = 0;
while( i < ulText )
while( i < nText )
{
if( lReplaced && ! memcmp( szText + i, szSeek, ulSeek ) )
if( lReplaced && ! memcmp( szText + i, szSeek, nSeek ) )
{
ulFound++;
if( ulFound >= ulStart )
nFound++;
if( nFound >= nStart )
{
lReplaced--;
memcpy( szPtr, szReplace, ulReplace );
szPtr += ulReplace;
i += ulSeek;
memcpy( szPtr, szReplace, nReplace );
szPtr += nReplace;
i += nSeek;
}
else
{
@@ -173,7 +173,7 @@ HB_FUNC( STRTRAN )
i++;
}
}
hb_retclen_buffer( szResult, ulLength );
hb_retclen_buffer( szResult, nLength );
}
else
hb_itemReturn( pText );

View File

@@ -61,31 +61,31 @@ HB_FUNC( HB_STRXOR )
if( pItem )
{
PHB_ITEM pItem2;
HB_SIZE ulLen1, ulLen2, ul, ul2;
HB_SIZE nLen1, nLen2, n, n2;
const char * pStr1;
const char * pStr2;
char * pRet;
pStr1 = hb_itemGetCPtr( pItem );
ulLen1 = hb_itemGetCLen( pItem );
nLen1 = hb_itemGetCLen( pItem );
if( ( pItem2 = hb_param( 2, HB_IT_STRING ) ) != NULL )
{
ulLen2 = hb_itemGetCLen( pItem2 );
if( ulLen2 )
nLen2 = hb_itemGetCLen( pItem2 );
if( nLen2 )
{
pStr2 = hb_itemGetCPtr( pItem2 );
pRet = ( char * ) hb_xgrab( ulLen1 + 1 );
memcpy( pRet, pStr1, ulLen1 + 1 );
ul2 = 0;
for( ul = 0; ul < ulLen1; ul++ )
pRet = ( char * ) hb_xgrab( nLen1 + 1 );
memcpy( pRet, pStr1, nLen1 + 1 );
n2 = 0;
for( n = 0; n < nLen1; n++ )
{
pRet[ ul ] ^= pStr2[ ul2 ];
if( ++ul2 == ulLen2 )
ul2 = 0;
pRet[ n ] ^= pStr2[ n2 ];
if( ++n2 == nLen2 )
n2 = 0;
}
hb_retclen_buffer( pRet, ulLen1 );
hb_retclen_buffer( pRet, nLen1 );
}
else
hb_itemReturn( pItem );
@@ -98,12 +98,12 @@ HB_FUNC( HB_STRXOR )
if( bChar )
{
pRet = ( char * ) hb_xgrab( ulLen1 + 1 );
memcpy( pRet, pStr1, ulLen1 + 1 );
for( ul = 0; ul < ulLen1; ul++ )
pRet[ ul ] ^= bChar;
pRet = ( char * ) hb_xgrab( nLen1 + 1 );
memcpy( pRet, pStr1, nLen1 + 1 );
for( n = 0; n < nLen1; n++ )
pRet[ n ] ^= bChar;
hb_retclen_buffer( pRet, ulLen1 );
hb_retclen_buffer( pRet, nLen1 );
}
else
hb_itemReturn( pItem );

View File

@@ -83,20 +83,20 @@ HB_FUNC( STRZERO )
if( szResult )
{
HB_SIZE ulPos = 0;
HB_SIZE nPos = 0;
while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] != '-' )
ulPos++;
while( szResult[ nPos ] != '\0' && szResult[ nPos ] != '-' )
nPos++;
if( szResult[ ulPos ] == '-' )
if( szResult[ nPos ] == '-' )
{
/* NOTE: Negative sign found, put it to the first position */
szResult[ ulPos ] = ' ';
szResult[ nPos ] = ' ';
ulPos = 0;
while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] == ' ' )
szResult[ ulPos++ ] = '0';
nPos = 0;
while( szResult[ nPos ] != '\0' && szResult[ nPos ] == ' ' )
szResult[ nPos++ ] = '0';
szResult[ 0 ] = '-';
}
@@ -104,9 +104,9 @@ HB_FUNC( STRZERO )
{
/* Negative sign not found */
ulPos = 0;
while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] == ' ' )
szResult[ ulPos++ ] = '0';
nPos = 0;
while( szResult[ nPos ] != '\0' && szResult[ nPos ] == ' ' )
szResult[ nPos++ ] = '0';
}
hb_retc_buffer( szResult );

View File

@@ -66,7 +66,7 @@ static void hb_trace_message( char * buffer, HB_SIZE ulSize, int iParam, int iCo
while( iParam <= iCount && ulSize > 1 )
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fFree;
if( iParam > iFirst )
@@ -74,11 +74,11 @@ static void hb_trace_message( char * buffer, HB_SIZE ulSize, int iParam, int iCo
*buffer++ = ' ';
--ulSize;
}
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &nLen, &fFree );
hb_strncpy( buffer, pszString, ulSize );
ulLen = ( HB_SIZE ) strlen( buffer );
ulSize -= ulLen;
buffer += ulLen;
nLen = ( HB_SIZE ) strlen( buffer );
ulSize -= nLen;
buffer += nLen;
if( fFree )
hb_xfree( pszString );
iParam++;

View File

@@ -989,14 +989,14 @@ HB_FUNC( TRANSFORM )
}
else
{
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL bFreeReq;
szStr = hb_itemString( pValue, &ulLen, &bFreeReq );
szStr = hb_itemString( pValue, &nLen, &bFreeReq );
if( bFreeReq )
hb_retclen_buffer( szStr, ulLen );
hb_retclen_buffer( szStr, nLen );
else
hb_retclen( szStr, ulLen );
hb_retclen( szStr, nLen );
}
}
else if( HB_IS_DATE( pValue ) )

View File

@@ -56,36 +56,36 @@
/* trims from the left, and returns a new pointer to szText */
/* also returns the new length in lLen */
const char * hb_strLTrim( const char * szText, HB_SIZE * ulLen )
const char * hb_strLTrim( const char * szText, HB_SIZE * nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strLTrim(%s, %p)", szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strLTrim(%s, %p)", szText, nLen));
while( *ulLen && HB_ISSPACE( *szText ) )
while( *nLen && HB_ISSPACE( *szText ) )
{
szText++;
( *ulLen )--;
( *nLen )--;
}
return szText;
}
/* return length of szText ignoring trailing white space (or true spaces) */
HB_SIZE hb_strRTrimLen( const char * szText, HB_SIZE ulLen, HB_BOOL bAnySpace )
HB_SIZE hb_strRTrimLen( const char * szText, HB_SIZE nLen, HB_BOOL bAnySpace )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strRTrimLen(%s, %lu. %d)", szText, ulLen, (int) bAnySpace));
HB_TRACE(HB_TR_DEBUG, ("hb_strRTrimLen(%s, %lu. %d)", szText, nLen, (int) bAnySpace));
if( bAnySpace )
{
while( ulLen && HB_ISSPACE( szText[ ulLen - 1 ] ) )
ulLen--;
while( nLen && HB_ISSPACE( szText[ nLen - 1 ] ) )
nLen--;
}
else
{
while( ulLen && szText[ ulLen - 1 ] == ' ' )
ulLen--;
while( nLen && szText[ nLen - 1 ] == ' ' )
nLen--;
}
return ulLen;
return nLen;
}
/* trims leading spaces from a string */
@@ -96,16 +96,16 @@ HB_FUNC( LTRIM )
if( pText )
{
HB_SIZE ulLen, ulSrc;
HB_SIZE nLen, nSrc;
const char * szText;
ulLen = ulSrc = hb_itemGetCLen( pText );
szText = hb_strLTrim( hb_itemGetCPtr( pText ), &ulLen );
nLen = nSrc = hb_itemGetCLen( pText );
szText = hb_strLTrim( hb_itemGetCPtr( pText ), &nLen );
if( ulLen == ulSrc )
if( nLen == nSrc )
hb_itemReturn( pText );
else
hb_retclen( szText, ulLen );
hb_retclen( szText, nLen );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1101, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -121,16 +121,16 @@ HB_FUNC( RTRIM )
if( pText )
{
HB_SIZE ulLen, ulSrc;
HB_SIZE nLen, nSrc;
const char * szText = hb_itemGetCPtr( pText );
ulSrc = hb_itemGetCLen( pText );
ulLen = hb_strRTrimLen( szText, ulSrc, HB_FALSE );
nSrc = hb_itemGetCLen( pText );
nLen = hb_strRTrimLen( szText, nSrc, HB_FALSE );
if( ulLen == ulSrc )
if( nLen == nSrc )
hb_itemReturn( pText );
else
hb_retclen( szText, ulLen );
hb_retclen( szText, nLen );
}
else
/* NOTE: "TRIM" is right here [vszakats] */
@@ -153,17 +153,17 @@ HB_FUNC( ALLTRIM )
if( pText )
{
HB_SIZE ulLen, ulSrc;
HB_SIZE nLen, nSrc;
const char * szText = hb_itemGetCPtr( pText );
ulSrc = hb_itemGetCLen( pText );
ulLen = hb_strRTrimLen( szText, ulSrc, HB_FALSE );
szText = hb_strLTrim( szText, &ulLen );
nSrc = hb_itemGetCLen( pText );
nLen = hb_strRTrimLen( szText, nSrc, HB_FALSE );
szText = hb_strLTrim( szText, &nLen );
if( ulLen == ulSrc )
if( nLen == nSrc )
hb_itemReturn( pText );
else
hb_retclen( szText, ulLen );
hb_retclen( szText, nLen );
}
else
#ifdef HB_COMPAT_C53

View File

@@ -60,14 +60,14 @@ HB_FUNC( HB_VALTOSTR )
if( pItem )
{
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL bFreeReq;
char * buffer = hb_itemString( pItem, &ulLen, &bFreeReq );
char * buffer = hb_itemString( pItem, &nLen, &bFreeReq );
if( bFreeReq )
hb_retclen_buffer( buffer, ulLen );
hb_retclen_buffer( buffer, nLen );
else
hb_retclen( buffer, ulLen );
hb_retclen( buffer, nLen );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );