2010-07-06 23:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/common/hbffind.c
  * src/common/hbwin.c
  * src/common/hbstr.c
  * src/common/expropt1.c
  * src/common/expropt2.c
  * src/common/hbmem.c
  * src/common/strwild.c
  * src/common/hbhash.c
  * include/hbhash.h
  * src/rtl/substr.c
  * src/rtl/hbzlibgz.c
  * src/rtl/hbtoken.c
  * src/rtl/hbstrfmt.c
  * src/rtl/transfrm.c
  * src/rtl/hbadler.c
  * src/rtl/hbcomhb.c
  * src/rtl/hbmd5.c
  * src/rtl/hbascii.c
  * src/rtl/hbregexc.c
  * src/rtl/hbprocfn.c
  * src/rtl/hbsocket.c
  * src/rtl/hbinet.c
  * src/rtl/gtapi.c
  * src/rtl/filesys.c
  * src/rtl/hbregex.c
  * src/rtl/hbbffnc.c
  * src/rtl/hbgtcore.c
  * src/rtl/hbi18n1.c
  * src/rtl/gtclip.c
  * src/rtl/itemseri.c
  * src/rtl/hbsockhb.c
  * src/rtl/hardcr.c
  * src/rtl/hbzlib.c
  * src/rtl/hbhex.c
  * src/rtl/gete.c
  * src/rtl/hbproces.c
  * src/rtl/cdpapihb.c
  * src/rtl/ati.c
  * src/rtl/memofile.c
  * src/rtl/hbstrsh.c
    * Renamed HB_SIZE variables to have 'n' prefix.
      (verified to generate the same objects as before)
This commit is contained in:
Viktor Szakats
2010-07-06 21:32:46 +00:00
parent ae82f51433
commit a5231252b5
41 changed files with 1597 additions and 1554 deletions

View File

@@ -16,12 +16,56 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-07-06 23:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbffind.c
* src/common/hbwin.c
* src/common/hbstr.c
* src/common/expropt1.c
* src/common/expropt2.c
* src/common/hbmem.c
* src/common/strwild.c
* src/common/hbhash.c
* include/hbhash.h
* src/rtl/substr.c
* src/rtl/hbzlibgz.c
* src/rtl/hbtoken.c
* src/rtl/hbstrfmt.c
* src/rtl/transfrm.c
* src/rtl/hbadler.c
* src/rtl/hbcomhb.c
* src/rtl/hbmd5.c
* src/rtl/hbascii.c
* src/rtl/hbregexc.c
* src/rtl/hbprocfn.c
* src/rtl/hbsocket.c
* src/rtl/hbinet.c
* src/rtl/gtapi.c
* src/rtl/filesys.c
* src/rtl/hbregex.c
* src/rtl/hbbffnc.c
* src/rtl/hbgtcore.c
* src/rtl/hbi18n1.c
* src/rtl/gtclip.c
* src/rtl/itemseri.c
* src/rtl/hbsockhb.c
* src/rtl/hardcr.c
* src/rtl/hbzlib.c
* src/rtl/hbhex.c
* src/rtl/gete.c
* src/rtl/hbproces.c
* src/rtl/cdpapihb.c
* src/rtl/ati.c
* src/rtl/memofile.c
* src/rtl/hbstrsh.c
* Renamed HB_SIZE variables to have 'n' prefix.
(verified to generate the same objects as before)
2010-07-06 13:39 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
+ contrib/hbide/plugins/example_gui.hbs
+ Added: a gui dialog script which can be executed from
+ Added: a gui dialog script which can be executed from
"Run as Script" toolbar icon or as auto executable script.
The aim to put this script in SVN is to facilitate third party
libraries to provide their users with a GUI interactive interface
The aim to put this script in SVN is to facilitate third party
libraries to provide their users with a GUI interactive interface
to set library specific environment based on user options.
2010-07-06 22:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

View File

@@ -74,9 +74,9 @@ typedef struct HB_HASH_ITEM_
typedef struct HB_HASH_TABLE_
{
HB_HASH_ITEM_PTR * pItems; /* pointer to items */
HB_SIZE ulTableSize; /* the table size - number of slots */
HB_SIZE ulCount; /* number of items stored in the table */
HB_SIZE ulUsed; /* number of used slots */
HB_SIZE nTableSize; /* the table size - number of slots */
HB_SIZE nCount; /* number of items stored in the table */
HB_SIZE nUsed; /* number of used slots */
HB_HASH_FUNC_PTR pKeyFunc; /* pointer to func that returns key value */
HB_HASH_FUNC_PTR pDeleteItemFunc; /* ptr to func that deletes value stored in the table */
HB_HASH_FUNC_PTR pCompFunc; /* ptr to func that compares two items */

View File

@@ -361,7 +361,7 @@ HB_EXPR_PTR hb_compExprNewTimeStamp( long lDate, long lTime, HB_COMP_DECL )
return pExpr;
}
HB_EXPR_PTR hb_compExprNewString( const char *szValue, HB_SIZE ulLen, HB_BOOL fDealloc, HB_COMP_DECL )
HB_EXPR_PTR hb_compExprNewString( const char *szValue, HB_SIZE nLen, HB_BOOL fDealloc, HB_COMP_DECL )
{
HB_EXPR_PTR pExpr;
@@ -371,7 +371,7 @@ HB_EXPR_PTR hb_compExprNewString( const char *szValue, HB_SIZE ulLen, HB_BOOL fD
pExpr->value.asString.string = ( char * ) szValue;
pExpr->value.asString.dealloc = fDealloc;
pExpr->ulLength = ulLen;
pExpr->ulLength = nLen;
pExpr->ValType = HB_EV_STRING;
return pExpr;
@@ -456,11 +456,11 @@ HB_EXPR_PTR hb_compExprNewHash( HB_EXPR_PTR pHashList, HB_COMP_DECL )
return pHashList;
}
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, HB_SIZE ulLen, int iFlags, HB_COMP_DECL )
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, HB_SIZE nLen, int iFlags, HB_COMP_DECL )
{
HB_EXPR_PTR pExpr;
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%" HB_PFS "u,%d,%p)",string, ulLen, iFlags, HB_COMP_PARAM));
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%" HB_PFS "u,%d,%p)",string, nLen, iFlags, HB_COMP_PARAM));
pExpr = HB_COMP_EXPR_NEW( HB_ET_CODEBLOCK );
@@ -469,7 +469,7 @@ HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, HB_SIZE ulLen, int iFlags, HB
pExpr->ValType = HB_EV_CODEBLOCK;
pExpr->value.asCodeblock.flags = ( HB_USHORT ) iFlags;
pExpr->value.asCodeblock.string = string;
pExpr->ulLength = ulLen;
pExpr->ulLength = nLen;
return pExpr;
}
@@ -1266,16 +1266,16 @@ HB_EXPR_PTR hb_compExprMacroAsAlias( HB_EXPR_PTR pExpr )
*/
HB_ULONG hb_compExprListLen( HB_EXPR_PTR pExpr )
{
HB_ULONG ulLen = 0;
HB_ULONG nLen = 0;
pExpr = pExpr->value.asList.pExprList;
while( pExpr )
{
pExpr = pExpr->pNext;
++ulLen;
++nLen;
}
return ulLen;
return nLen;
}
HB_BOOL hb_compExprListTypeCheck( HB_EXPR_PTR pExpr, HB_EXPRTYPE ExprType )
@@ -1300,7 +1300,7 @@ HB_BOOL hb_compExprListTypeCheck( HB_EXPR_PTR pExpr, HB_EXPRTYPE ExprType )
*/
HB_ULONG hb_compExprParamListLen( HB_EXPR_PTR pExpr )
{
HB_ULONG ulLen = 0;
HB_ULONG nLen = 0;
if( pExpr )
{
@@ -1308,22 +1308,22 @@ HB_ULONG hb_compExprParamListLen( HB_EXPR_PTR pExpr )
while( pParam )
{
pParam = pParam->pNext;
++ulLen;
++nLen;
}
/* NOTE: if method or function with no parameters is called then the
* list of parameters contain only one expression of type HB_ET_NONE
* There is no need to calculate this parameter
*/
if( ulLen == 1 && pExpr->value.asList.pExprList->ExprType == HB_ET_NONE )
ulLen = 0;
if( nLen == 1 && pExpr->value.asList.pExprList->ExprType == HB_ET_NONE )
nLen = 0;
}
return ulLen;
return nLen;
}
HB_SIZE hb_compExprParamListCheck( HB_COMP_DECL, HB_EXPR_PTR pExpr )
{
HB_SIZE ulLen = 0, ulItems = 0;
HB_SIZE nLen = 0, nItems = 0;
if( pExpr )
{
HB_EXPR_PTR pElem;
@@ -1348,22 +1348,22 @@ HB_SIZE hb_compExprParamListCheck( HB_COMP_DECL, HB_EXPR_PTR pExpr )
- handle it differently then in a normal statement */
if( pElem->ExprType == HB_ET_MACRO )
pElem->value.asMacro.SubType |= HB_ET_MACRO_LIST;
if( ulItems )
if( nItems )
{
ulItems = 0;
++ulLen;
nItems = 0;
++nLen;
}
++ulLen;
++nLen;
}
else
++ulItems;
++nItems;
pElem = pElem->pNext;
}
if( ulLen )
if( nLen )
{
if( ulItems )
++ulLen;
if( nItems )
++nLen;
/* Note: direct type change */
pExpr->ExprType = HB_ET_MACROARGLIST;
}
@@ -1371,14 +1371,14 @@ HB_SIZE hb_compExprParamListCheck( HB_COMP_DECL, HB_EXPR_PTR pExpr )
* list of parameters contain only one expression of type HB_ET_NONE
* There is no need to calculate this parameter
*/
else if( ulItems == 1 &&
else if( nItems == 1 &&
pExpr->value.asList.pExprList->ExprType == HB_ET_NONE )
ulLen = 0;
nLen = 0;
else
ulLen = ulItems;
nLen = nItems;
}
return ulLen;
return nLen;
}
/* Create a new declaration for codeblock local variable

View File

@@ -60,13 +60,13 @@
#include "hbdate.h"
#include "hbmath.h"
static HB_BOOL hb_compExprHasMacro( const char * szText, HB_SIZE ulLen, HB_COMP_DECL )
static HB_BOOL hb_compExprHasMacro( const char * szText, HB_SIZE nLen, HB_COMP_DECL )
{
while( ulLen-- )
while( nLen-- )
{
if( *szText++ == '&' )
{
if( ! HB_SUPPORT_HARBOUR || ( ulLen && ( *szText == '_' ||
if( ! HB_SUPPORT_HARBOUR || ( nLen && ( *szText == '_' ||
( *szText >= 'A' && *szText <= 'Z' ) ||
( *szText >= 'a' && *szText <= 'z' ) ) ) )
{
@@ -81,7 +81,7 @@ static HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR
{
if( pLeft->value.asString.dealloc )
{
pLeft->value.asString.string = (char *) hb_xrealloc( pLeft->value.asString.string, pLeft->ulLength + pRight->ulLength + 1 );
pLeft->value.asString.string = ( char * ) hb_xrealloc( pLeft->value.asString.string, pLeft->ulLength + pRight->ulLength + 1 );
memcpy( pLeft->value.asString.string + pLeft->ulLength,
pRight->value.asString.string, pRight->ulLength );
pLeft->ulLength += pRight->ulLength;
@@ -89,8 +89,8 @@ static HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR
}
else
{
char *szString;
szString = (char *) hb_xgrab( pLeft->ulLength + pRight->ulLength + 1 );
char * szString;
szString = ( char * ) hb_xgrab( pLeft->ulLength + pRight->ulLength + 1 );
memcpy( szString, pLeft->value.asString.string, pLeft->ulLength );
memcpy( szString + pLeft->ulLength, pRight->value.asString.string, pRight->ulLength );
pLeft->ulLength += pRight->ulLength;
@@ -105,18 +105,18 @@ static HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR
static HB_EXPR_PTR hb_compExprReduceMinusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, HB_COMP_DECL )
{
char * szText = pLeft->value.asString.string;
HB_SIZE ulLen = pLeft->ulLength;
HB_SIZE nLen = pLeft->ulLength;
while( ulLen && szText[ ulLen - 1 ] == ' ' )
--ulLen;
while( nLen && szText[ nLen - 1 ] == ' ' )
--nLen;
if( pLeft->value.asString.dealloc )
{
pLeft->value.asString.string = (char *) hb_xrealloc( pLeft->value.asString.string, pLeft->ulLength + pRight->ulLength + 1 );
memcpy( pLeft->value.asString.string + ulLen,
memcpy( pLeft->value.asString.string + nLen,
pRight->value.asString.string, pRight->ulLength );
memset( pLeft->value.asString.string + ulLen + pRight->ulLength, ' ',
pLeft->ulLength - ulLen );
memset( pLeft->value.asString.string + nLen + pRight->ulLength, ' ',
pLeft->ulLength - nLen );
pLeft->ulLength += pRight->ulLength;
pLeft->value.asString.string[ pLeft->ulLength ] = '\0';
}
@@ -124,9 +124,9 @@ static HB_EXPR_PTR hb_compExprReduceMinusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR
{
char *szString;
szString = (char *) hb_xgrab( pLeft->ulLength + pRight->ulLength + 1 );
memcpy( szString, pLeft->value.asString.string, ulLen );
memcpy( szString + ulLen, pRight->value.asString.string, pRight->ulLength );
memset( szString + ulLen + pRight->ulLength, ' ', pLeft->ulLength - ulLen );
memcpy( szString, pLeft->value.asString.string, nLen );
memcpy( szString + nLen, pRight->value.asString.string, pRight->ulLength );
memset( szString + nLen + pRight->ulLength, ' ', pLeft->ulLength - nLen );
pLeft->ulLength += pRight->ulLength;
szString[ pLeft->ulLength ] = '\0';
pLeft->value.asString.string = szString;
@@ -598,14 +598,14 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
if( HB_SUPPORT_MACROTEXT )
{
char * szText = pLeft->value.asString.string;
HB_SIZE ulLen = pLeft->ulLength;
while( ulLen && szText[ ulLen - 1 ] == ' ' )
--ulLen;
while( ulLen-- )
HB_SIZE nLen = pLeft->ulLength;
while( nLen && szText[ nLen - 1 ] == ' ' )
--nLen;
while( nLen-- )
{
if( *szText++ == '&' )
{
char ch = ulLen ? *szText : *pRight->value.asString.string;
char ch = nLen ? *szText : *pRight->value.asString.string;
if( ( ch >= 'A' && ch <= 'Z' ) ||
( ch >= 'a' && ch <= 'z' ) || ch == '_' ||
! HB_SUPPORT_HARBOUR )
@@ -903,13 +903,13 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
if( HB_SUPPORT_MACROTEXT )
{
char * szText = pLeft->value.asString.string;
HB_SIZE ulLen = pLeft->ulLength;
HB_SIZE nLen = pLeft->ulLength;
while( ulLen-- )
while( nLen-- )
{
if( *szText++ == '&' )
{
char ch = ulLen ? *szText : *pRight->value.asString.string;
char ch = nLen ? *szText : *pRight->value.asString.string;
if( ( ch >= 'A' && ch <= 'Z' ) ||
( ch >= 'a' && ch <= 'z' ) || ch == '_' ||
! HB_SUPPORT_HARBOUR )
@@ -2264,10 +2264,10 @@ HB_BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL )
if( pArg->ExprType == HB_ET_STRING )
{
HB_SIZE ulLen = pArg->ulLength;
HB_SIZE nLen = pArg->ulLength;
HB_BOOL fLower = HB_FALSE;
if( ulLen )
if( nLen )
{
const char * szValue = pArg->value.asString.string;
do
@@ -2279,10 +2279,10 @@ HB_BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL )
( c >= '0' && c <= '9' ) || c == ' ' ) )
break;
}
while( --ulLen );
while( --nLen );
}
if( ulLen == 0 )
if( nLen == 0 )
{
HB_EXPR_PTR pExpr;
char * szValue;
@@ -2311,8 +2311,8 @@ HB_BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL )
fDealloc = HB_TRUE;
}
do
szValue[ ulLen ] = ( char ) HB_TOUPPER( ( unsigned char ) szValue[ ulLen ] );
while( ++ulLen < pArg->ulLength );
szValue[ nLen ] = ( char ) HB_TOUPPER( ( unsigned char ) szValue[ nLen ] );
while( ++nLen < pArg->ulLength );
}
}
else

View File

@@ -796,8 +796,8 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind )
/* Convert from OS codepage */
{
char * pszFree = NULL;
HB_SIZE ulSize = sizeof( ffind->szName );
const char * pszResult = hb_osDecodeCP( ffind->szName, &pszFree, &ulSize );
HB_SIZE nSize = sizeof( ffind->szName );
const char * pszResult = hb_osDecodeCP( ffind->szName, &pszFree, &nSize );
if( pszFree )
{

View File

@@ -52,11 +52,11 @@
#include "hbhash.h"
static HB_HASH_ITEM_PTR hb_hashItemNew( HB_SIZE ulKey, const void * pKey, const void * pValue )
static HB_HASH_ITEM_PTR hb_hashItemNew( HB_SIZE nKey, const void * pKey, const void * pValue )
{
HB_HASH_ITEM_PTR pItem = (HB_HASH_ITEM_PTR) hb_xgrab( sizeof( HB_HASH_ITEM ) );
pItem->key = ulKey;
pItem->key = nKey;
pItem->KeyPtr = pKey;
pItem->ValPtr = pValue;
pItem->next = NULL;
@@ -72,7 +72,7 @@ static void hb_hashItemDelete( HB_HASH_TABLE_PTR pTable, HB_HASH_ITEM_PTR pItem
}
/* create a new hash table
* ulSize = initial numer of items in the table
* nSize = initial numer of items in the table
* pHashTable = a function that calculates a hash key value
* (first parameter is a value to add)
* pDelete = a function that clears item's value before item's releasing
@@ -81,21 +81,21 @@ static void hb_hashItemDelete( HB_HASH_TABLE_PTR pTable, HB_HASH_ITEM_PTR pItem
* (first and second are values to compare, function have to return
* zero if values match or nonzero if they don't match)
*/
HB_HASH_TABLE_PTR hb_hashTableCreate( HB_SIZE ulSize,
HB_HASH_TABLE_PTR hb_hashTableCreate( HB_SIZE nSize,
HB_HASH_FUNC_PTR pHashFunc,
HB_HASH_FUNC_PTR pDelete,
HB_HASH_FUNC_PTR pComp )
{
HB_HASH_TABLE_PTR pTable = ( HB_HASH_TABLE_PTR ) hb_xgrab( sizeof( HB_HASH_TABLE ) );
pTable->ulTableSize = ulSize;
pTable->nTableSize = nSize;
pTable->pKeyFunc = pHashFunc;
pTable->pDeleteItemFunc = pDelete;
pTable->pCompFunc = pComp;
pTable->ulCount = pTable->ulUsed = 0;
pTable->nCount = pTable->nUsed = 0;
pTable->pItems = ( HB_HASH_ITEM_PTR * ) hb_xgrab( sizeof( HB_HASH_ITEM_PTR ) * ulSize );
memset( pTable->pItems, 0, sizeof( HB_HASH_ITEM_PTR ) * ulSize );
pTable->pItems = ( HB_HASH_ITEM_PTR * ) hb_xgrab( sizeof( HB_HASH_ITEM_PTR ) * nSize );
memset( pTable->pItems, 0, sizeof( HB_HASH_ITEM_PTR ) * nSize );
return pTable;
}
@@ -104,14 +104,14 @@ HB_HASH_TABLE_PTR hb_hashTableCreate( HB_SIZE ulSize,
*/
void hb_hashTableKill( HB_HASH_TABLE_PTR pTable )
{
HB_SIZE ulSize = 0;
HB_SIZE nSize = 0;
while( ulSize < pTable->ulTableSize )
while( nSize < pTable->nTableSize )
{
if( pTable->pItems[ ulSize ] )
if( pTable->pItems[ nSize ] )
{
HB_HASH_ITEM_PTR pItem, pFree;
pItem = pTable->pItems[ ulSize ];
pItem = pTable->pItems[ nSize ];
while( pItem )
{
pFree = pItem;
@@ -119,40 +119,40 @@ void hb_hashTableKill( HB_HASH_TABLE_PTR pTable )
hb_hashItemDelete( pTable, pFree );
}
}
++ulSize;
++nSize;
}
hb_xfree( pTable->pItems );
hb_xfree( pTable );
}
/* resize table */
HB_HASH_TABLE_PTR hb_hashTableResize( HB_HASH_TABLE_PTR pTable, HB_SIZE ulNewSize )
HB_HASH_TABLE_PTR hb_hashTableResize( HB_HASH_TABLE_PTR pTable, HB_SIZE nNewSize )
{
HB_HASH_TABLE_PTR pNew;
HB_SIZE ulSize = 0;
HB_SIZE nSize = 0;
if( ulNewSize == 0 )
ulNewSize = 2 * pTable->ulTableSize + 1;
pNew = hb_hashTableCreate( ulNewSize,
if( nNewSize == 0 )
nNewSize = 2 * pTable->nTableSize + 1;
pNew = hb_hashTableCreate( nNewSize,
pTable->pKeyFunc,
pTable->pDeleteItemFunc,
pTable->pCompFunc );
while( ulSize < pTable->ulTableSize )
while( nSize < pTable->nTableSize )
{
if( pTable->pItems[ ulSize ] )
if( pTable->pItems[ nSize ] )
{
HB_HASH_ITEM_PTR pItem;
pItem = pTable->pItems[ ulSize ];
pItem = pTable->pItems[ nSize ];
while( pItem )
{
HB_SIZE ulKey;
HB_SIZE nKey;
HB_HASH_ITEM_PTR pNewItem, pNext;
pNext = pItem->next;
ulKey = ( pTable->pKeyFunc )( pNew, pItem->KeyPtr, pItem->ValPtr );
pNewItem = pNew->pItems[ ulKey ];
nKey = ( pTable->pKeyFunc )( pNew, pItem->KeyPtr, pItem->ValPtr );
pNewItem = pNew->pItems[ nKey ];
if( pNewItem )
{
while( pNewItem->next )
@@ -161,16 +161,16 @@ HB_HASH_TABLE_PTR hb_hashTableResize( HB_HASH_TABLE_PTR pTable, HB_SIZE ulNewSiz
}
else
{
pNew->pItems[ ulKey ] = pItem;
++pNew->ulUsed;
pNew->pItems[ nKey ] = pItem;
++pNew->nUsed;
}
pItem->key = ulKey;
pItem->key = nKey;
pItem->next = NULL;
++pNew->ulCount;
++pNew->nCount;
pItem = pNext;
}
}
++ulSize;
++nSize;
}
hb_xfree( pTable->pItems );
hb_xfree( pTable );
@@ -181,23 +181,23 @@ HB_HASH_TABLE_PTR hb_hashTableResize( HB_HASH_TABLE_PTR pTable, HB_SIZE ulNewSiz
/* add a new value into th ehash table */
HB_BOOL hb_hashTableAdd( HB_HASH_TABLE_PTR pTable, const void * pKey, const void * pValue )
{
HB_SIZE ulKey;
HB_SIZE nKey;
HB_HASH_ITEM_PTR pItem;
ulKey = ( pTable->pKeyFunc )( pTable, pKey, pValue );
pItem = pTable->pItems[ ulKey ];
nKey = ( pTable->pKeyFunc )( pTable, pKey, pValue );
pItem = pTable->pItems[ nKey ];
if( pItem )
{
while( pItem->next )
pItem = pItem->next;
pItem->next = hb_hashItemNew( ulKey, pKey, pValue );
pItem->next = hb_hashItemNew( nKey, pKey, pValue );
}
else
{
pTable->pItems[ ulKey ] = hb_hashItemNew( ulKey, pKey, pValue );
++pTable->ulUsed;
pTable->pItems[ nKey ] = hb_hashItemNew( nKey, pKey, pValue );
++pTable->nUsed;
}
++pTable->ulCount;
++pTable->nCount;
return HB_TRUE;
}
@@ -206,12 +206,12 @@ HB_BOOL hb_hashTableAdd( HB_HASH_TABLE_PTR pTable, const void * pKey, const void
*/
const void * hb_hashTableFind( HB_HASH_TABLE_PTR pTable, const void * pKey )
{
HB_SIZE ulKey;
HB_SIZE nKey;
HB_HASH_ITEM_PTR pItem;
const void * pFound = NULL;
ulKey = ( pTable->pKeyFunc )( pTable, pKey, NULL );
pItem = pTable->pItems[ ulKey ];
nKey = ( pTable->pKeyFunc )( pTable, pKey, NULL );
pItem = pTable->pItems[ nKey ];
if( pItem )
{
while( pItem && ( ( pTable->pCompFunc )( pTable, pItem->KeyPtr, pKey ) != 0 ) )
@@ -230,16 +230,16 @@ const void * hb_hashTableFind( HB_HASH_TABLE_PTR pTable, const void * pKey )
*/
HB_BOOL hb_hashTableDel( HB_HASH_TABLE_PTR pTable, const void *pKey )
{
HB_SIZE ulKey;
HB_SIZE nKey;
HB_HASH_ITEM_PTR pItem;
HB_HASH_ITEM_PTR pPrev = NULL;
HB_BOOL bFound = HB_FALSE;
ulKey = ( pTable->pKeyFunc )( pTable, pKey, NULL );
if( ulKey > pTable->ulTableSize )
nKey = ( pTable->pKeyFunc )( pTable, pKey, NULL );
if( nKey > pTable->nTableSize )
return HB_FALSE;
pItem = pTable->pItems[ ulKey ];
pItem = pTable->pItems[ nKey ];
while( pItem && ! bFound )
{
if( ( pTable->pCompFunc )( pTable, pItem->KeyPtr, pKey ) == 0 )
@@ -250,14 +250,14 @@ HB_BOOL hb_hashTableDel( HB_HASH_TABLE_PTR pTable, const void *pKey )
}
else
{
pTable->pItems[ ulKey ] = pItem->next;
pTable->pItems[ nKey ] = pItem->next;
if( !pItem->next )
{
--pTable->ulUsed;
pTable->pItems[ ulKey ] = NULL;
--pTable->nUsed;
pTable->pItems[ nKey ] = NULL;
}
}
--pTable->ulCount;
--pTable->nCount;
hb_hashItemDelete( pTable, pItem );
bFound = HB_TRUE;
}
@@ -274,5 +274,5 @@ HB_BOOL hb_hashTableDel( HB_HASH_TABLE_PTR pTable, const void *pKey )
/* return the hash table size */
HB_SIZE hb_hashTableSize( HB_HASH_TABLE_PTR pTable )
{
return pTable->ulTableSize;
return pTable->nTableSize;
}

View File

@@ -64,31 +64,31 @@
#if UINT_MAX != ULONG_MAX
*/
#ifndef hb_xmemcpy
void * hb_xmemcpy( void * pDestArg, void * pSourceArg, HB_SIZE ulLen )
void * hb_xmemcpy( void * pDestArg, void * pSourceArg, HB_SIZE nLen )
{
HB_BYTE * pDest;
HB_BYTE * pSource;
HB_SIZE ulRemaining;
HB_SIZE nRemaining;
int iCopySize;
HB_TRACE(HB_TR_DEBUG, ("hb_xmemcpy(%p, %p, %" HB_PFS "u)", pDestArg, pSourceArg, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_xmemcpy(%p, %p, %" HB_PFS "u)", pDestArg, pSourceArg, nLen));
pDest = ( HB_BYTE * ) pDestArg;
pSource = ( HB_BYTE * ) pSourceArg;
ulRemaining = ulLen;
nRemaining = nLen;
while( ulRemaining )
while( nRemaining )
{
/* Overcome the memcpy() size_t limitation */
if( ulRemaining > UINT_MAX )
if( nRemaining > UINT_MAX )
{
iCopySize = UINT_MAX;
ulRemaining -= ( HB_SIZE ) iCopySize;
nRemaining -= ( HB_SIZE ) iCopySize;
}
else
{
iCopySize = ( int ) ulRemaining;
ulRemaining = 0;
iCopySize = ( int ) nRemaining;
nRemaining = 0;
}
memcpy( pDest, pSource, iCopySize );
pDest += iCopySize;
@@ -100,29 +100,29 @@ void * hb_xmemcpy( void * pDestArg, void * pSourceArg, HB_SIZE ulLen )
#endif
#ifndef hb_xmemset
void * hb_xmemset( void * pDestArg, int iFill, HB_SIZE ulLen )
void * hb_xmemset( void * pDestArg, int iFill, HB_SIZE nLen )
{
HB_BYTE * pDest;
HB_SIZE ulRemaining;
HB_SIZE nRemaining;
int iSetSize;
HB_TRACE(HB_TR_DEBUG, ("hb_xmemset(%p, %d, %" HB_PFS "u)", pDestArg, iFill, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_xmemset(%p, %d, %" HB_PFS "u)", pDestArg, iFill, nLen));
pDest = ( HB_BYTE * ) pDestArg;
ulRemaining = ulLen;
nRemaining = nLen;
while( ulRemaining )
while( nRemaining )
{
/* Overcome the memset() size_t limitation */
if( ulRemaining > UINT_MAX )
if( nRemaining > UINT_MAX )
{
iSetSize = UINT_MAX;
ulRemaining -= ( HB_SIZE ) iSetSize;
nRemaining -= ( HB_SIZE ) iSetSize;
}
else
{
iSetSize = ( int ) ulRemaining;
ulRemaining = 0;
iSetSize = ( int ) nRemaining;
nRemaining = 0;
}
memset( pDest, iFill, iSetSize );
pDest += iSetSize;

View File

@@ -81,46 +81,46 @@ const char * hb_szAscii[ 256 ] = { "\x00", "\x01", "\x02", "\x03", "\x04", "\x05
"\xE0", "\xE1", "\xE2", "\xE3", "\xE4", "\xE5", "\xE6", "\xE7", "\xE8", "\xE9", "\xEA", "\xEB", "\xEC", "\xED", "\xEE", "\xEF",
"\xF0", "\xF1", "\xF2", "\xF3", "\xF4", "\xF5", "\xF6", "\xF7", "\xF8", "\xF9", "\xFA", "\xFB", "\xFC", "\xFD", "\xFE", "\xFF" };
HB_SIZE hb_strAt( const char * szSub, HB_SIZE ulSubLen, const char * szText, HB_SIZE ulLen )
HB_SIZE hb_strAt( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strAt(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, ulSubLen, szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strAt(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen));
if( ulSubLen > 0 && ulLen >= ulSubLen )
if( nSubLen > 0 && nLen >= nSubLen )
{
HB_SIZE ulPos = 0;
HB_SIZE ulSubPos = 0;
HB_SIZE nPos = 0;
HB_SIZE nSubPos = 0;
while( ulPos < ulLen && ulSubPos < ulSubLen )
while( nPos < nLen && nSubPos < nSubLen )
{
if( szText[ ulPos ] == szSub[ ulSubPos ] )
if( szText[ nPos ] == szSub[ nSubPos ] )
{
ulSubPos++;
ulPos++;
nSubPos++;
nPos++;
}
else if( ulSubPos )
else if( nSubPos )
{
/* Go back to the first character after the first match,
or else tests like "22345" $ "012223456789" will fail. */
ulPos -= ( ulSubPos - 1 );
ulSubPos = 0;
nPos -= ( nSubPos - 1 );
nSubPos = 0;
}
else
ulPos++;
nPos++;
}
return ( ulSubPos < ulSubLen ) ? 0 : ( ulPos - ulSubLen + 1 );
return ( nSubPos < nSubLen ) ? 0 : ( nPos - nSubLen + 1 );
}
else
return 0;
}
HB_BOOL hb_strEmpty( const char * szText, HB_SIZE ulLen )
HB_BOOL hb_strEmpty( const char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strEmpty(%s, %" HB_PFS "u)", szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strEmpty(%s, %" HB_PFS "u)", szText, nLen));
while( ulLen-- )
while( nLen-- )
{
char c = szText[ ulLen ];
char c = szText[ nLen ];
if( !HB_ISSPACE( c ) )
return HB_FALSE;
@@ -156,28 +156,28 @@ char * hb_strlow( char * pszText )
char * hb_strdup( const char * pszText )
{
char * pszDup;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_TRACE(HB_TR_DEBUG, ("hb_strdup(%s)", pszText));
ulLen = strlen( pszText ) + 1;
nLen = strlen( pszText ) + 1;
pszDup = ( char * ) hb_xgrab( ulLen );
memcpy( pszDup, pszText, ulLen );
pszDup = ( char * ) hb_xgrab( nLen );
memcpy( pszDup, pszText, nLen );
return pszDup;
}
char * hb_strndup( const char * pszText, HB_SIZE ulLen )
char * hb_strndup( const char * pszText, HB_SIZE nLen )
{
char * pszDup;
HB_SIZE ul;
HB_TRACE(HB_TR_DEBUG, ("hb_strndup(%.*s, %" HB_PFS "d)", ( int ) ulLen, pszText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strndup(%.*s, %" HB_PFS "d)", ( int ) nLen, pszText, nLen));
ul = 0;
pszDup = ( char * ) pszText;
while( ulLen-- && *pszDup++ )
while( nLen-- && *pszDup++ )
++ul;
pszDup = ( char * ) hb_xgrab( ul + 1 );
@@ -187,13 +187,13 @@ char * hb_strndup( const char * pszText, HB_SIZE ulLen )
return pszDup;
}
HB_SIZE hb_strnlen( const char * pszText, HB_SIZE ulLen )
HB_SIZE hb_strnlen( const char * pszText, HB_SIZE nLen )
{
HB_SIZE ul = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_strnlen(%.*s, %" HB_PFS "d)", ( int ) ulLen, pszText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strnlen(%.*s, %" HB_PFS "d)", ( int ) nLen, pszText, nLen));
while( ulLen-- && *pszText++ )
while( nLen-- && *pszText++ )
++ul;
return ul;
@@ -202,20 +202,20 @@ HB_SIZE hb_strnlen( const char * pszText, HB_SIZE ulLen )
char * hb_strduptrim( const char * pszText )
{
char * pszDup;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_TRACE(HB_TR_DEBUG, ("hb_strduptrim(%s)", pszText));
while( pszText[ 0 ] == ' ' )
++pszText;
ulLen = strlen( pszText );
while( ulLen && pszText[ ulLen - 1 ] == ' ' )
--ulLen;
nLen = strlen( pszText );
while( nLen && pszText[ nLen - 1 ] == ' ' )
--nLen;
pszDup = ( char * ) hb_xgrab( ulLen + 1 );
memcpy( pszDup, pszText, ulLen );
pszDup[ ulLen ] = '\0';
pszDup = ( char * ) hb_xgrab( nLen + 1 );
memcpy( pszDup, pszText, nLen );
pszDup[ nLen ] = '\0';
return pszDup;
}
@@ -266,15 +266,15 @@ int hb_stricmp( const char * s1, const char * s2 )
/* warning: It is not case sensitive */
int hb_strnicmp( const char * s1, const char * s2, HB_SIZE count )
{
HB_SIZE ulCount;
HB_SIZE nCount;
int rc = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_strnicmp(%.*s, %s, %" HB_PFS "u)", ( int ) count, s1, s2, count));
for( ulCount = 0; ulCount < count; ulCount++ )
for( nCount = 0; nCount < count; nCount++ )
{
unsigned char c1 = ( char ) HB_TOUPPER( ( unsigned char ) s1[ ulCount ] );
unsigned char c2 = ( char ) HB_TOUPPER( ( unsigned char ) s2[ ulCount ] );
unsigned char c1 = ( char ) HB_TOUPPER( ( unsigned char ) s1[ nCount ] );
unsigned char c2 = ( char ) HB_TOUPPER( ( unsigned char ) s2[ nCount ] );
if( c1 != c2 )
{
@@ -336,15 +336,15 @@ char * hb_xstrcpy( char * szDest, const char * szSrc, ... )
if( szDest == NULL )
{
const char * szSrcPtr = szSrc;
HB_SIZE ulSize = 1;
HB_SIZE nSize = 1;
va_start( va, szSrc );
while( szSrcPtr )
{
ulSize += strlen( szSrcPtr );
nSize += strlen( szSrcPtr );
szSrcPtr = va_arg( va, char * );
}
va_end( va );
szDest = ( char * ) hb_xgrab( ulSize );
szDest = ( char * ) hb_xgrab( nSize );
}
szResult = szDest;
@@ -537,15 +537,15 @@ double hb_numDecConv( double dNum, int iDec )
return hb_numRound( dNum, 0 );
}
static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE ulLen, HB_MAXINT * lVal, double * dVal, int * piDec, int * piWidth )
static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE nLen, HB_MAXINT * lVal, double * dVal, int * piDec, int * piWidth )
{
HB_BOOL fDbl = HB_FALSE, fDec = HB_FALSE, fNeg, fHex = HB_FALSE;
int iLen, iPos = 0;
int c, iWidth, iDec = 0, iDecR = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %" HB_PFS "u, %p, %p, %p, %p)", ( int ) fPCode, szNum, ulLen, lVal, dVal, piDec, piWidth ));
HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %" HB_PFS "u, %p, %p, %p, %p)", ( int ) fPCode, szNum, nLen, lVal, dVal, piDec, piWidth ));
iLen = ( int ) ulLen;
iLen = ( int ) nLen;
while( iPos < iLen && HB_ISSPACE( szNum[ iPos ] ) )
iPos++;
@@ -704,16 +704,16 @@ static HB_BOOL hb_str2number( HB_BOOL fPCode, const char * szNum, HB_SIZE ulLen,
return fDbl;
}
HB_BOOL hb_compStrToNum( const char* szNum, HB_SIZE ulLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth )
HB_BOOL hb_compStrToNum( const char* szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth )
{
HB_TRACE(HB_TR_DEBUG, ("hb_compStrToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, ulLen, plVal, pdVal, piDec, piWidth ));
return hb_str2number( HB_TRUE, szNum, ulLen, plVal, pdVal, piDec, piWidth );
HB_TRACE(HB_TR_DEBUG, ("hb_compStrToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, plVal, pdVal, piDec, piWidth ));
return hb_str2number( HB_TRUE, szNum, nLen, plVal, pdVal, piDec, piWidth );
}
HB_BOOL hb_valStrnToNum( const char* szNum, HB_SIZE ulLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth )
HB_BOOL hb_valStrnToNum( const char* szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal, int * piDec, int * piWidth )
{
HB_TRACE(HB_TR_DEBUG, ("hb_valStrnToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, ulLen, plVal, pdVal, piDec, piWidth ));
return hb_str2number( HB_FALSE, szNum, ulLen, plVal, pdVal, piDec, piWidth );
HB_TRACE(HB_TR_DEBUG, ("hb_valStrnToNum( %s, %" HB_PFS "u, %p, %p, %p, %p)", szNum, nLen, plVal, pdVal, piDec, piWidth ));
return hb_str2number( HB_FALSE, szNum, nLen, plVal, pdVal, piDec, piWidth );
}
HB_BOOL hb_strToNum( const char* szNum, HB_MAXINT * plVal, double * pdVal )
@@ -722,21 +722,21 @@ HB_BOOL hb_strToNum( const char* szNum, HB_MAXINT * plVal, double * pdVal )
return hb_str2number( HB_FALSE, szNum, strlen( szNum ), plVal, pdVal, NULL, NULL );
}
HB_BOOL hb_strnToNum( const char* szNum, HB_SIZE ulLen, HB_MAXINT * plVal, double * pdVal )
HB_BOOL hb_strnToNum( const char* szNum, HB_SIZE nLen, HB_MAXINT * plVal, double * pdVal )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strnToNum(%.*s, %" HB_PFS "u, %p, %p)", ( int ) ulLen, szNum, ulLen, plVal, pdVal ));
return hb_str2number( HB_FALSE, szNum, ulLen, plVal, pdVal, NULL, NULL );
HB_TRACE(HB_TR_DEBUG, ("hb_strnToNum(%.*s, %" HB_PFS "u, %p, %p)", ( int ) nLen, szNum, nLen, plVal, pdVal ));
return hb_str2number( HB_FALSE, szNum, nLen, plVal, pdVal, NULL, NULL );
}
/* returns the numeric value of a character string representation of a number */
double hb_strVal( const char * szText, HB_SIZE ulLen )
double hb_strVal( const char * szText, HB_SIZE nLen )
{
HB_MAXINT lVal;
double dVal;
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%.*s, %" HB_PFS "u)", ( int ) ulLen, szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strVal(%.*s, %" HB_PFS "u)", ( int ) nLen, szText, nLen));
if( ! hb_str2number( HB_FALSE, szText, ulLen, &lVal, &dVal, NULL, NULL ) )
if( ! hb_str2number( HB_FALSE, szText, nLen, &lVal, &dVal, NULL, NULL ) )
dVal = ( double ) lVal;
return dVal;
}
@@ -757,12 +757,12 @@ HB_MAXINT hb_strValInt( const char * szText, int * iOverflow )
return lVal;
}
char * hb_numToStr( char * szBuf, HB_SIZE ulSize, HB_MAXINT lNumber )
char * hb_numToStr( char * szBuf, HB_SIZE nSize, HB_MAXINT lNumber )
{
int iPos = ( int ) ulSize;
int iPos = ( int ) nSize;
HB_BOOL fNeg = HB_FALSE;
HB_TRACE(HB_TR_DEBUG, ("hb_numToStr(%p, %" HB_PFS "u, %" PFHL "i)", szBuf, ulSize, lNumber));
HB_TRACE(HB_TR_DEBUG, ("hb_numToStr(%p, %" HB_PFS "u, %" PFHL "i)", szBuf, nSize, lNumber));
szBuf[ --iPos ] = '\0';
if( lNumber < 0 )
@@ -785,7 +785,7 @@ char * hb_numToStr( char * szBuf, HB_SIZE ulSize, HB_MAXINT lNumber )
memset( szBuf, ' ', iPos );
else if( iPos < 0 )
{
memset( szBuf, '*', ulSize - 1 );
memset( szBuf, '*', nSize - 1 );
iPos = 0;
}
@@ -797,16 +797,16 @@ char * hb_numToStr( char * szBuf, HB_SIZE ulSize, HB_MAXINT lNumber )
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpy(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncpy(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
pDest[ ulLen ] = '\0';
pDest[ nLen ] = '\0';
while( ulLen && ( *pDest++ = *pSource++ ) != '\0' )
ulLen--;
while( nLen && ( *pDest++ = *pSource++ ) != '\0' )
nLen--;
return pBuf;
}
@@ -814,24 +814,24 @@ char * hb_strncpy( char * pDest, const char * pSource, HB_SIZE ulLen )
/*
* This function copies szText to destination buffer.
* NOTE: Unlike the documentation for strncat, this routine will always append
* a null and the ulLen param is pDest size not pSource limit
* a null and the nLen param is pDest size not pSource limit
*/
char * hb_strncat( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncat( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncat(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncat(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
pDest[ ulLen ] = '\0';
pDest[ nLen ] = '\0';
while( ulLen && *pDest )
while( nLen && *pDest )
{
pDest++;
ulLen--;
nLen--;
}
while( ulLen && ( *pDest++ = *pSource++ ) != '\0' )
ulLen--;
while( nLen && ( *pDest++ = *pSource++ ) != '\0' )
nLen--;
return pBuf;
}
@@ -843,17 +843,17 @@ char * hb_strncat( char * pDest, const char * pSource, HB_SIZE ulLen )
* a null
* pt
*/
char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyLower(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyLower(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
pDest[ ulLen ] = '\0';
pDest[ nLen ] = '\0';
while( ulLen && ( *pDest++ = ( char ) HB_TOLOWER( ( HB_UCHAR ) *pSource ) ) != '\0' )
while( nLen && ( *pDest++ = ( char ) HB_TOLOWER( ( HB_UCHAR ) *pSource ) ) != '\0' )
{
ulLen--;
nLen--;
pSource++;
}
@@ -867,17 +867,17 @@ char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE ulLen )
* a null
* pt
*/
char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpper(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpper(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
pDest[ ulLen ] = '\0';
pDest[ nLen ] = '\0';
while( ulLen && ( *pDest++ = ( char ) HB_TOUPPER( ( HB_UCHAR ) *pSource ) ) != '\0' )
while( nLen && ( *pDest++ = ( char ) HB_TOUPPER( ( HB_UCHAR ) *pSource ) ) != '\0' )
{
ulLen--;
nLen--;
pSource++;
}
@@ -891,25 +891,25 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE ulLen )
* a null
* pt
*/
char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_SIZE ulSLen;
HB_SIZE nSLen;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpperTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpperTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
ulSLen = 0;
while( ulSLen < ulLen && pSource[ ulSLen ] )
ulSLen++;
nSLen = 0;
while( nSLen < nLen && pSource[ nSLen ] )
nSLen++;
while( ulSLen && pSource[ ulSLen - 1 ] == ' ')
ulSLen--;
while( nSLen && pSource[ nSLen - 1 ] == ' ')
nSLen--;
while( ulLen && ulSLen &&
while( nLen && nSLen &&
( *pDest++ = ( char ) HB_TOUPPER( ( HB_UCHAR ) *pSource ) ) != '\0' )
{
ulSLen--;
ulLen--;
nSLen--;
nLen--;
pSource++;
}
@@ -923,24 +923,24 @@ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE ulLen )
* NOTE: Unlike the documentation for strncpy, this routine will always append
* a null
*/
char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE ulLen )
char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE nLen )
{
char * pBuf = pDest;
HB_SIZE ulSLen;
HB_SIZE nSLen;
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) ulLen, pSource, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strncpyTrim(%p, %.*s, %" HB_PFS "u)", pDest, ( int ) nLen, pSource, nLen));
ulSLen = 0;
while( ulSLen < ulLen && pSource[ ulSLen ] )
ulSLen++;
nSLen = 0;
while( nSLen < nLen && pSource[ nSLen ] )
nSLen++;
while( ulSLen && pSource[ ulSLen - 1 ] == ' ' )
ulSLen--;
while( nSLen && pSource[ nSLen - 1 ] == ' ' )
nSLen--;
while( ulLen && ulSLen && ( *pDest++ = *pSource++ ) != '\0' )
while( nLen && nSLen && ( *pDest++ = *pSource++ ) != '\0' )
{
ulSLen--;
ulLen--;
nSLen--;
nLen--;
}
*pDest = '\0';
@@ -948,9 +948,9 @@ char * hb_strncpyTrim( char * pDest, const char * pSource, HB_SIZE ulLen )
return pBuf;
}
char * hb_strRemEscSeq( char * str, HB_SIZE * pLen )
char * hb_strRemEscSeq( char * str, HB_SIZE * pnLen )
{
HB_SIZE ul = * pLen, ulStripped = 0;
HB_SIZE ul = * pnLen, nStripped = 0;
char * ptr, * dst, ch;
ptr = dst = str;
@@ -967,7 +967,7 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pLen )
ch = *ptr++;
if( ch == '\\' )
{
++ulStripped;
++nStripped;
if( ul )
{
ul--;
@@ -998,11 +998,11 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pLen )
if( ul && *ptr >= '0' && *ptr <= '7' )
{
ch = ( ch << 3 ) | ( *ptr++ - '0' );
++ulStripped;
++nStripped;
if( --ul && *ptr >= '0' && *ptr <= '7' )
{
ch = ( ch << 3 ) | ( *ptr++ - '0' );
++ulStripped;
++nStripped;
--ul;
}
}
@@ -1019,7 +1019,7 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pLen )
ch = ( ch << 4 ) | ( *ptr++ - 'a' + 10 );
else
break;
++ulStripped;
++nStripped;
--ul;
}
break;
@@ -1034,40 +1034,40 @@ char * hb_strRemEscSeq( char * str, HB_SIZE * pLen )
*dst++ = ch;
}
if( ulStripped )
if( nStripped )
{
*dst = '\0';
*pLen -= ulStripped;
*pnLen -= nStripped;
}
return str;
}
char * hb_compEncodeString( int iMethod, const char * szText, HB_SIZE * pulLen )
char * hb_compEncodeString( int iMethod, const char * szText, HB_SIZE * pnLen )
{
char * pBuffer = ( char * ) hb_xgrab( *pulLen + 1 );
char * pBuffer = ( char * ) hb_xgrab( *pnLen + 1 );
memcpy( pBuffer, szText, *pulLen );
pBuffer[ *pulLen ] = '\0';
memcpy( pBuffer, szText, *pnLen );
pBuffer[ *pnLen ] = '\0';
if( iMethod == 1 )
{
HB_SIZE ul;
for( ul = 0; ul < *pulLen; ul++ )
for( ul = 0; ul < *pnLen; ul++ )
pBuffer[ ul ] ^= 0xF3;
}
return pBuffer;
}
char * hb_compDecodeString( int iMethod, const char * szText, HB_SIZE * pulLen )
char * hb_compDecodeString( int iMethod, const char * szText, HB_SIZE * pnLen )
{
char * pBuffer = ( char * ) hb_xgrab( *pulLen + 1 );
char * pBuffer = ( char * ) hb_xgrab( *pnLen + 1 );
memcpy( pBuffer, szText, *pulLen );
pBuffer[ *pulLen ] = '\0';
memcpy( pBuffer, szText, *pnLen );
pBuffer[ *pnLen ] = '\0';
if( iMethod == 1 )
{
HB_SIZE ul;
for( ul = 0; ul < *pulLen; ul++ )
for( ul = 0; ul < *pnLen; ul++ )
pBuffer[ ul ] ^= 0xF3;
}
return pBuffer;

View File

@@ -56,26 +56,26 @@
#include <windows.h>
static HB_SIZE hb_wcnlen( const wchar_t * szText, HB_SIZE count )
static HB_SIZE hb_wcnlen( const wchar_t * szText, HB_SIZE nCount )
{
HB_SIZE ulLen = 0;
HB_SIZE nLen = 0;
while( count-- && szText[ ulLen ] )
++ulLen;
while( nCount-- && szText[ nLen ] )
++nLen;
return ulLen;
return nLen;
}
void hb_wcntombcpy( char * dstA, const wchar_t * srcW, HB_SIZE ulLen )
void hb_wcntombcpy( char * dstA, const wchar_t * srcW, HB_SIZE nLen )
{
WideCharToMultiByte( CP_ACP, 0, srcW, -1, dstA, ( int ) ulLen, NULL, NULL );
dstA[ ( int ) ulLen ] = '\0';
WideCharToMultiByte( CP_ACP, 0, srcW, -1, dstA, ( int ) nLen, NULL, NULL );
dstA[ ( int ) nLen ] = '\0';
}
void hb_mbntowccpy( wchar_t * dstW, const char * srcA, HB_SIZE ulLen )
void hb_mbntowccpy( wchar_t * dstW, const char * srcA, HB_SIZE nLen )
{
MultiByteToWideChar( CP_ACP, 0, srcA, -1, dstW, ( int ) ulLen );
dstW[ ( int ) ulLen ] = L'\0';
MultiByteToWideChar( CP_ACP, 0, srcA, -1, dstW, ( int ) nLen );
dstW[ ( int ) nLen ] = L'\0';
}
wchar_t * hb_mbtowc( const char * srcA )
@@ -102,29 +102,29 @@ char * hb_wctomb( const wchar_t * srcW )
return dstA;
}
wchar_t * hb_mbntowc( const char * srcA, HB_SIZE ulLen )
wchar_t * hb_mbntowc( const char * srcA, HB_SIZE nLen )
{
int length;
wchar_t *dstW;
ulLen = hb_strnlen( srcA, ulLen );
length = MultiByteToWideChar( CP_ACP, 0, srcA, ( int ) ulLen, NULL, 0 );
nLen = hb_strnlen( srcA, nLen );
length = MultiByteToWideChar( CP_ACP, 0, srcA, ( int ) nLen, NULL, 0 );
dstW = ( wchar_t * ) hb_xgrab( ( length + 1 ) * sizeof( wchar_t ) );
MultiByteToWideChar( CP_ACP, 0, srcA, ( int ) ulLen, dstW, length );
MultiByteToWideChar( CP_ACP, 0, srcA, ( int ) nLen, dstW, length );
dstW[ length ] = L'\0';
return dstW;
}
char * hb_wcntomb( const wchar_t * srcW, HB_SIZE ulLen )
char * hb_wcntomb( const wchar_t * srcW, HB_SIZE nLen )
{
int length;
char *dstA;
ulLen = hb_wcnlen( srcW, ulLen );
length = WideCharToMultiByte( CP_ACP, 0, srcW, ( int ) ulLen, NULL, 0, NULL, NULL );
nLen = hb_wcnlen( srcW, nLen );
length = WideCharToMultiByte( CP_ACP, 0, srcW, ( int ) nLen, NULL, 0, NULL, NULL );
dstA = ( char * ) hb_xgrab( length + 1 );
WideCharToMultiByte( CP_ACP, 0, srcW, ( int ) ulLen, dstA, length, NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, srcW, ( int ) nLen, dstA, length, NULL, NULL );
dstA[ length ] = '\0';
return dstA;

View File

@@ -61,57 +61,57 @@
HB_BOOL hb_strMatchWild( const char *szString, const char *szPattern )
{
HB_BOOL fMatch = HB_TRUE, fAny = HB_FALSE;
HB_SIZE pulBufPosP[ HB_MAX_WILDPATTERN ], pulBufPosV[ HB_MAX_WILDPATTERN ],
ulBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * ulAnyPosP = pulBufPosP, * ulAnyPosV = pulBufPosV,
ulSize, ulLen, ulAny, i, j;
HB_SIZE pnBufPosP[ HB_MAX_WILDPATTERN ], pnBufPosV[ HB_MAX_WILDPATTERN ],
nBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * nAnyPosP = pnBufPosP, * nAnyPosV = pnBufPosV,
nSize, nLen, nAny, i, j;
i = j = ulAny = 0;
ulLen = strlen( szString );
ulSize = strlen( szPattern );
while( i < ulSize )
i = j = nAny = 0;
nLen = strlen( szString );
nSize = strlen( szPattern );
while( i < nSize )
{
if( szPattern[i] == '*' )
{
fAny = HB_TRUE;
i++;
}
else if( j < ulLen && ( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
else if( j < nLen && ( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
{
if( fAny )
{
if( ulAny >= ulBufSize )
if( nAny >= nBufSize )
{
if( ( ulBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
if( ( nBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
{
ulAnyPosP = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
memcpy( ulAnyPosP, pulBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( ulAnyPosV, pulBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
memcpy( nAnyPosP, pnBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( nAnyPosV, pnBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
}
else
{
ulAnyPosP = ( HB_SIZE * ) hb_xrealloc( ulAnyPosP, ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xrealloc( ulAnyPosV, ulBufSize * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xrealloc( nAnyPosP, nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xrealloc( nAnyPosV, nBufSize * sizeof( HB_SIZE ) );
}
}
ulAnyPosP[ ulAny ] = i;
ulAnyPosV[ ulAny ] = j;
ulAny++;
nAnyPosP[ nAny ] = i;
nAnyPosV[ nAny ] = j;
nAny++;
fAny = HB_FALSE;
}
j++;
i++;
}
else if( fAny && j < ulLen )
else if( fAny && j < nLen )
{
j++;
}
else if( ulAny > 0 )
else if( nAny > 0 )
{
ulAny--;
i = ulAnyPosP[ ulAny ];
j = ulAnyPosV[ ulAny ] + 1;
nAny--;
i = nAnyPosP[ nAny ];
j = nAnyPosV[ nAny ] + 1;
fAny = HB_TRUE;
}
else
@@ -120,10 +120,10 @@ HB_BOOL hb_strMatchWild( const char *szString, const char *szPattern )
break;
}
}
if( ulBufSize > HB_MAX_WILDPATTERN )
if( nBufSize > HB_MAX_WILDPATTERN )
{
hb_xfree( ulAnyPosP );
hb_xfree( ulAnyPosV );
hb_xfree( nAnyPosP );
hb_xfree( nAnyPosV );
}
return fMatch;
}
@@ -131,58 +131,58 @@ HB_BOOL hb_strMatchWild( const char *szString, const char *szPattern )
HB_BOOL hb_strMatchWildExact( const char *szString, const char *szPattern )
{
HB_BOOL fMatch = HB_TRUE, fAny = HB_FALSE;
HB_SIZE pulBufPosP[ HB_MAX_WILDPATTERN ], pulBufPosV[ HB_MAX_WILDPATTERN ],
ulBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * ulAnyPosP = pulBufPosP, * ulAnyPosV = pulBufPosV,
ulSize, ulLen, ulAny, i, j;
HB_SIZE pnBufPosP[ HB_MAX_WILDPATTERN ], pnBufPosV[ HB_MAX_WILDPATTERN ],
nBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * nAnyPosP = pnBufPosP, * nAnyPosV = pnBufPosV,
nSize, nLen, nAny, i, j;
i = j = ulAny = 0;
ulLen = strlen( szString );
ulSize = strlen( szPattern );
while( i < ulSize || ( j < ulLen && !fAny ) )
i = j = nAny = 0;
nLen = strlen( szString );
nSize = strlen( szPattern );
while( i < nSize || ( j < nLen && !fAny ) )
{
if( i < ulSize && szPattern[i] == '*' )
if( i < nSize && szPattern[i] == '*' )
{
fAny = HB_TRUE;
i++;
}
else if( j < ulLen && i < ulSize &&
else if( j < nLen && i < nSize &&
( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
{
if( fAny )
{
if( ulAny >= ulBufSize )
if( nAny >= nBufSize )
{
if( ( ulBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
if( ( nBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
{
ulAnyPosP = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
memcpy( ulAnyPosP, pulBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( ulAnyPosV, pulBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
memcpy( nAnyPosP, pnBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( nAnyPosV, pnBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
}
else
{
ulAnyPosP = ( HB_SIZE * ) hb_xrealloc( ulAnyPosP, ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xrealloc( ulAnyPosV, ulBufSize * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xrealloc( nAnyPosP, nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xrealloc( nAnyPosV, nBufSize * sizeof( HB_SIZE ) );
}
}
ulAnyPosP[ ulAny ] = i;
ulAnyPosV[ ulAny ] = j;
ulAny++;
nAnyPosP[ nAny ] = i;
nAnyPosV[ nAny ] = j;
nAny++;
fAny = HB_FALSE;
}
j++;
i++;
}
else if( fAny && j < ulLen )
else if( fAny && j < nLen )
{
j++;
}
else if( ulAny > 0 )
else if( nAny > 0 )
{
ulAny--;
i = ulAnyPosP[ ulAny ];
j = ulAnyPosV[ ulAny ] + 1;
nAny--;
i = nAnyPosP[ nAny ];
j = nAnyPosV[ nAny ] + 1;
fAny = HB_TRUE;
}
else
@@ -191,10 +191,10 @@ HB_BOOL hb_strMatchWildExact( const char *szString, const char *szPattern )
break;
}
}
if( ulBufSize > HB_MAX_WILDPATTERN )
if( nBufSize > HB_MAX_WILDPATTERN )
{
hb_xfree( ulAnyPosP );
hb_xfree( ulAnyPosV );
hb_xfree( nAnyPosP );
hb_xfree( nAnyPosV );
}
return fMatch;
}
@@ -202,59 +202,59 @@ HB_BOOL hb_strMatchWildExact( const char *szString, const char *szPattern )
HB_BOOL hb_strMatchCaseWildExact( const char *szString, const char *szPattern )
{
HB_BOOL fMatch = HB_TRUE, fAny = HB_FALSE;
HB_SIZE pulBufPosP[ HB_MAX_WILDPATTERN ], pulBufPosV[ HB_MAX_WILDPATTERN ],
ulBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * ulAnyPosP = pulBufPosP, * ulAnyPosV = pulBufPosV,
ulSize, ulLen, ulAny, i, j;
HB_SIZE pnBufPosP[ HB_MAX_WILDPATTERN ], pnBufPosV[ HB_MAX_WILDPATTERN ],
nBufSize = HB_MAX_WILDPATTERN;
HB_SIZE * nAnyPosP = pnBufPosP, * nAnyPosV = pnBufPosV,
nSize, nLen, nAny, i, j;
i = j = ulAny = 0;
ulLen = strlen( szString );
ulSize = strlen( szPattern );
while ( i < ulSize || ( j < ulLen && !fAny ) )
i = j = nAny = 0;
nLen = strlen( szString );
nSize = strlen( szPattern );
while ( i < nSize || ( j < nLen && !fAny ) )
{
if( i < ulSize && szPattern[i] == '*' )
if( i < nSize && szPattern[i] == '*' )
{
fAny = HB_TRUE;
i++;
}
else if( j < ulLen && i < ulSize &&
else if( j < nLen && i < nSize &&
( szPattern[i] == '?' ||
hb_charUpper( szPattern[i] ) == hb_charUpper( szString[j] ) ) )
{
if( fAny )
{
if( ulAny >= ulBufSize )
if( nAny >= nBufSize )
{
if( ( ulBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
if( ( nBufSize <<= 1 ) == ( HB_MAX_WILDPATTERN << 1 ) )
{
ulAnyPosP = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xgrab( ulBufSize * sizeof( HB_SIZE ) );
memcpy( ulAnyPosP, pulBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( ulAnyPosV, pulBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xgrab( nBufSize * sizeof( HB_SIZE ) );
memcpy( nAnyPosP, pnBufPosP, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
memcpy( nAnyPosV, pnBufPosV, HB_MAX_WILDPATTERN * sizeof( HB_SIZE ) );
}
else
{
ulAnyPosP = ( HB_SIZE * ) hb_xrealloc( ulAnyPosP, ulBufSize * sizeof( HB_SIZE ) );
ulAnyPosV = ( HB_SIZE * ) hb_xrealloc( ulAnyPosV, ulBufSize * sizeof( HB_SIZE ) );
nAnyPosP = ( HB_SIZE * ) hb_xrealloc( nAnyPosP, nBufSize * sizeof( HB_SIZE ) );
nAnyPosV = ( HB_SIZE * ) hb_xrealloc( nAnyPosV, nBufSize * sizeof( HB_SIZE ) );
}
}
ulAnyPosP[ ulAny ] = i;
ulAnyPosV[ ulAny ] = j;
ulAny++;
nAnyPosP[ nAny ] = i;
nAnyPosV[ nAny ] = j;
nAny++;
fAny = HB_FALSE;
}
j++;
i++;
}
else if( fAny && j < ulLen )
else if( fAny && j < nLen )
{
j++;
}
else if( ulAny > 0 )
else if( nAny > 0 )
{
ulAny--;
i = ulAnyPosP[ ulAny ];
j = ulAnyPosV[ ulAny ] + 1;
nAny--;
i = nAnyPosP[ nAny ];
j = nAnyPosV[ nAny ] + 1;
fAny = HB_TRUE;
}
else
@@ -263,10 +263,10 @@ HB_BOOL hb_strMatchCaseWildExact( const char *szString, const char *szPattern )
break;
}
}
if( ulBufSize > HB_MAX_WILDPATTERN )
if( nBufSize > HB_MAX_WILDPATTERN )
{
hb_xfree( ulAnyPosP );
hb_xfree( ulAnyPosV );
hb_xfree( nAnyPosP );
hb_xfree( nAnyPosV );
}
return fMatch;
}

View File

@@ -95,23 +95,23 @@ HB_FUNC( HB_ATI )
if( pText && pSub )
{
HB_SIZE ulTextLength = hb_itemGetCLen( pText );
HB_SIZE ulStart = hb_parnsdef( 3, 1 );
HB_SIZE ulEnd = ( HB_SIZE ) hb_parnsdef( 4, ulTextLength );
HB_SIZE nTextLength = hb_itemGetCLen( pText );
HB_SIZE nStart = hb_parnsdef( 3, 1 );
HB_SIZE nEnd = ( HB_SIZE ) hb_parnsdef( 4, nTextLength );
HB_SIZE nPos;
if( ulStart > ulTextLength || ulEnd < ulStart )
if( nStart > nTextLength || nEnd < nStart )
hb_retns( 0 );
else
{
if( ulEnd > ulTextLength )
ulEnd = ulTextLength;
if( nEnd > nTextLength )
nEnd = nTextLength;
nPos = hb_strAtI( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ),
hb_itemGetCPtr( pText ) + ulStart - 1, ulEnd - ulStart + 1 );
hb_itemGetCPtr( pText ) + nStart - 1, nEnd - nStart + 1 );
if( nPos > 0 )
nPos += ( ulStart - 1 );
nPos += ( nStart - 1 );
hb_retns( nPos );
}

View File

@@ -273,21 +273,21 @@ HB_FUNC( HB_UTF8SUBSTR )
{
char * szDest = NULL;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
HB_ISIZ lFrom = hb_parns( 2 );
HB_ISIZ lCount = iPCount < 3 ? ( HB_ISIZ ) nLen : hb_parns( 3 );
HB_ISIZ nFrom = hb_parns( 2 );
HB_ISIZ nCount = iPCount < 3 ? ( HB_ISIZ ) nLen : hb_parns( 3 );
if( lFrom < 0 )
if( nFrom < 0 )
{
lFrom += hb_cdpUTF8StringLength( szString, nLen );
if( lFrom < 0 )
lFrom = 0;
nFrom += hb_cdpUTF8StringLength( szString, nLen );
if( nFrom < 0 )
nFrom = 0;
}
else if( lFrom )
--lFrom;
else if( nFrom )
--nFrom;
if( nLen && lCount > 0 )
if( nLen && nCount > 0 )
szDest = hb_cdpUTF8StringSubstr( szString, nLen,
lFrom, lCount, &nDest );
nFrom, nCount, &nDest );
if( szDest )
hb_retclen_buffer( szDest, nDest );
else
@@ -303,13 +303,13 @@ HB_FUNC( HB_UTF8LEFT )
if( szString && HB_ISNUM( 2 ) )
{
HB_ISIZ lLenReq = hb_parns( 2 );
HB_ISIZ nLenReq = hb_parns( 2 );
HB_SIZE nDest = 0;
char * szDest = NULL;
if( lLenReq > 0 )
if( nLenReq > 0 )
szDest = hb_cdpUTF8StringSubstr( szString, hb_parclen( 1 ),
0, lLenReq, &nDest );
0, nLenReq, &nDest );
if( szDest )
hb_retclen_buffer( szDest, nDest );
@@ -326,17 +326,17 @@ HB_FUNC( HB_UTF8RIGHT )
if( szString && HB_ISNUM( 2 ) )
{
HB_ISIZ lLenReq = hb_parns( 2 ), lFrom;
HB_ISIZ nLenReq = hb_parns( 2 ), nFrom;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
char * szDest = NULL;
if( nLen && lLenReq > 0 )
if( nLen && nLenReq > 0 )
{
lFrom = hb_cdpUTF8StringLength( szString, nLen ) - lLenReq;
if( lFrom < 0 )
lFrom = 0;
nFrom = hb_cdpUTF8StringLength( szString, nLen ) - nLenReq;
if( nFrom < 0 )
nFrom = 0;
szDest = hb_cdpUTF8StringSubstr( szString, nLen,
lFrom, lLenReq, &nDest );
nFrom, nLenReq, &nDest );
}
if( szDest )

View File

@@ -600,21 +600,21 @@ HB_FHANDLE hb_fsPOpen( const char * pFilename, const char * pMode )
#if defined( HB_OS_UNIX )
{
HB_FHANDLE hPipeHandle[2], hNullHandle;
HB_FHANDLE hPipeHandle[ 2 ], hNullHandle;
pid_t pid;
char * pszTmp;
HB_BOOL fRead;
HB_SIZE ulLen;
HB_SIZE nLen;
int iMaxFD;
ulLen = strlen( pFilename );
nLen = strlen( pFilename );
if( pMode && ( *pMode == 'r' || *pMode == 'w' ) )
fRead = ( *pMode == 'r' );
else
{
if( pFilename[0] == '|' )
fRead = HB_FALSE;
else if( pFilename[ ulLen - 1 ] == '|' )
else if( pFilename[ nLen - 1 ] == '|' )
fRead = HB_TRUE;
else
fRead = HB_FALSE;
@@ -623,12 +623,12 @@ HB_FHANDLE hb_fsPOpen( const char * pFilename, const char * pMode )
if( pFilename[0] == '|' )
{
++pFilename;
--ulLen;
--nLen;
}
if( pFilename[ ulLen - 1 ] == '|' )
if( pFilename[ nLen - 1 ] == '|' )
{
pszTmp = hb_strdup( pFilename );
pszTmp[--ulLen] = 0;
pszTmp[ --nLen ] = 0;
pFilename = pszTmp;
} else
pszTmp = NULL;
@@ -2097,7 +2097,7 @@ HB_BOOL hb_fsLock( HB_FHANDLE hFileHandle, HB_ULONG ulStart,
}
else
{
fResult = LockFile( DosToWinHandle( hFileHandle ), ulStart, 0, ulLength,0 ) != 0;
fResult = LockFile( DosToWinHandle( hFileHandle ), ulStart, 0, ulLength, 0 ) != 0;
}
break;
}
@@ -2112,7 +2112,7 @@ HB_BOOL hb_fsLock( HB_FHANDLE hFileHandle, HB_ULONG ulStart,
}
else
{
fResult = UnlockFile( DosToWinHandle( hFileHandle ), ulStart, 0, ulLength,0 ) != 0;
fResult = UnlockFile( DosToWinHandle( hFileHandle ), ulStart, 0, ulLength, 0 ) != 0;
}
break;
@@ -2257,19 +2257,19 @@ HB_BOOL hb_fsLock( HB_FHANDLE hFileHandle, HB_ULONG ulStart,
return fResult;
}
HB_BOOL hb_fsLockLarge( HB_FHANDLE hFileHandle, HB_FOFFSET ulStart,
HB_FOFFSET ulLength, HB_USHORT uiMode )
HB_BOOL hb_fsLockLarge( HB_FHANDLE hFileHandle, HB_FOFFSET nStart,
HB_FOFFSET nLength, HB_USHORT uiMode )
{
HB_BOOL fResult;
HB_TRACE(HB_TR_DEBUG, ("hb_fsLockLarge(%p, %" PFHL "u, %" PFHL "i, %hu)", ( void * ) ( HB_PTRDIFF ) hFileHandle, ulStart, ulLength, uiMode));
HB_TRACE(HB_TR_DEBUG, ("hb_fsLockLarge(%p, %" PFHL "u, %" PFHL "i, %hu)", ( void * ) ( HB_PTRDIFF ) hFileHandle, nStart, nLength, uiMode));
#if defined( HB_OS_WIN )
{
DWORD dwOffsetLo = ( DWORD ) ( ulStart & 0xFFFFFFFF ),
dwOffsetHi = ( DWORD ) ( ulStart >> 32 ),
dwLengthLo = ( DWORD ) ( ulLength & 0xFFFFFFFF ),
dwLengthHi = ( DWORD ) ( ulLength >> 32 );
DWORD dwOffsetLo = ( DWORD ) ( nStart & 0xFFFFFFFF ),
dwOffsetHi = ( DWORD ) ( nStart >> 32 ),
dwLengthLo = ( DWORD ) ( nLength & 0xFFFFFFFF ),
dwLengthHi = ( DWORD ) ( nLength >> 32 );
hb_vmUnlock();
switch( uiMode & FL_MASK )
@@ -2337,8 +2337,8 @@ HB_BOOL hb_fsLockLarge( HB_FHANDLE hFileHandle, HB_FOFFSET ulStart,
case FL_LOCK:
lock_info.l_type = ( uiMode & FLX_SHARED ) ? F_RDLCK : F_WRLCK;
lock_info.l_start = ulStart;
lock_info.l_len = ulLength;
lock_info.l_start = nStart;
lock_info.l_len = nLength;
lock_info.l_whence = SEEK_SET; /* start from the beginning of the file */
lock_info.l_pid = getpid();
@@ -2350,8 +2350,8 @@ HB_BOOL hb_fsLockLarge( HB_FHANDLE hFileHandle, HB_FOFFSET ulStart,
case FL_UNLOCK:
lock_info.l_type = F_UNLCK; /* unlock */
lock_info.l_start = ulStart;
lock_info.l_len = ulLength;
lock_info.l_start = nStart;
lock_info.l_len = nLength;
lock_info.l_whence = SEEK_SET;
lock_info.l_pid = getpid();
@@ -2365,7 +2365,7 @@ HB_BOOL hb_fsLockLarge( HB_FHANDLE hFileHandle, HB_FOFFSET ulStart,
hb_vmLock();
}
#else
fResult = hb_fsLock( hFileHandle, ( HB_SIZE ) ulStart, ( HB_SIZE ) ulLength, uiMode );
fResult = hb_fsLock( hFileHandle, ( HB_SIZE ) nStart, ( HB_SIZE ) nLength, uiMode );
#endif
return fResult;
@@ -2725,12 +2725,12 @@ const char * hb_fsCurDir( int iDrive )
/* NOTE: Thread safe version of hb_fsCurDir() */
/* NOTE: 0 = current drive, 1 = A, 2 = B, 3 = C, etc. */
HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE nSize )
{
int iCurDrv = iDrive;
HB_ERRCODE nResult;
char * pszStart;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_TRACE(HB_TR_DEBUG, ("hb_fsCurDirBuff(%d)", iDrive));
@@ -2754,7 +2754,7 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
#if defined( HB_OS_WIN )
{
DWORD dwSize = ( DWORD ) ulSize;
DWORD dwSize = ( DWORD ) nSize;
#if defined( UNICODE )
LPTSTR lpBuffer = ( LPTSTR ) hb_xgrab( dwSize * sizeof( TCHAR ) );
hb_fsSetIOError( ( GetCurrentDirectory( dwSize, lpBuffer ) != 0 ), 0 );
@@ -2769,10 +2769,10 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
if( iDrive >= 0 )
{
ULONG ulLen = ( ULONG ) ulSize;
ULONG nLen = ( ULONG ) nSize;
hb_fsSetIOError( DosQueryCurrentDir( iDrive, ( PBYTE ) pszBuffer,
&ulLen ) == NO_ERROR, 0 );
&nLen ) == NO_ERROR, 0 );
}
else
hb_fsSetError( ( HB_ERRCODE ) FS_ERROR );
@@ -2780,13 +2780,13 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
#elif defined( __MINGW32__ )
if( iDrive >= 0 )
hb_fsSetIOError( ( _getdcwd( iDrive, pszBuffer, ulSize ) != NULL ), 0 );
hb_fsSetIOError( ( _getdcwd( iDrive, pszBuffer, nSize ) != NULL ), 0 );
else
hb_fsSetError( ( HB_ERRCODE ) FS_ERROR );
#else
hb_fsSetIOError( ( getcwd( pszBuffer, ulSize ) != NULL ), 0 );
hb_fsSetIOError( ( getcwd( pszBuffer, nSize ) != NULL ), 0 );
#endif
@@ -2800,7 +2800,7 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
hb_fsSetError( nResult );
}
pszBuffer[ ulSize - 1 ] = '\0';
pszBuffer[ nSize - 1 ] = '\0';
if( nResult == 0 && pszBuffer[ 0 ] )
{
@@ -2815,40 +2815,40 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize )
#endif
pszStart = pszBuffer;
ulLen = strlen( pszBuffer );
nLen = strlen( pszBuffer );
#if defined( HB_OS_HAS_DRIVE_LETTER )
if( pszStart[ 1 ] == HB_OS_DRIVE_DELIM_CHR )
{
pszStart += 2;
ulLen -= 2;
nLen -= 2;
}
#endif
if( strchr( HB_OS_PATH_DELIM_CHR_LIST, ( HB_UCHAR ) pszStart[ 0 ] ) )
{
pszStart++;
ulLen--;
nLen--;
}
/* Strip the trailing (back)slash if there's one */
if( ulLen && strchr( HB_OS_PATH_DELIM_CHR_LIST, ( HB_UCHAR ) pszStart[ ulLen - 1 ] ) )
ulLen--;
if( nLen && strchr( HB_OS_PATH_DELIM_CHR_LIST, ( HB_UCHAR ) pszStart[ nLen - 1 ] ) )
nLen--;
if( ulLen && pszBuffer != pszStart )
memmove( pszBuffer, pszStart, ulLen );
if( nLen && pszBuffer != pszStart )
memmove( pszBuffer, pszStart, nLen );
pszBuffer[ ulLen ] = '\0';
pszBuffer[ nLen ] = '\0';
/* Convert from OS codepage */
{
char * pszFree = NULL;
const char * pszResult;
ulLen = ulSize;
pszResult = hb_osDecodeCP( pszBuffer, &pszFree, &ulLen );
nLen = nSize;
pszResult = hb_osDecodeCP( pszBuffer, &pszFree, &nLen );
if( pszResult != pszBuffer )
hb_strncpy( pszBuffer, pszResult, ulSize - 1 );
hb_strncpy( pszBuffer, pszResult, nSize - 1 );
if( pszFree )
hb_xfree( pszFree );
}
@@ -3280,7 +3280,7 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree )
pszCP )
{
PHB_FNAME pFileName;
HB_SIZE ulLen;
HB_SIZE nLen;
if( pszFree )
{
@@ -3306,17 +3306,17 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree )
{
if( pFileName->szName )
{
ulLen = strlen( pFileName->szName );
ulLen = hb_strRTrimLen( pFileName->szName, ulLen, HB_FALSE );
pFileName->szName = hb_strLTrim( pFileName->szName, &ulLen );
( ( char * ) pFileName->szName )[ ulLen ] = '\0';
nLen = strlen( pFileName->szName );
nLen = hb_strRTrimLen( pFileName->szName, nLen, HB_FALSE );
pFileName->szName = hb_strLTrim( pFileName->szName, &nLen );
( ( char * ) pFileName->szName )[ nLen ] = '\0';
}
if( pFileName->szExtension )
{
ulLen = strlen( pFileName->szExtension );
ulLen = hb_strRTrimLen( pFileName->szExtension, ulLen, HB_FALSE );
pFileName->szExtension = hb_strLTrim( pFileName->szExtension, &ulLen );
( ( char * ) pFileName->szExtension )[ ulLen ] = '\0';
nLen = strlen( pFileName->szExtension );
nLen = hb_strRTrimLen( pFileName->szExtension, nLen, HB_FALSE );
pFileName->szExtension = hb_strLTrim( pFileName->szExtension, &nLen );
( ( char * ) pFileName->szExtension )[ nLen ] = '\0';
}
}
@@ -3351,8 +3351,8 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree )
if( pszCP )
{
const char * pszPrev = szFileName;
ulLen = HB_PATH_MAX;
szFileName = hb_osEncodeCP( szFileName, pszFree, &ulLen );
nLen = HB_PATH_MAX;
szFileName = hb_osEncodeCP( szFileName, pszFree, &nLen );
if( pszFree == NULL && szFileName != pszPrev )
{
hb_strncpy( ( char * ) pszPrev, szFileName, HB_PATH_MAX - 1 );
@@ -3375,7 +3375,7 @@ void hb_fsBaseDirBuff( char * pszBuffer )
PHB_FNAME pFName = hb_fsFNameSplit( szBaseName );
const char * pszResult;
char * pszFree = NULL;
HB_SIZE ulSize = HB_PATH_MAX;
HB_SIZE nSize = HB_PATH_MAX;
pFName->szName = NULL;
pFName->szExtension = NULL;
@@ -3383,7 +3383,7 @@ void hb_fsBaseDirBuff( char * pszBuffer )
hb_xfree( pFName );
/* Convert from OS codepage */
pszResult = hb_osDecodeCP( pszBuffer, &pszFree, &ulSize );
pszResult = hb_osDecodeCP( pszBuffer, &pszFree, &nSize );
if( pszResult != pszBuffer )
hb_strncpy( pszBuffer, pszResult, HB_PATH_MAX - 1 );
if( pszFree )

View File

@@ -71,16 +71,16 @@ HB_FUNC( GETENV )
if( pName && hb_pcount() == 1 )
{
char * pszName = hb_itemGetC( pName );
HB_SIZE ulName = strlen( pszName );
HB_SIZE ulPos;
HB_SIZE nName = strlen( pszName );
HB_SIZE nPos;
/* strip the '=' or else it will clear the variable! */
for( ulPos = 0; ulPos < ulName; ulPos++ )
for( nPos = 0; nPos < nName; nPos++ )
{
if( pszName[ ulPos ] == '=' )
if( pszName[ nPos ] == '=' )
{
pszName[ ulPos ] = '\0';
pszName[ nPos ] = '\0';
break;
}
}
@@ -140,16 +140,16 @@ HB_FUNC( HB_GETENV )
if( pName )
{
char * pszName = hb_itemGetC( pName );
HB_SIZE ulName = strlen( pszName );
HB_SIZE ulPos;
HB_SIZE nName = strlen( pszName );
HB_SIZE nPos;
/* strip the '=' or else it will clear the variable! */
for( ulPos = 0; ulPos < ulName; ulPos++ )
for( nPos = 0; nPos < nName; nPos++ )
{
if( pszName[ ulPos ] == '=' )
if( pszName[ nPos ] == '=' )
{
pszName[ ulPos ] = '\0';
pszName[ nPos ] = '\0';
break;
}
}

View File

@@ -584,17 +584,17 @@ HB_BOOL hb_gtIsColor( void )
return fColor;
}
HB_ERRCODE hb_gtRepChar( int iRow, int iCol, HB_USHORT usChar, HB_SIZE ulCount )
HB_ERRCODE hb_gtRepChar( int iRow, int iCol, HB_USHORT usChar, HB_SIZE nCount )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtRepChar(%d, %d, %hu, %" HB_PFS "u)", iRow, iCol, usChar, ulCount));
HB_TRACE(HB_TR_DEBUG, ("hb_gtRepChar(%d, %d, %hu, %" HB_PFS "u)", iRow, iCol, usChar, nCount));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_REPLICATE( pGT, iRow, iCol, HB_GTSELF_GETCOLOR( pGT ), 0,
usChar, ulCount );
usChar, nCount );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
return HB_SUCCESS;
@@ -755,11 +755,11 @@ HB_ERRCODE hb_gtSetMode( int iRows, int iCols )
}
HB_ERRCODE hb_gtPutText( int iRow, int iCol,
const char * szStr, HB_SIZE ulLength, int iColor )
const char * szStr, HB_SIZE nLength, int iColor )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtPutText(%d, %d, %p, %" HB_PFS "u, %d)", iRow, iCol, szStr, ulLength, iColor));
HB_TRACE(HB_TR_DEBUG, ("hb_gtPutText(%d, %d, %p, %" HB_PFS "u, %d)", iRow, iCol, szStr, nLength, iColor));
pGT = hb_gt_Base();
if( pGT )
@@ -767,7 +767,7 @@ HB_ERRCODE hb_gtPutText( int iRow, int iCol,
if( iColor == -1 )
iColor = HB_GTSELF_GETCOLOR( pGT );
HB_GTSELF_PUTTEXT( pGT, iRow, iCol, iColor, szStr, ulLength );
HB_GTSELF_PUTTEXT( pGT, iRow, iCol, iColor, szStr, nLength );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
@@ -776,16 +776,16 @@ HB_ERRCODE hb_gtPutText( int iRow, int iCol,
return HB_FAILURE;
}
HB_ERRCODE hb_gtWriteAt( int iRow, int iCol, const char * szStr, HB_SIZE ulLength )
HB_ERRCODE hb_gtWriteAt( int iRow, int iCol, const char * szStr, HB_SIZE nLength )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtWriteAt(%d, %d, %p, %" HB_PFS "u)", iRow, iCol, szStr, ulLength));
HB_TRACE(HB_TR_DEBUG, ("hb_gtWriteAt(%d, %d, %p, %" HB_PFS "u)", iRow, iCol, szStr, nLength));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_WRITEAT( pGT, iRow, iCol, szStr, ulLength );
HB_GTSELF_WRITEAT( pGT, iRow, iCol, szStr, nLength );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
return HB_SUCCESS;
@@ -793,16 +793,16 @@ HB_ERRCODE hb_gtWriteAt( int iRow, int iCol, const char * szStr, HB_SIZE ulLengt
return HB_FAILURE;
}
HB_ERRCODE hb_gtWrite( const char * szStr, HB_SIZE ulLength )
HB_ERRCODE hb_gtWrite( const char * szStr, HB_SIZE nLength )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtWrite(%p, %" HB_PFS "u)", szStr, ulLength));
HB_TRACE(HB_TR_DEBUG, ("hb_gtWrite(%p, %" HB_PFS "u)", szStr, nLength));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_WRITE( pGT, szStr, ulLength );
HB_GTSELF_WRITE( pGT, szStr, nLength );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
return HB_SUCCESS;
@@ -810,16 +810,16 @@ HB_ERRCODE hb_gtWrite( const char * szStr, HB_SIZE ulLength )
return HB_FAILURE;
}
HB_ERRCODE hb_gtWriteCon( const char * szStr, HB_SIZE ulLength )
HB_ERRCODE hb_gtWriteCon( const char * szStr, HB_SIZE nLength )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtWriteCon(%p, %" HB_PFS "u)", szStr, ulLength));
HB_TRACE(HB_TR_DEBUG, ("hb_gtWriteCon(%p, %" HB_PFS "u)", szStr, nLength));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_WRITECON( pGT, szStr, ulLength );
HB_GTSELF_WRITECON( pGT, szStr, nLength );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
return HB_SUCCESS;
@@ -963,38 +963,38 @@ HB_ERRCODE hb_gtResume( void )
return errCode;
}
HB_ERRCODE hb_gtOutStd( const char * szStr, HB_SIZE ulLen )
HB_ERRCODE hb_gtOutStd( const char * szStr, HB_SIZE nLen )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtOutStd(%p, %" HB_PFS "u)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_gtOutStd(%p, %" HB_PFS "u)", szStr, nLen));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_OUTSTD( pGT, szStr, ulLen );
HB_GTSELF_OUTSTD( pGT, szStr, nLen );
hb_gt_BaseFree( pGT );
}
else
hb_fsWriteLarge( ( HB_FHANDLE ) HB_STDOUT_HANDLE, szStr, ulLen );
hb_fsWriteLarge( ( HB_FHANDLE ) HB_STDOUT_HANDLE, szStr, nLen );
return HB_SUCCESS;
}
HB_ERRCODE hb_gtOutErr( const char * szStr, HB_SIZE ulLen )
HB_ERRCODE hb_gtOutErr( const char * szStr, HB_SIZE nLen )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtOutErr(%p, %" HB_PFS "u)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_gtOutErr(%p, %" HB_PFS "u)", szStr, nLen));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_OUTERR( pGT, szStr, ulLen );
HB_GTSELF_OUTERR( pGT, szStr, nLen );
hb_gt_BaseFree( pGT );
}
else
hb_fsWriteLarge( ( HB_FHANDLE ) HB_STDERR_HANDLE, szStr, ulLen );
hb_fsWriteLarge( ( HB_FHANDLE ) HB_STDERR_HANDLE, szStr, nLen );
return HB_SUCCESS;
}

View File

@@ -77,20 +77,20 @@
static HB_CRITICAL_NEW( s_clipMtx );
static char * s_szClipboardData;
static HB_SIZE s_ulClipboardLen;
static HB_SIZE s_nClipboardLen;
HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE ulLen )
HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE nLen )
{
hb_threadEnterCriticalSection( &s_clipMtx );
if( s_ulClipboardLen )
if( s_nClipboardLen )
hb_xfree( s_szClipboardData );
s_ulClipboardLen = ulLen;
if( ulLen )
s_nClipboardLen = nLen;
if( nLen )
{
s_szClipboardData = ( char * ) hb_xgrab( s_ulClipboardLen + 1 );
memcpy( s_szClipboardData, szClipData, s_ulClipboardLen );
s_szClipboardData[ s_ulClipboardLen ] = '\0';
s_szClipboardData = ( char * ) hb_xgrab( s_nClipboardLen + 1 );
memcpy( s_szClipboardData, szClipData, s_nClipboardLen );
s_szClipboardData[ s_nClipboardLen ] = '\0';
}
hb_threadLeaveCriticalSection( &s_clipMtx );
@@ -98,22 +98,22 @@ HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE ulLen )
return HB_TRUE;
}
HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE *pulLen )
HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE * pnLen )
{
hb_threadEnterCriticalSection( &s_clipMtx );
*pszClipData = NULL;
*pulLen = s_ulClipboardLen;
if( s_ulClipboardLen )
*pnLen = s_nClipboardLen;
if( s_nClipboardLen )
{
*pszClipData = ( char * ) hb_xgrab( s_ulClipboardLen + 1 );
memcpy( *pszClipData, s_szClipboardData, s_ulClipboardLen );
( *pszClipData )[ s_ulClipboardLen ] = '\0';
*pszClipData = ( char * ) hb_xgrab( s_nClipboardLen + 1 );
memcpy( *pszClipData, s_szClipboardData, s_nClipboardLen );
( *pszClipData )[ s_nClipboardLen ] = '\0';
}
hb_threadLeaveCriticalSection( &s_clipMtx );
return s_ulClipboardLen != 0;
return s_nClipboardLen != 0;
}
#if defined( HB_OS_WIN )

View File

@@ -53,18 +53,18 @@
#include "hbapi.h"
#include "hbapiitm.h"
static char * hb_strHardCR( char * pszString, HB_SIZE ulStringLen )
static char * hb_strHardCR( char * pszString, HB_SIZE nStringLen )
{
HB_SIZE ulStringPos;
HB_SIZE nStringPos;
HB_TRACE(HB_TR_DEBUG, ("hb_strHardCR(%s, %" HB_PFS "u)", pszString, ulStringLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strHardCR(%s, %" HB_PFS "u)", pszString, nStringLen));
for( ulStringPos = 0; ulStringPos < ulStringLen; ulStringPos++ )
for( nStringPos = 0; nStringPos < nStringLen; nStringPos++ )
{
if( pszString[ ulStringPos ] == HB_CHAR_SOFT1 &&
pszString[ ulStringPos + 1 ] == HB_CHAR_SOFT2 )
if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
{
pszString[ ulStringPos ] = HB_CHAR_HARD1;
pszString[ nStringPos ] = HB_CHAR_HARD1;
}
}
@@ -78,9 +78,9 @@ HB_FUNC( HARDCR )
if( pString )
{
char * pszBuffer = hb_itemGetC( pString );
HB_SIZE ulStringLen = hb_itemGetCLen( pString );
HB_SIZE nStringLen = hb_itemGetCLen( pString );
hb_retclen_buffer( hb_strHardCR( pszBuffer, ulStringLen ), ulStringLen );
hb_retclen_buffer( hb_strHardCR( pszBuffer, nStringLen ), nStringLen );
}
else
hb_retc_null();

View File

@@ -69,14 +69,14 @@ HB_U32 hb_adler32( HB_U32 adler, const void * buf, HB_SIZE len )
const unsigned char * ucbuf = ( const unsigned char * ) buf;
do
{
HB_ISIZ i = len < NMAX ? len : NMAX;
len -= i;
HB_ISIZ n = len < NMAX ? len : NMAX;
len -= n;
do
{
s1 += *ucbuf++;
s2 += s1;
}
while( --i );
while( --n );
s1 %= BASE;
s2 %= BASE;
}

View File

@@ -61,9 +61,9 @@ HB_FUNC( HB_ASCIIUPPER )
if( pText )
{
const char * pszText = hb_itemGetCPtr( pText );
HB_SIZE ulLen = hb_itemGetCLen( pText ), u;
HB_SIZE nLen = hb_itemGetCLen( pText ), u;
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
{
if( HB_ISLOWER( pszText[ u ] ) )
{
@@ -73,8 +73,8 @@ HB_FUNC( HB_ASCIIUPPER )
{
pszBuff[ u ] = HB_TOUPPER( pszBuff[ u ] );
}
while( ++u < ulLen );
hb_retclen_buffer( hb_strUpper( pszBuff, ulLen ), ulLen );
while( ++u < nLen );
hb_retclen_buffer( hb_strUpper( pszBuff, nLen ), nLen );
return;
}
}
@@ -91,9 +91,9 @@ HB_FUNC( HB_ASCIILOWER )
if( pText )
{
const char * pszText = hb_itemGetCPtr( pText );
HB_SIZE ulLen = hb_itemGetCLen( pText ), u;
HB_SIZE nLen = hb_itemGetCLen( pText ), u;
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
{
if( HB_ISUPPER( pszText[ u ] ) )
{
@@ -103,8 +103,8 @@ HB_FUNC( HB_ASCIILOWER )
{
pszBuff[ u ] = HB_TOLOWER( pszBuff[ u ] );
}
while( ++u < ulLen );
hb_retclen_buffer( hb_strUpper( pszBuff, ulLen ), ulLen );
while( ++u < nLen );
hb_retclen_buffer( hb_strUpper( pszBuff, nLen ), nLen );
return;
}
}

View File

@@ -76,9 +76,9 @@ HB_FUNC( HB_BLOWFISHENCRYPT )
if( pData )
{
HB_SIZE ulLen = hb_itemGetCLen( pData ), ulSize;
HB_SIZE nLen = hb_itemGetCLen( pData ), nSize;
if( ulLen )
if( nLen )
{
char * pszData;
HB_BLOWFISH * bf = ( HB_BLOWFISH * ) hb_parc( 1 );
@@ -87,23 +87,23 @@ HB_FUNC( HB_BLOWFISHENCRYPT )
/* In raw mode passed string is padded to 8 bytes with '\0'
* otherwise ANSI X.923 padding is using
*/
ulSize = ( fRaw ? ( ( ulLen + 7 ) >> 3 ) :
( ( ulLen >> 3 ) + 1 ) ) << 3;
pszData = ( char * ) hb_xgrab( ulSize + 1 );
memcpy( pszData, hb_itemGetCPtr( pData ), ulLen );
memset( pszData + ulLen, '\0', ulSize - ulLen );
nSize = ( fRaw ? ( ( nLen + 7 ) >> 3 ) :
( ( nLen >> 3 ) + 1 ) ) << 3;
pszData = ( char * ) hb_xgrab( nSize + 1 );
memcpy( pszData, hb_itemGetCPtr( pData ), nLen );
memset( pszData + nLen, '\0', nSize - nLen );
if( !fRaw )
pszData[ ulSize - 1 ] = ( char ) ( ulSize - ulLen );
for( ulLen = 0; ulLen < ulSize; ulLen += 8 )
pszData[ nSize - 1 ] = ( char ) ( nSize - nLen );
for( nLen = 0; nLen < nSize; nLen += 8 )
{
HB_U32 xl, xr;
xl = HB_GET_BE_UINT32( &pszData[ ulLen ] );
xr = HB_GET_BE_UINT32( &pszData[ ulLen + 4 ] );
xl = HB_GET_BE_UINT32( &pszData[ nLen ] );
xr = HB_GET_BE_UINT32( &pszData[ nLen + 4 ] );
hb_blowfishEncrypt( bf, &xl, &xr );
HB_PUT_BE_UINT32( &pszData[ ulLen ], xl );
HB_PUT_BE_UINT32( &pszData[ ulLen + 4 ], xr );
HB_PUT_BE_UINT32( &pszData[ nLen ], xl );
HB_PUT_BE_UINT32( &pszData[ nLen + 4 ], xr );
}
hb_retclen_buffer( pszData, ulSize );
hb_retclen_buffer( pszData, nSize );
}
else
hb_retc_null();
@@ -119,37 +119,37 @@ HB_FUNC( HB_BLOWFISHDECRYPT )
if( pData )
{
HB_SIZE ulSize = hb_itemGetCLen( pData ), ulLen;
HB_SIZE nSize = hb_itemGetCLen( pData ), nLen;
if( ulSize >= 8 && ( ulSize & 0x07 ) == 0 )
if( nSize >= 8 && ( nSize & 0x07 ) == 0 )
{
const char * pszSource;
char * pszData;
HB_BLOWFISH * bf = ( HB_BLOWFISH * ) hb_parc( 1 );
HB_BOOL fRaw = hb_parl( 3 );
pszData = ( char * ) hb_xgrab( ulSize + ( fRaw ? 1 : 0 ) );
pszData = ( char * ) hb_xgrab( nSize + ( fRaw ? 1 : 0 ) );
pszSource = hb_itemGetCPtr( pData );
for( ulLen = 0; ulLen < ulSize; ulLen += 8 )
for( nLen = 0; nLen < nSize; nLen += 8 )
{
HB_U32 xl, xr;
xl = HB_GET_BE_UINT32( &pszSource[ ulLen ] );
xr = HB_GET_BE_UINT32( &pszSource[ ulLen + 4 ] );
xl = HB_GET_BE_UINT32( &pszSource[ nLen ] );
xr = HB_GET_BE_UINT32( &pszSource[ nLen + 4 ] );
hb_blowfishDecrypt( bf, &xl, &xr );
HB_PUT_BE_UINT32( &pszData[ ulLen ], xl );
HB_PUT_BE_UINT32( &pszData[ ulLen + 4 ], xr );
HB_PUT_BE_UINT32( &pszData[ nLen ], xl );
HB_PUT_BE_UINT32( &pszData[ nLen + 4 ], xr );
}
if( !fRaw )
{
ulSize = ( unsigned char ) pszData[ ulSize - 1 ];
ulLen -= ( ( ulSize - 1 ) & ~0x07 ) == 0 ? ulSize : ulLen;
nSize = ( unsigned char ) pszData[ nSize - 1 ];
nLen -= ( ( nSize - 1 ) & ~0x07 ) == 0 ? nSize : nLen;
}
if( ulLen )
hb_retclen_buffer( pszData, ulLen );
if( nLen )
hb_retclen_buffer( pszData, nLen );
else
hb_xfree( pszData );
}
else if( ulSize == 0 )
else if( nSize == 0 )
hb_retc_null();
}
}

View File

@@ -210,17 +210,17 @@ HB_FUNC( HB_COMRECV )
{
PHB_ITEM pItem = hb_param( 2, HB_IT_STRING );
char * pBuffer;
HB_SIZE iLen;
HB_SIZE nLen;
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &iLen ) )
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &nLen ) )
{
if( HB_ISNUM( 3 ) )
{
long lRead = hb_parnl( 3 );
if( lRead >= 0 && lRead < ( long ) iLen )
iLen = lRead;
if( lRead >= 0 && lRead < ( long ) nLen )
nLen = lRead;
}
hb_retnl( hb_comRecv( hb_parni( 1 ), pBuffer, ( long ) iLen, hb_parnint( 4 ) ) );
hb_retnl( hb_comRecv( hb_parni( 1 ), pBuffer, ( long ) nLen, hb_parnint( 4 ) ) );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );

View File

@@ -116,7 +116,7 @@ static void hb_gt_def_BaseInit( PHB_GT_BASE pGT )
static void * hb_gt_def_New( PHB_GT pGT )
{
HB_SIZE ulSize, ulIndex;
HB_SIZE nSize, nIndex;
HB_USHORT usChar;
int iColor;
HB_BYTE bAttr;
@@ -125,27 +125,27 @@ static void * hb_gt_def_New( PHB_GT pGT )
hb_gt_def_BaseInit( pGT );
HB_GTSELF_GETSIZE( pGT, &pGT->iHeight, &pGT->iWidth );
ulSize = ( HB_SIZE ) pGT->iHeight * pGT->iWidth;
nSize = ( HB_SIZE ) pGT->iHeight * pGT->iWidth;
pGT->screenBuffer =
( PHB_SCREENCELL ) hb_xgrab( sizeof( HB_SCREENCELL ) * ulSize );
( PHB_SCREENCELL ) hb_xgrab( sizeof( HB_SCREENCELL ) * nSize );
pGT->prevBuffer =
( PHB_SCREENCELL ) hb_xgrab( sizeof( HB_SCREENCELL ) * ulSize );
( PHB_SCREENCELL ) hb_xgrab( sizeof( HB_SCREENCELL ) * nSize );
pGT->pLines = ( HB_BOOL * ) hb_xgrab( sizeof( HB_BOOL ) * pGT->iHeight );
memset( pGT->prevBuffer, 0, sizeof( HB_SCREENCELL ) * ulSize );
memset( pGT->prevBuffer, 0, sizeof( HB_SCREENCELL ) * nSize );
for( i = 0; i < pGT->iHeight; ++i )
pGT->pLines[ i ] = HB_TRUE;
usChar = HB_GTSELF_GETCLEARCHAR( pGT );
iColor = HB_GTSELF_GETCLEARCOLOR( pGT );
bAttr = 0;
for( ulIndex = 0; ulIndex < ulSize; ++ulIndex )
for( nIndex = 0; nIndex < nSize; ++nIndex )
{
pGT->screenBuffer[ ulIndex ].c.usChar = usChar;
pGT->screenBuffer[ ulIndex ].c.bColor = ( HB_BYTE ) iColor;
pGT->screenBuffer[ ulIndex ].c.bAttr = bAttr;
pGT->prevBuffer[ ulIndex ].c.bAttr = HB_GT_ATTR_REFRESH;
pGT->screenBuffer[ nIndex ].c.usChar = usChar;
pGT->screenBuffer[ nIndex ].c.bColor = ( HB_BYTE ) iColor;
pGT->screenBuffer[ nIndex ].c.bAttr = bAttr;
pGT->prevBuffer[ nIndex ].c.bAttr = HB_GT_ATTR_REFRESH;
}
return pGT;
@@ -678,47 +678,47 @@ static HB_BOOL hb_gt_def_Resume( PHB_GT pGT )
return HB_GTSELF_POSTEXT( pGT );
}
static void hb_gt_def_OutStd( PHB_GT pGT, const char * szStr, HB_SIZE ulLen )
static void hb_gt_def_OutStd( PHB_GT pGT, const char * szStr, HB_SIZE nLen )
{
if( ulLen )
if( nLen )
{
if( pGT->fStdOutCon )
HB_GTSELF_WRITECON( pGT, szStr, ulLen );
HB_GTSELF_WRITECON( pGT, szStr, nLen );
else
{
HB_GTSELF_PREEXT( pGT );
if( pGT->fDispTrans )
{
char * szStrBuff = hb_cdpnDup( szStr, &ulLen,
char * szStrBuff = hb_cdpnDup( szStr, &nLen,
pGT->cdpHost, pGT->cdpTerm );
hb_fsWriteLarge( pGT->hStdErr, szStrBuff, ulLen );
hb_fsWriteLarge( pGT->hStdErr, szStrBuff, nLen );
hb_xfree( szStrBuff );
}
else
hb_fsWriteLarge( pGT->hStdOut, szStr, ulLen );
hb_fsWriteLarge( pGT->hStdOut, szStr, nLen );
HB_GTSELF_POSTEXT( pGT );
}
}
}
static void hb_gt_def_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE ulLen )
static void hb_gt_def_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE nLen )
{
if( ulLen )
if( nLen )
{
if( pGT->fStdErrCon )
HB_GTSELF_WRITECON( pGT, szStr, ulLen );
HB_GTSELF_WRITECON( pGT, szStr, nLen );
else
{
HB_GTSELF_PREEXT( pGT );
if( pGT->fDispTrans )
{
char * szStrBuff = hb_cdpnDup( szStr, &ulLen,
char * szStrBuff = hb_cdpnDup( szStr, &nLen,
pGT->cdpHost, pGT->cdpTerm );
hb_fsWriteLarge( pGT->hStdErr, szStrBuff, ulLen );
hb_fsWriteLarge( pGT->hStdErr, szStrBuff, nLen );
hb_xfree( szStrBuff );
}
else
hb_fsWriteLarge( pGT->hStdErr, szStr, ulLen );
hb_fsWriteLarge( pGT->hStdErr, szStr, nLen );
HB_GTSELF_POSTEXT( pGT );
}
}
@@ -780,9 +780,9 @@ static HB_BOOL hb_gt_def_PutChar( PHB_GT pGT, int iRow, int iCol,
return HB_FALSE;
}
static void hb_gt_def_PutText( PHB_GT pGT, int iRow, int iCol, int iColor, const char * szText, HB_SIZE ulLen )
static void hb_gt_def_PutText( PHB_GT pGT, int iRow, int iCol, int iColor, const char * szText, HB_SIZE nLen )
{
while( ulLen-- )
while( nLen-- )
{
if( !HB_GTSELF_PUTCHAR( pGT, iRow, iCol, iColor, 0, *szText++ ) )
break;
@@ -791,17 +791,17 @@ static void hb_gt_def_PutText( PHB_GT pGT, int iRow, int iCol, int iColor, const
}
static void hb_gt_def_Replicate( PHB_GT pGT, int iRow, int iCol, int iColor,
HB_BYTE bAttr, HB_USHORT usChar, HB_SIZE ulLen )
HB_BYTE bAttr, HB_USHORT usChar, HB_SIZE nLen )
{
if( iCol < 0 )
{
if( ulLen < ( HB_SIZE ) -iCol )
ulLen = 0;
if( nLen < ( HB_SIZE ) -iCol )
nLen = 0;
else
ulLen += iCol;
nLen += iCol;
iCol = 0;
}
while( ulLen-- )
while( nLen-- )
{
if( !HB_GTSELF_PUTCHAR( pGT, iRow, iCol, iColor, bAttr, usChar ) )
break;
@@ -809,29 +809,29 @@ static void hb_gt_def_Replicate( PHB_GT pGT, int iRow, int iCol, int iColor,
}
}
static void hb_gt_def_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * szText, HB_SIZE ulLength )
static void hb_gt_def_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * szText, HB_SIZE nLength )
{
int iMaxCol = HB_GTSELF_MAXCOL( pGT );
/* Truncate the text if the cursor will end up off the right edge */
HB_GTSELF_PUTTEXT( pGT, iRow, iCol, HB_GTSELF_GETCOLOR( pGT ), szText,
HB_MIN( ulLength, ( HB_SIZE ) ( iMaxCol - iCol + 1 ) ) );
HB_MIN( nLength, ( HB_SIZE ) ( iMaxCol - iCol + 1 ) ) );
/* Finally, save the new cursor position, even if off-screen */
HB_GTSELF_SETPOS( pGT, iRow, iCol + ( int ) ulLength );
HB_GTSELF_SETPOS( pGT, iRow, iCol + ( int ) nLength );
}
static void hb_gt_def_Write( PHB_GT pGT, const char * szText, HB_SIZE ulLength )
static void hb_gt_def_Write( PHB_GT pGT, const char * szText, HB_SIZE nLength )
{
int iRow, iCol;
HB_GTSELF_GETPOS( pGT, &iRow, &iCol );
HB_GTSELF_WRITEAT( pGT, iRow, iCol, szText, ulLength );
HB_GTSELF_WRITEAT( pGT, iRow, iCol, szText, nLength );
}
#define WRITECON_BUFFER_SIZE 512
static void hb_gt_def_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLength )
static void hb_gt_def_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE nLength )
{
int iLen = 0;
HB_BOOL bDisp = HB_FALSE;
@@ -857,7 +857,7 @@ static void hb_gt_def_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLengt
HB_GTSELF_SETPOS( pGT, iRow, iCol );
}
while( ulLength-- )
while( nLength-- )
{
char ch = *szText++;
@@ -905,7 +905,7 @@ static void hb_gt_def_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLengt
if( iRow >= 0 ) ++iRow;
bNewLine = HB_TRUE;
++szText;
--ulLength;
--nLength;
}
bDisp = HB_TRUE;
break;
@@ -933,7 +933,7 @@ static void hb_gt_def_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLengt
if( iLen >= WRITECON_BUFFER_SIZE ) bDisp = HB_TRUE;
}
if( bDisp || ulLength == 0 )
if( bDisp || nLength == 0 )
{
if( iLen )
HB_GTSELF_WRITE( pGT, szString, iLen );
@@ -1139,10 +1139,10 @@ static void hb_gt_def_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int
if( ( iRows || iCols ) && iColSize >= 0 && ( iBottom - iTop >= iRows ) )
{
HB_SIZE ulSize = HB_GTSELF_RECTSIZE( pGT, iTop, iColOld, iTop, iColOld + iColSize );
HB_SIZE nSize = HB_GTSELF_RECTSIZE( pGT, iTop, iColOld, iTop, iColOld + iColSize );
if( ulSize )
pBuffer = hb_xgrab( ulSize );
if( nSize )
pBuffer = hb_xgrab( nSize );
}
while( iTop <= iBottom )
@@ -1546,7 +1546,7 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_GETWIN: /* save screen buffer, cursor shape and position */
{
int iRow, iCol;
HB_SIZE ulSize;
HB_SIZE nSize;
if( !pInfo->pResult )
pInfo->pResult = hb_itemNew( NULL );
@@ -1562,12 +1562,12 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
hb_arraySetNI( pInfo->pResult, 5, iRow );
hb_arraySetNI( pInfo->pResult, 6, iCol );
ulSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRow, iCol );
if( ulSize )
nSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRow, iCol );
if( nSize )
{
void * pBuffer = hb_xgrab( ulSize + 1 );
void * pBuffer = hb_xgrab( nSize + 1 );
HB_GTSELF_SAVE( pGT, 0, 0, iRow, iCol, pBuffer );
hb_arraySetCLPtr( pInfo->pResult, 7, ( char * ) pBuffer, ulSize );
hb_arraySetCLPtr( pInfo->pResult, 7, ( char * ) pBuffer, nSize );
}
break;
}
@@ -1601,10 +1601,10 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
/* get Clipboard value */
char * pszClipData;
HB_SIZE ulLen;
HB_SIZE nLen;
if( hb_gt_getClipboard( &pszClipData, &ulLen ) )
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult, pszClipData, ulLen );
if( hb_gt_getClipboard( &pszClipData, &nLen ) )
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult, pszClipData, nLen );
else
pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL );
}
@@ -1668,7 +1668,7 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
if( HB_IS_STRING( pMessage ) && iOptions > 0 )
{
const char * szMessage = hb_itemGetCPtr( pMessage );
HB_UINT ulLen = ( HB_UINT ) hb_itemGetCLen( pMessage );
HB_UINT nLen = ( HB_UINT ) hb_itemGetCLen( pMessage );
HB_BOOL fScreen = HB_FALSE, fKeyBoard = HB_FALSE;
int iKey = 0, i, iDspCount, iStyle, iRows, iCols,
iRow, iCol, iTop, iLeft, iBottom, iRight, iMnuCol, iPos, iClr;
@@ -1702,9 +1702,9 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
ulDefWidth = ( ulMaxWidth * 3 ) >> 2;
if( ulDefWidth == 0 )
ulDefWidth = 1;
szMsgDsp = ( char * ) hb_xgrab( ulLen + ( ulLen / ulDefWidth ) + 1 );
szMsgDsp = ( char * ) hb_xgrab( nLen + ( nLen / ulDefWidth ) + 1 );
while( ul < ulLen )
while( ul < nLen )
{
if( szMessage[ ul ] == '\n' )
{
@@ -1809,10 +1809,10 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
HB_GTSELF_GETPOS( pGT, &iRow, &iCol );
iStyle = HB_GTSELF_GETCURSORSTYLE( pGT );
HB_GTSELF_SETCURSORSTYLE( pGT, SC_NONE );
ulLen = HB_GTSELF_RECTSIZE( pGT, iTop, iLeft, iBottom, iRight );
if( ulLen )
nLen = HB_GTSELF_RECTSIZE( pGT, iTop, iLeft, iBottom, iRight );
if( nLen )
{
pBuffer = hb_xgrab( ulLen );
pBuffer = hb_xgrab( nLen );
HB_GTSELF_SAVE( pGT, iTop, iLeft, iBottom, iRight, pBuffer );
}
HB_GTSELF_BOXS( pGT, iTop, iLeft, iBottom, iRight, NULL, iClrNorm );
@@ -1825,11 +1825,11 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
{
if( ul > ulLast )
{
ulLen = ul - ulLast;
if( ulLen > ulWidth )
ulLen = ulWidth;
HB_GTSELF_PUTTEXT( pGT, i, iLeft + ( ( ulWidth - ulLen + 1 ) >> 1 ) + 2,
iClrNorm, szMsgDsp + ulLast, ulLen );
nLen = ul - ulLast;
if( nLen > ulWidth )
nLen = ulWidth;
HB_GTSELF_PUTTEXT( pGT, i, iLeft + ( ( ulWidth - nLen + 1 ) >> 1 ) + 2,
iClrNorm, szMsgDsp + ulLast, nLen );
}
ulLast = ul + 1;
if( ++i >= iBottom - 1 )
@@ -1838,11 +1838,11 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
}
if( ul > ulLast && i < iBottom - 1 )
{
ulLen = ul - ulLast;
if( ulLen > ulWidth )
ulLen = ulWidth;
HB_GTSELF_PUTTEXT( pGT, i, iLeft + ( ( ulWidth - ulLen + 1 ) >> 1 ) + 2,
iClrNorm, szMsgDsp + ulLast, ulLen );
nLen = ul - ulLast;
if( nLen > ulWidth )
nLen = ulWidth;
HB_GTSELF_PUTTEXT( pGT, i, iLeft + ( ( ulWidth - nLen + 1 ) >> 1 ) + 2,
iClrNorm, szMsgDsp + ulLast, nLen );
}
iPos = 1;
@@ -1853,12 +1853,12 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
for( i = 1; i <= iOptions; ++i )
{
iClr = i == iPos ? iClrHigh : iClrNorm;
ulLen = ( HB_UINT ) hb_arrayGetCLen( pOptions, i );
nLen = ( HB_UINT ) hb_arrayGetCLen( pOptions, i );
HB_GTSELF_PUTTEXT( pGT, iBottom - 1, iMnuCol, iClr, " ", 1 );
HB_GTSELF_PUTTEXT( pGT, iBottom - 1, iMnuCol + 1, iClr,
hb_arrayGetCPtr( pOptions, i ), ulLen );
HB_GTSELF_PUTTEXT( pGT, iBottom - 1, iMnuCol + 1 + ulLen, iClr, " ", 1 );
iMnuCol += ulLen + 4;
hb_arrayGetCPtr( pOptions, i ), nLen );
HB_GTSELF_PUTTEXT( pGT, iBottom - 1, iMnuCol + 1 + nLen, iClr, " ", 1 );
iMnuCol += nLen + 4;
}
while( HB_GTSELF_DISPCOUNT( pGT ) )
HB_GTSELF_DISPEND( pGT );
@@ -1894,13 +1894,13 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
iMnuCol = iLeft + ( ( ulWidth - ulCurrWidth ) >> 1 ) + 4;
for( i = 1; i <= iOptions; ++i )
{
ulLen = ( HB_UINT ) hb_arrayGetCLen( pOptions, i );
if( iMCol >= iMnuCol && iMCol < iMnuCol + ( int ) ulLen )
nLen = ( HB_UINT ) hb_arrayGetCLen( pOptions, i );
if( iMCol >= iMnuCol && iMCol < iMnuCol + ( int ) nLen )
{
iRet = i;
break;
}
iMnuCol += ulLen + 4;
iMnuCol += nLen + 4;
}
}
}
@@ -1934,21 +1934,21 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions,
}
else
{
HB_SIZE ul, ulStart = 0;
HB_SIZE ul, nStart = 0;
const char *szEol = hb_conNewLine();
for( ul = 0; ul < ulLen; ++ul )
for( ul = 0; ul < nLen; ++ul )
{
if( szMessage[ ul ] == '\n' )
{
if( ul > ulStart )
HB_GTSELF_WRITECON( pGT, szMessage + ulStart, ul - ulStart );
if( ul > nStart )
HB_GTSELF_WRITECON( pGT, szMessage + nStart, ul - nStart );
HB_GTSELF_WRITECON( pGT, szEol, strlen( szEol ) );
ulStart = ul + 1;
nStart = ul + 1;
}
}
if( ul > ulStart )
HB_GTSELF_WRITECON( pGT, szMessage + ulStart, ul - ulStart );
if( ul > nStart )
HB_GTSELF_WRITECON( pGT, szMessage + nStart, ul - nStart );
HB_GTSELF_WRITECON( pGT, " (", 2 );
for( i = 1; i <= iOptions; ++i )
{
@@ -2029,37 +2029,37 @@ static HB_BOOL hb_gt_def_Resize( PHB_GT pGT, int iRows, int iCols )
if( pGT->iHeight != iRows || pGT->iWidth != iCols )
{
void * pBuffer = NULL;
HB_SIZE ulLen = ( HB_SIZE ) iRows * iCols, ulIndex;
HB_SIZE ulSize;
HB_SIZE nLen = ( HB_SIZE ) iRows * iCols, nIndex;
HB_SIZE nSize;
int i;
ulSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRows - 1, iCols - 1 );
if( ulSize )
nSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRows - 1, iCols - 1 );
if( nSize )
{
pBuffer = hb_xgrab( ulSize );
pBuffer = hb_xgrab( nSize );
HB_GTSELF_SAVE( pGT, 0, 0, iRows - 1, iCols - 1, pBuffer );
}
pGT->screenBuffer =
( PHB_SCREENCELL ) hb_xrealloc( pGT->screenBuffer,
sizeof( HB_SCREENCELL ) * ulLen );
sizeof( HB_SCREENCELL ) * nLen );
pGT->prevBuffer =
( PHB_SCREENCELL ) hb_xrealloc( pGT->prevBuffer,
sizeof( HB_SCREENCELL ) * ulLen );
sizeof( HB_SCREENCELL ) * nLen );
pGT->pLines =
( HB_BOOL * ) hb_xrealloc( pGT->pLines,
sizeof( HB_BOOL ) * iRows );
memset( pGT->screenBuffer, 0, sizeof( HB_SCREENCELL ) * ulLen );
memset( pGT->prevBuffer, 0, sizeof( HB_SCREENCELL ) * ulLen );
memset( pGT->screenBuffer, 0, sizeof( HB_SCREENCELL ) * nLen );
memset( pGT->prevBuffer, 0, sizeof( HB_SCREENCELL ) * nLen );
for( i = 0; i < iRows; ++i )
pGT->pLines[ i ] = HB_TRUE;
for( ulIndex = 0; ulIndex < ulLen; ++ulIndex )
for( nIndex = 0; nIndex < nLen; ++nIndex )
{
pGT->screenBuffer[ ulIndex ].c.usChar = HB_GTSELF_GETCLEARCHAR( pGT );
pGT->screenBuffer[ ulIndex ].c.bColor = ( HB_BYTE ) HB_GTSELF_GETCLEARCOLOR( pGT );
pGT->screenBuffer[ ulIndex ].c.bAttr = 0x00;
pGT->prevBuffer[ ulIndex ].c.bAttr = HB_GT_ATTR_REFRESH;
pGT->screenBuffer[ nIndex ].c.usChar = HB_GTSELF_GETCLEARCHAR( pGT );
pGT->screenBuffer[ nIndex ].c.bColor = ( HB_BYTE ) HB_GTSELF_GETCLEARCOLOR( pGT );
pGT->screenBuffer[ nIndex ].c.bAttr = 0x00;
pGT->prevBuffer[ nIndex ].c.bAttr = HB_GT_ATTR_REFRESH;
}
pGT->iHeight = iRows;
@@ -2072,7 +2072,7 @@ static HB_BOOL hb_gt_def_Resize( PHB_GT pGT, int iRows, int iCols )
pGT->fRefresh = HB_TRUE;
if( ulSize )
if( nSize )
{
HB_GTSELF_REST( pGT, 0, 0, iRows - 1, iCols - 1, pBuffer );
hb_xfree( pBuffer );
@@ -2556,9 +2556,9 @@ static int hb_gt_def_InkeySetLast( PHB_GT pGT, int iKey )
}
/* Set text into inkey buffer */
static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE ulLen )
static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u)", pGT, szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u)", pGT, szText, nLen));
if( pGT->StrBuffer )
{
@@ -2566,18 +2566,18 @@ static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE ulL
pGT->StrBuffer = NULL;
}
if( szText && ulLen )
if( szText && nLen )
{
pGT->StrBuffer = ( HB_BYTE * ) hb_xgrab( ulLen );
memcpy( pGT->StrBuffer, szText, ulLen );
pGT->StrBufferSize = ulLen;
pGT->StrBuffer = ( HB_BYTE * ) hb_xgrab( nLen );
memcpy( pGT->StrBuffer, szText, nLen );
pGT->StrBufferSize = nLen;
pGT->StrBufferPos = 0;
do
{
if( pGT->StrBuffer[ --ulLen ] == ';' )
pGT->StrBuffer[ ulLen ] = HB_CHAR_CR;
if( pGT->StrBuffer[ --nLen ] == ';' )
pGT->StrBuffer[ nLen ] = HB_CHAR_CR;
}
while( ulLen );
while( nLen );
}
}

View File

@@ -130,12 +130,12 @@ HB_FUNC( HB_NUMTOHEX )
HB_FUNC( HB_STRTOHEX )
{
const char * szStr = hb_parc( 1 ), * szSep = "";
HB_SIZE ulStr, ulSep = 0;
HB_SIZE nStr, nSep = 0;
if( hb_pcount() > 1 )
{
szSep = hb_parc( 2 );
ulSep = hb_parclen( 2 );
nSep = hb_parclen( 2 );
}
if( !szStr || !szSep )
@@ -144,13 +144,13 @@ HB_FUNC( HB_STRTOHEX )
return;
}
ulStr = hb_parclen( 1 );
if( ulStr )
nStr = hb_parclen( 1 );
if( nStr )
{
HB_SIZE ulDest = ( ulStr << 1 ) + ( ulStr - 1 ) * ulSep;
HB_SIZE nDest = ( nStr << 1 ) + ( nStr - 1 ) * nSep;
char * szDest, * szPtr;
szPtr = szDest = ( char * ) hb_xgrab( ulDest + 1 );
szPtr = szDest = ( char * ) hb_xgrab( nDest + 1 );
do
{
HB_UCHAR uc = ( HB_UCHAR ) *szStr++, ud;
@@ -158,14 +158,14 @@ HB_FUNC( HB_STRTOHEX )
*szPtr++ = ud + ( ud < 10 ? '0' : 'A' - 10 );
ud = uc & 0x0F;
*szPtr++ = ud + ( ud < 10 ? '0' : 'A' - 10 );
if( --ulStr && ulSep )
if( --nStr && nSep )
{
memcpy( szPtr, szSep, ulSep );
szPtr += ulSep;
memcpy( szPtr, szSep, nSep );
szPtr += nSep;
}
}
while( ulStr );
hb_retclen_buffer( szDest, ulDest );
while( nStr );
hb_retclen_buffer( szDest, nDest );
}
else
hb_retc_null();
@@ -174,7 +174,7 @@ HB_FUNC( HB_STRTOHEX )
HB_FUNC( HB_HEXTOSTR )
{
const char * szStr = hb_parc( 1 );
HB_SIZE ulStr;
HB_SIZE nStr;
if( !szStr )
{
@@ -182,32 +182,32 @@ HB_FUNC( HB_HEXTOSTR )
return;
}
ulStr = hb_parclen( 1 );
if( ulStr > 1 )
nStr = hb_parclen( 1 );
if( nStr > 1 )
{
HB_SIZE ulDest, ul;
HB_SIZE nDest, ul;
const char * szPtr;
char * szDest;
szPtr = szStr;
ul = ulStr;
ulDest = 0;
ul = nStr;
nDest = 0;
do
{
char c = *szPtr++;
if( ( c >= '0' && c <= '9' ) ||
( c >= 'A' && c <= 'F' ) ||
( c >= 'a' && c <= 'f' ) )
++ulDest;
++nDest;
}
while( --ul );
ulDest >>= 1;
if( ulDest )
nDest >>= 1;
if( nDest )
{
int iVal = 0x10;
szDest = ( char * ) hb_xgrab( ulDest + 1 );
szDest = ( char * ) hb_xgrab( nDest + 1 );
/* ul = 0; see above stop condition */
do
{
@@ -228,9 +228,9 @@ HB_FUNC( HB_HEXTOSTR )
}
iVal <<= 4;
}
while( --ulStr );
while( --nStr );
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
return;
}
}

View File

@@ -279,12 +279,12 @@ static void hb_i18n_setitem( PHB_ITEM pHash, const char * szKey, const char * sz
static PHB_ITEM hb_i18n_pluralexp_compile( PHB_ITEM pExp )
{
HB_SIZE ulLen = hb_itemGetCLen( pExp );
HB_SIZE nLen = hb_itemGetCLen( pExp );
PHB_ITEM pBlock = NULL;
if( ulLen > 0 )
if( nLen > 0 )
{
char * szMacro = ( char * ) hb_xgrab( ulLen + 6 );
char * szMacro = ( char * ) hb_xgrab( nLen + 6 );
const char * szType;
PHB_ITEM pMacro;
@@ -292,10 +292,10 @@ static PHB_ITEM hb_i18n_pluralexp_compile( PHB_ITEM pExp )
szMacro[ 1 ] = '|';
szMacro[ 2 ] = 'n';
szMacro[ 3 ] = '|';
memcpy( &szMacro[ 4 ], hb_itemGetCPtr( pExp ), ulLen );
szMacro[ 4 + ulLen ] = '}';
szMacro[ 5 + ulLen ] = '\0';
pMacro = hb_itemPutCLPtr( NULL, szMacro, ulLen );
memcpy( &szMacro[ 4 ], hb_itemGetCPtr( pExp ), nLen );
szMacro[ 4 + nLen ] = '}';
szMacro[ 5 + nLen ] = '\0';
pMacro = hb_itemPutCLPtr( NULL, szMacro, nLen );
szType = hb_macroGetType( pMacro );
if( *szType == 'B' )
{
@@ -444,20 +444,20 @@ static PHB_ITEM hb_i18n_serialize( PHB_I18N_TRANS pI18N )
{
if( pI18N )
{
HB_SIZE ulSize;
HB_SIZE nSize;
HB_U32 ulCRC;
char * pBuffer = hb_itemSerialize( pI18N->table, HB_FALSE, &ulSize );
char * pBuffer = hb_itemSerialize( pI18N->table, HB_FALSE, &nSize );
char * pI18Nbuffer;
PHB_ITEM pKey, pValue;
ulCRC = hb_crc32( 0, pBuffer, ulSize );
pI18Nbuffer = ( char * ) memset( hb_xgrab( ulSize + HB_I18N_HEADER_SIZE + 1 ),
ulCRC = hb_crc32( 0, pBuffer, nSize );
pI18Nbuffer = ( char * ) memset( hb_xgrab( nSize + HB_I18N_HEADER_SIZE + 1 ),
0, HB_I18N_HEADER_SIZE );
memcpy( pI18Nbuffer + HB_I18N_HEADER_SIZE, pBuffer, ulSize );
memcpy( pI18Nbuffer + HB_I18N_HEADER_SIZE, pBuffer, nSize );
hb_xfree( pBuffer );
memcpy( pI18Nbuffer, s_signature, HB_I18N_SIG_SIZE );
HB_PUT_LE_UINT32( &pI18Nbuffer[ HB_I18N_SIZE_OFFSET ], ulSize );
HB_PUT_LE_UINT32( &pI18Nbuffer[ HB_I18N_SIZE_OFFSET ], nSize );
HB_PUT_LE_UINT32( &pI18Nbuffer[ HB_I18N_CRC_OFFSET ], ulCRC );
pKey = hb_itemPutCConst( NULL, "DESCRIPTION" );
@@ -466,23 +466,23 @@ static PHB_ITEM hb_i18n_serialize( PHB_I18N_TRANS pI18N )
hb_strncpy( &pI18Nbuffer[ HB_I18N_TXT_OFFSET ],
hb_itemGetCPtr( pValue ), HB_I18N_TXT_SIZE );
return hb_itemPutCLPtr( pKey, pI18Nbuffer, ulSize + HB_I18N_HEADER_SIZE );
return hb_itemPutCLPtr( pKey, pI18Nbuffer, nSize + HB_I18N_HEADER_SIZE );
}
return NULL;
}
static HB_BOOL hb_i18n_headercheck( const char * pBuffer, HB_SIZE ulLen )
static HB_BOOL hb_i18n_headercheck( const char * pBuffer, HB_SIZE nLen )
{
if( ulLen < HB_I18N_HEADER_SIZE )
if( nLen < HB_I18N_HEADER_SIZE )
return HB_FALSE;
ulLen -= HB_I18N_HEADER_SIZE;
nLen -= HB_I18N_HEADER_SIZE;
return memcmp( pBuffer, s_signature, HB_I18N_SIG_SIZE ) == 0 &&
( ulLen == 0 ||
( HB_GET_LE_UINT32( &pBuffer[ HB_I18N_SIZE_OFFSET ] ) == ulLen &&
( nLen == 0 ||
( HB_GET_LE_UINT32( &pBuffer[ HB_I18N_SIZE_OFFSET ] ) == nLen &&
HB_GET_LE_UINT32( &pBuffer[ HB_I18N_CRC_OFFSET ] ) ==
hb_crc32( 0, pBuffer + HB_I18N_HEADER_SIZE, ulLen ) ) );
hb_crc32( 0, pBuffer + HB_I18N_HEADER_SIZE, nLen ) ) );
}
static PHB_I18N_TRANS hb_i18n_deserialize( PHB_ITEM pItem )
@@ -491,16 +491,16 @@ static PHB_I18N_TRANS hb_i18n_deserialize( PHB_ITEM pItem )
if( pItem && HB_IS_STRING( pItem ) )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
HB_SIZE nLen = hb_itemGetCLen( pItem );
const char * pBuffer = hb_itemGetCPtr( pItem );
if( ulLen > HB_I18N_HEADER_SIZE && hb_i18n_headercheck( pBuffer, ulLen ) )
if( nLen > HB_I18N_HEADER_SIZE && hb_i18n_headercheck( pBuffer, nLen ) )
{
PHB_ITEM pTable;
pBuffer += HB_I18N_HEADER_SIZE;
ulLen -= HB_I18N_HEADER_SIZE;
pTable = hb_itemDeserialize( &pBuffer, &ulLen );
nLen -= HB_I18N_HEADER_SIZE;
pTable = hb_itemDeserialize( &pBuffer, &nLen );
if( pTable )
{
pI18N = hb_i18n_initialize( pTable );
@@ -653,12 +653,12 @@ static HB_BOOL hb_i18n_setpluralform( PHB_I18N_TRANS pI18N, PHB_ITEM pForm,
static void hb_i18n_transitm( PHB_ITEM pText, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
HB_SIZE ulLen = hb_itemGetCLen( pText );
if( ulLen > 0 )
HB_SIZE nLen = hb_itemGetCLen( pText );
if( nLen > 0 )
{
char * szValue = hb_cdpnDup( hb_itemGetCPtr( pText ), &ulLen,
char * szValue = hb_cdpnDup( hb_itemGetCPtr( pText ), &nLen,
cdpIn, cdpOut );
hb_itemPutCLPtr( pText, szValue, ulLen );
hb_itemPutCLPtr( pText, szValue, nLen );
}
}
@@ -679,13 +679,13 @@ static const char * hb_i18n_setcodepage( PHB_I18N_TRANS pI18N,
{
if( fTranslate && cdpage )
{
HB_SIZE ulHashLen = hb_hashLen( pI18N->context_table ), ul;
for( ul = 1; ul <= ulHashLen; ++ul )
HB_SIZE nHashLen = hb_hashLen( pI18N->context_table ), ul;
for( ul = 1; ul <= nHashLen; ++ul )
{
PHB_ITEM pContext = hb_hashGetValueAt( pI18N->context_table, ul );
HB_SIZE ulCount = hb_hashLen( pContext ), u;
HB_SIZE nCount = hb_hashLen( pContext ), u;
for( u = 1; u <= ulCount; ++u )
for( u = 1; u <= nCount; ++u )
{
if( fBase )
{
@@ -701,8 +701,8 @@ static const char * hb_i18n_setcodepage( PHB_I18N_TRANS pI18N,
}
else if( HB_IS_ARRAY( pResult ) )
{
HB_SIZE ulTrans = hb_arrayLen( pResult ), u2;
for( u2 = 1; u2 <= ulTrans; ++u2 )
HB_SIZE nTrans = hb_arrayLen( pResult ), u2;
for( u2 = 1; u2 <= nTrans; ++u2 )
{
hb_i18n_transitm( hb_arrayGetItemPtr( pResult, u2 ),
cdpage, cdp );
@@ -1049,12 +1049,12 @@ HB_FUNC( HB_I18N_ADDTEXT )
{
if( HB_IS_ARRAY( pTrans ) )
{
HB_SIZE ulLen = hb_arrayLen( pTrans ), ul;
if( ulLen != 0 )
HB_SIZE nLen = hb_arrayLen( pTrans ), n;
if( nLen != 0 )
{
for( ul = 1; ul <= ulLen; ++ul )
for( n = 1; n <= nLen; ++n )
{
if( !HB_IS_STRING( hb_arrayGetItemPtr( pTrans, ul ) ) )
if( !HB_IS_STRING( hb_arrayGetItemPtr( pTrans, n ) ) )
{
pTrans = NULL;
break;
@@ -1078,7 +1078,6 @@ HB_FUNC( HB_I18N_ADDTEXT )
HB_FUNC( HB_I18N_SET )
{
if( hb_pcount() > 0 )
{
if( HB_ISNIL( 1 ) )

View File

@@ -659,7 +659,7 @@ static void s_inetRecvInternal( int iMode )
PHB_SOCKET_STRUCT socket = HB_PARSOCKET( 1 );
PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING );
char * buffer;
HB_SIZE ulLen;
HB_SIZE nLen;
int iLen, iMaxLen, iReceived;
int iTimeElapsed;
@@ -669,8 +669,8 @@ static void s_inetRecvInternal( int iMode )
hb_retni( -1 );
else
{
if( hb_itemGetWriteCL( pBuffer, &buffer, &ulLen ) )
iLen = ( int ) ulLen;
if( hb_itemGetWriteCL( pBuffer, &buffer, &nLen ) )
iLen = ( int ) nLen;
else
{
iLen = 0;
@@ -1383,7 +1383,7 @@ HB_FUNC( HB_INETDGRAMRECV )
int iTimeElapsed = 0;
int iLen = 0, iMax;
char * buffer = NULL;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fRepeat;
if( socket == NULL || pBuffer == NULL || ! HB_ISBYREF( 2 ) )
@@ -1396,8 +1396,8 @@ HB_FUNC( HB_INETDGRAMRECV )
else
{
socket->iCount = 0;
if( hb_itemGetWriteCL( pBuffer, &buffer, &ulLen ) )
iLen = ( int ) ulLen;
if( hb_itemGetWriteCL( pBuffer, &buffer, &nLen ) )
iLen = ( int ) nLen;
if( HB_ISNUM( 3 ) )
{
iMax = hb_parni( 3 );

View File

@@ -254,7 +254,7 @@ static void hb_md5val( HB_U32 accum[], char * md5val )
}
}
void hb_md5( const void * data, HB_SIZE ulLen, char * digest )
void hb_md5( const void * data, HB_SIZE nLen, char * digest )
{
const unsigned char * ucdata = ( const unsigned char * ) data;
HB_UCHAR buf[ 128 ];
@@ -264,7 +264,7 @@ void hb_md5( const void * data, HB_SIZE ulLen, char * digest )
/* perform startup procedures */
hb_md5accinit( md5.accum );
/* count full 512bit blocks in data*/
n = ulLen >> 6;
n = nLen >> 6;
/* process full blocks */
for( i = 0; i < n; i++, ucdata += 64 )
{
@@ -273,7 +273,7 @@ void hb_md5( const void * data, HB_SIZE ulLen, char * digest )
}
/* prepare additional block(s) */
memset( buf, 0, sizeof( buf ) );
n = ulLen & 63;
n = nLen & 63;
if( n )
memcpy( buf, ucdata, n );
buf[ n ] = 0x80;
@@ -285,12 +285,12 @@ void hb_md5( const void * data, HB_SIZE ulLen, char * digest )
memcpy( md5.buf, buf, 64 );
hb_md5go( &md5 );
}
buf[ i++ ] = ( HB_UCHAR ) ( ( ulLen << 3 ) & 0xF8 );
ulLen >>= 5;
buf[ i++ ] = ( HB_UCHAR ) ( ( nLen << 3 ) & 0xF8 );
nLen >>= 5;
for( n = 7; n; --n )
{
buf[ i++ ] = ( HB_UCHAR ) ( ulLen & 0xFF );
ulLen >>= 8;
buf[ i++ ] = ( HB_UCHAR ) ( nLen & 0xFF );
nLen >>= 8;
}
memcpy( md5.buf, buf + i - 64, 64 );
hb_md5go( &md5 );
@@ -359,10 +359,10 @@ HB_FUNC( HB_MD5 )
if( pszStr )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
char dststr[ 16 ];
hb_md5( pszStr, ulLen, dststr );
hb_md5( pszStr, nLen, dststr );
if( ! hb_parl( 2 ) )
{

View File

@@ -933,22 +933,22 @@ HB_BOOL hb_fsProcessClose( HB_FHANDLE hProcess, HB_BOOL fGentle )
#define HB_STD_BUFFER_SIZE 4096
int hb_fsProcessRun( const char * pszFilename,
const char * pStdInBuf, HB_SIZE ulStdInLen,
const char * pStdInBuf, HB_SIZE nStdInLen,
char ** pStdOutPtr, HB_SIZE * pulStdOut,
char ** pStdErrPtr, HB_SIZE * pulStdErr,
HB_BOOL fDetach )
{
HB_FHANDLE hStdin, hStdout, hStderr, *phStdin, *phStdout, *phStderr;
char * pOutBuf, *pErrBuf;
HB_SIZE ulOutSize, ulErrSize, ulOutBuf, ulErrBuf;
HB_SIZE nOutSize, nErrSize, nOutBuf, nErrBuf;
char * pszFree = NULL;
int iResult;
HB_TRACE(HB_TR_DEBUG, ("hb_fsProcessRun(%s, %p, %" HB_PFS "u, %p, %p, %p, %p, %d)", pStdInBuf, pStdInBuf, ulStdInLen, pStdOutPtr, pulStdOut, pStdErrPtr, pulStdErr, fDetach));
HB_TRACE(HB_TR_DEBUG, ("hb_fsProcessRun(%s, %p, %" HB_PFS "u, %p, %p, %p, %p, %d)", pStdInBuf, pStdInBuf, nStdInLen, pStdOutPtr, pulStdOut, pStdErrPtr, pulStdErr, fDetach));
pszFilename = hb_osEncodeCP( pszFilename, &pszFree, NULL );
ulOutBuf = ulErrBuf = ulOutSize = ulErrSize = 0;
nOutBuf = nErrBuf = nOutSize = nErrSize = 0;
pOutBuf = pErrBuf = NULL;
hStdin = hStdout = hStderr = FS_ERROR;
phStdin = pStdInBuf ? &hStdin : NULL;
@@ -970,16 +970,16 @@ int hb_fsProcessRun( const char * pszFilename,
char sTmpErr[ HB_PATH_MAX ];
HB_SYMBOL_UNUSED( phStdin );
HB_SYMBOL_UNUSED( ulOutSize );
HB_SYMBOL_UNUSED( ulErrSize );
HB_SYMBOL_UNUSED( nOutSize );
HB_SYMBOL_UNUSED( nErrSize );
sTmpIn[ 0 ] = sTmpOut[ 0 ] = sTmpErr[ 0 ] = '\0';
if( pStdInBuf )
{
hStdin = hb_fsCreateTempEx( sTmpIn, NULL, NULL, NULL, FC_NORMAL );
if( ulStdInLen )
if( nStdInLen )
{
hb_fsWriteLarge( hStdin, pStdInBuf, ulStdInLen );
hb_fsWriteLarge( hStdin, pStdInBuf, nStdInLen );
hb_fsSeek( hStdin, 0, FS_SET );
}
}
@@ -1008,12 +1008,12 @@ int hb_fsProcessRun( const char * pszFilename,
{
if( pStdOutPtr && pulStdOut )
{
ulOutBuf = hb_fsSeek( hStdout, 0, FS_END );
if( ulOutBuf )
nOutBuf = hb_fsSeek( hStdout, 0, FS_END );
if( nOutBuf )
{
pOutBuf = ( char * ) hb_xgrab( ulOutBuf + 1 );
pOutBuf = ( char * ) hb_xgrab( nOutBuf + 1 );
hb_fsSeek( hStdout, 0, FS_SET );
ulOutBuf = hb_fsReadLarge( hStdout, pOutBuf, ulOutBuf );
nOutBuf = hb_fsReadLarge( hStdout, pOutBuf, nOutBuf );
}
}
hb_fsClose( hStdout );
@@ -1024,12 +1024,12 @@ int hb_fsProcessRun( const char * pszFilename,
{
if( pStdErrPtr && pulStdErr )
{
ulErrBuf = hb_fsSeek( hStderr, 0, FS_END );
if( ulErrBuf )
nErrBuf = hb_fsSeek( hStderr, 0, FS_END );
if( nErrBuf )
{
pErrBuf = ( char * ) hb_xgrab( ulErrBuf + 1 );
pErrBuf = ( char * ) hb_xgrab( nErrBuf + 1 );
hb_fsSeek( hStderr, 0, FS_SET );
ulErrBuf = hb_fsReadLarge( hStderr, pErrBuf, ulErrBuf );
nErrBuf = hb_fsReadLarge( hStderr, pErrBuf, nErrBuf );
}
}
hb_fsClose( hStderr );
@@ -1053,7 +1053,7 @@ int hb_fsProcessRun( const char * pszFilename,
HANDLE lpHandles[ 4 ];
HB_SIZE ul;
if( ulStdInLen == 0 && hStdin != FS_ERROR )
if( nStdInLen == 0 && hStdin != FS_ERROR )
{
hb_fsClose( hStdin );
hStdin = FS_ERROR;
@@ -1062,7 +1062,7 @@ int hb_fsProcessRun( const char * pszFilename,
for( ;; )
{
dwCount = 0;
if( ulStdInLen && hStdin != FS_ERROR )
if( nStdInLen && hStdin != FS_ERROR )
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStdin );
if( hStdout != FS_ERROR )
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStdout );
@@ -1075,13 +1075,13 @@ int hb_fsProcessRun( const char * pszFilename,
if( /* dwResult >= WAIT_OBJECT_0 && */ dwResult < WAIT_OBJECT_0 + dwCount )
{
if( ulStdInLen && hStdin != FS_ERROR &&
if( nStdInLen && hStdin != FS_ERROR &&
lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hStdin ) )
{
ul = hb_fsWriteLarge( hStdin, pStdInBuf, ulStdInLen );
ul = hb_fsWriteLarge( hStdin, pStdInBuf, nStdInLen );
pStdInBuf += ul;
ulStdInLen -= ul;
if( ulStdInLen == 0 )
nStdInLen -= ul;
if( nStdInLen == 0 )
{
hb_fsClose( hStdin );
hStdin = FS_ERROR;
@@ -1090,35 +1090,35 @@ int hb_fsProcessRun( const char * pszFilename,
else if( hStdout != FS_ERROR &&
lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hStdout ) )
{
if( ulOutBuf == ulOutSize )
if( nOutBuf == nOutSize )
{
ulOutSize += HB_STD_BUFFER_SIZE;
pOutBuf = ( char * ) hb_xrealloc( pOutBuf, ulOutSize + 1 );
nOutSize += HB_STD_BUFFER_SIZE;
pOutBuf = ( char * ) hb_xrealloc( pOutBuf, nOutSize + 1 );
}
ul = hb_fsReadLarge( hStdout, pOutBuf + ulOutBuf, ulOutSize - ulOutBuf );
ul = hb_fsReadLarge( hStdout, pOutBuf + nOutBuf, nOutSize - nOutBuf );
if( ul == 0 )
{
hb_fsClose( hStdout );
hStdout = FS_ERROR;
}
else
ulOutBuf += ul;
nOutBuf += ul;
}
else if( hStderr != FS_ERROR && lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hStderr ) )
{
if( ulErrBuf == ulErrSize )
if( nErrBuf == nErrSize )
{
ulErrSize += HB_STD_BUFFER_SIZE;
pErrBuf = ( char * ) hb_xrealloc( pErrBuf, ulErrSize + 1 );
nErrSize += HB_STD_BUFFER_SIZE;
pErrBuf = ( char * ) hb_xrealloc( pErrBuf, nErrSize + 1 );
}
ul = hb_fsReadLarge( hStderr, pErrBuf + ulErrBuf, ulErrSize - ulErrBuf );
ul = hb_fsReadLarge( hStderr, pErrBuf + nErrBuf, nErrSize - nErrBuf );
if( ul == 0 )
{
hb_fsClose( hStderr );
hStderr = FS_ERROR;
}
else
ulErrBuf += ul;
nErrBuf += ul;
}
else if( lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hProcess ) )
{
@@ -1147,7 +1147,7 @@ int hb_fsProcessRun( const char * pszFilename,
HB_SIZE ul;
int n;
if( ulStdInLen == 0 && hStdin != FS_ERROR )
if( nStdInLen == 0 && hStdin != FS_ERROR )
{
hb_fsClose( hStdin );
hStdin = FS_ERROR;
@@ -1174,7 +1174,7 @@ int hb_fsProcessRun( const char * pszFilename,
}
prfds = &rfds;
}
if( ulStdInLen && hStdin != FS_ERROR )
if( nStdInLen && hStdin != FS_ERROR )
{
FD_ZERO( &wfds );
FD_SET( hStdin, &wfds );
@@ -1189,12 +1189,12 @@ int hb_fsProcessRun( const char * pszFilename,
n = select( fdMax + 1, prfds, pwfds, NULL, NULL );
if( n > 0 )
{
if( ulStdInLen && hStdin != FS_ERROR && FD_ISSET( hStdin, &wfds ) )
if( nStdInLen && hStdin != FS_ERROR && FD_ISSET( hStdin, &wfds ) )
{
ul = hb_fsWriteLarge( hStdin, pStdInBuf, ulStdInLen );
ul = hb_fsWriteLarge( hStdin, pStdInBuf, nStdInLen );
pStdInBuf += ul;
ulStdInLen -= ul;
if( ulStdInLen == 0 )
nStdInLen -= ul;
if( nStdInLen == 0 )
{
hb_fsClose( hStdin );
hStdin = FS_ERROR;
@@ -1203,12 +1203,12 @@ int hb_fsProcessRun( const char * pszFilename,
if( hStdout != FS_ERROR && FD_ISSET( hStdout, &rfds ) )
{
if( ulOutBuf == ulOutSize )
if( nOutBuf == nOutSize )
{
ulOutSize += HB_STD_BUFFER_SIZE;
pOutBuf = ( char * ) hb_xrealloc( pOutBuf, ulOutSize + 1 );
nOutSize += HB_STD_BUFFER_SIZE;
pOutBuf = ( char * ) hb_xrealloc( pOutBuf, nOutSize + 1 );
}
ul = hb_fsReadLarge( hStdout, pOutBuf + ulOutBuf, ulOutSize - ulOutBuf );
ul = hb_fsReadLarge( hStdout, pOutBuf + nOutBuf, nOutSize - nOutBuf );
if( ul == 0 )
{
/* zero bytes read after positive select()
@@ -1218,17 +1218,17 @@ int hb_fsProcessRun( const char * pszFilename,
hStdout = FS_ERROR;
}
else
ulOutBuf += ul;
nOutBuf += ul;
}
if( hStderr != FS_ERROR && FD_ISSET( hStderr, &rfds ) )
{
if( ulErrBuf == ulErrSize )
if( nErrBuf == nErrSize )
{
ulErrSize += HB_STD_BUFFER_SIZE;
pErrBuf = ( char * ) hb_xrealloc( pErrBuf, ulErrSize + 1 );
nErrSize += HB_STD_BUFFER_SIZE;
pErrBuf = ( char * ) hb_xrealloc( pErrBuf, nErrSize + 1 );
}
ul = hb_fsReadLarge( hStderr, pErrBuf + ulErrBuf, ulErrSize - ulErrBuf );
ul = hb_fsReadLarge( hStderr, pErrBuf + nErrBuf, nErrSize - nErrBuf );
if( ul == 0 )
{
/* zero bytes read after positive select()
@@ -1238,7 +1238,7 @@ int hb_fsProcessRun( const char * pszFilename,
hStderr = FS_ERROR;
}
else
ulErrBuf += ul;
nErrBuf += ul;
}
}
hb_vmLock();
@@ -1257,7 +1257,7 @@ int hb_fsProcessRun( const char * pszFilename,
int iTODO;
HB_SYMBOL_UNUSED( ulStdInLen );
HB_SYMBOL_UNUSED( nStdInLen );
#endif
}
@@ -1267,12 +1267,12 @@ int hb_fsProcessRun( const char * pszFilename,
if( phStdout )
{
*pStdOutPtr = pOutBuf;
*pulStdOut = ulOutBuf;
*pulStdOut = nOutBuf;
}
if( phStderr )
{
*pStdErrPtr = pErrBuf;
*pulStdErr = ulErrBuf;
*pulStdErr = nErrBuf;
}
if( pszFree )

View File

@@ -134,23 +134,23 @@ HB_FUNC( HB_PROCESSRUN )
( pStdErr || HB_ISNIL( 4 ) ) &&
( HB_ISLOG( 5 ) || HB_ISNIL( 5 ) ) )
{
HB_SIZE ulStdOut, ulStdErr;
HB_SIZE nStdOut, nStdErr;
char * pStdOutBuf, * pStdErrBuf;
char ** pStdOutPtr, ** pStdErrPtr;
int iResult;
ulStdOut = ulStdErr = 0;
nStdOut = nStdErr = 0;
pStdOutBuf = pStdErrBuf = NULL;
pStdOutPtr = pStdOut ? &pStdOutBuf : NULL;
pStdErrPtr = pStdErr ? &pStdErrBuf : NULL;
iResult = hb_fsProcessRun( szName, szStdIn, hb_parclen( 2 ),
pStdOutPtr, &ulStdOut, pStdErrPtr, &ulStdErr,
pStdOutPtr, &nStdOut, pStdErrPtr, &nStdErr,
fDetach );
if( pStdOutBuf )
{
if( ! hb_storclen_buffer( pStdOutBuf, ulStdOut, 3 ) )
if( ! hb_storclen_buffer( pStdOutBuf, nStdOut, 3 ) )
hb_xfree( pStdOutBuf );
}
else if( pStdOut )
@@ -158,7 +158,7 @@ HB_FUNC( HB_PROCESSRUN )
if( pStdErrBuf )
{
if( ! hb_storclen_buffer( pStdErrBuf, ulStdErr, 4 ) )
if( ! hb_storclen_buffer( pStdErrBuf, nStdErr, 4 ) )
hb_xfree( pStdErrBuf );
}
else if( pStdErr )

View File

@@ -98,14 +98,14 @@ static int hb_regcomp( PHB_REGEX pRegEx, const char * szRegEx )
#endif
}
static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE ulLen,
static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE nLen,
int iMatches, HB_REGMATCH * aMatches )
{
#if defined( HB_HAS_PCRE )
int iResult, i;
iResult = pcre_exec( pRegEx->re_pcre, NULL /* pcre_extra */,
szString, ( int ) ulLen, 0 /* startoffset */,
szString, ( int ) nLen, 0 /* startoffset */,
pRegEx->iEFlags, aMatches, HB_REGMATCH_SIZE( iMatches ) );
if( iResult == 0 )
{
@@ -120,9 +120,9 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE ulLen,
char * szBuffer = NULL;
int iResult, i;
if( szString[ ulLen ] != 0 )
if( szString[ nLen ] != 0 )
{
szBuffer = hb_strndup( szString, ulLen );
szBuffer = hb_strndup( szString, nLen );
szString = szBuffer;
}
for( i = 0; i < iMatches; i++ )
@@ -144,7 +144,7 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE ulLen,
#else
HB_SYMBOL_UNUSED( pRegEx );
HB_SYMBOL_UNUSED( szString );
HB_SYMBOL_UNUSED( ulLen );
HB_SYMBOL_UNUSED( nLen );
HB_SYMBOL_UNUSED( iMatches );
HB_SYMBOL_UNUSED( aMatches );
return -1;
@@ -154,9 +154,9 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE ulLen,
HB_FUNC( HB_REGEXCOMP )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
if( ulLen == 0 )
if( nLen == 0 )
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
else
{
@@ -168,7 +168,7 @@ HB_FUNC( HB_REGEXCOMP )
if( hb_parl( 3 ) )
iFlags |= HBREG_NEWLINE;
pRegEx = hb_regexCompile( hb_parc( 1 ), ulLen, iFlags );
pRegEx = hb_regexCompile( hb_parc( 1 ), nLen, iFlags );
if( pRegEx )
{
pRegEx->fFree = HB_FALSE;
@@ -193,39 +193,39 @@ HB_FUNC( HB_ATX )
if( pRegEx )
{
HB_SIZE ulLen = hb_itemGetCLen( pString );
HB_SIZE ulStart = hb_parns( 4 );
HB_SIZE ulEnd = hb_parnsdef( 5, ulLen );
HB_SIZE nLen = hb_itemGetCLen( pString );
HB_SIZE nStart = hb_parns( 4 );
HB_SIZE nEnd = hb_parnsdef( 5, nLen );
if( ulLen && ulStart <= ulLen && ulStart <= ulEnd )
if( nLen && nStart <= nLen && nStart <= nEnd )
{
const char * pszString = hb_itemGetCPtr( pString );
HB_REGMATCH aMatches[ HB_REGMATCH_SIZE( 1 ) ];
if( ulEnd < ulLen )
ulLen = ulEnd;
if( ulStart )
if( nEnd < nLen )
nLen = nEnd;
if( nStart )
{
--ulStart;
ulLen -= ulStart;
--nStart;
nLen -= nStart;
}
if( hb_regexec( pRegEx, pszString + ulStart, ulLen, 1, aMatches ) > 0 )
if( hb_regexec( pRegEx, pszString + nStart, nLen, 1, aMatches ) > 0 )
{
ulStart += HB_REGMATCH_SO( aMatches, 0 ) + 1;
ulLen = HB_REGMATCH_EO( aMatches, 0 ) - HB_REGMATCH_SO( aMatches, 0 );
hb_retclen( pszString + ulStart - 1, ulLen );
nStart += HB_REGMATCH_SO( aMatches, 0 ) + 1;
nLen = HB_REGMATCH_EO( aMatches, 0 ) - HB_REGMATCH_SO( aMatches, 0 );
hb_retclen( pszString + nStart - 1, nLen );
}
else
ulStart = ulLen = 0;
nStart = nLen = 0;
}
else
ulStart = ulLen = 0;
nStart = nLen = 0;
hb_regexFree( pRegEx );
hb_storns( ulStart, 4 );
hb_storns( ulLen, 5 );
hb_storns( nStart, 4 );
hb_storns( nLen, 5 );
}
else
{
@@ -245,7 +245,7 @@ static HB_BOOL hb_regex( int iRequest )
HB_BOOL fResult = HB_FALSE;
PHB_REGEX pRegEx;
const char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
pString = hb_param( 2, HB_IT_STRING );
if( !pString )
@@ -260,10 +260,10 @@ static HB_BOOL hb_regex( int iRequest )
return HB_FALSE;
pszString = hb_itemGetCPtr( pString );
ulLen = hb_itemGetCLen( pString );
nLen = hb_itemGetCLen( pString );
iMaxMatch = iRequest == 0 || iRequest == 4 || iRequest == 5 ?
REGEX_MAX_GROUPS : 1;
iMatches = hb_regexec( pRegEx, pszString, ulLen, iMaxMatch, aMatches );
iMatches = hb_regexec( pRegEx, pszString, nLen, iMaxMatch, aMatches );
if( iMatches > 0 )
{
switch( iRequest )
@@ -286,7 +286,7 @@ static HB_BOOL hb_regex( int iRequest )
case 1: /* LIKE */
fResult = HB_REGMATCH_SO( aMatches, 0 ) == 0 &&
( HB_SIZE ) HB_REGMATCH_EO( aMatches, 0 ) == ulLen;
( HB_SIZE ) HB_REGMATCH_EO( aMatches, 0 ) == nLen;
break;
case 2: /* MATCH ( HAS ) */
@@ -302,19 +302,19 @@ static HB_BOOL hb_regex( int iRequest )
{
hb_itemPutCL( pMatch, pszString, HB_REGMATCH_SO( aMatches, 0 ) );
hb_arrayAddForward( pRetArray, pMatch );
ulLen -= HB_REGMATCH_EO( aMatches, 0 );
nLen -= HB_REGMATCH_EO( aMatches, 0 );
pszString += HB_REGMATCH_EO( aMatches, 0 );
iMatches++;
}
while( HB_REGMATCH_EO( aMatches, 0 ) > 0 && ulLen &&
while( HB_REGMATCH_EO( aMatches, 0 ) > 0 && nLen &&
( iMaxMatch == 0 || iMatches < iMaxMatch ) &&
hb_regexec( pRegEx, pszString, ulLen, 1, aMatches ) > 0 );
hb_regexec( pRegEx, pszString, nLen, 1, aMatches ) > 0 );
/* last match must be done also in case that pszString is empty;
this would mean an empty split field at the end of the string */
/* if( ulLen ) */
/* if( nLen ) */
{
hb_itemPutCL( pMatch, pszString, ulLen );
hb_itemPutCL( pMatch, pszString, nLen );
hb_arrayAddForward( pRetArray, pMatch );
}
hb_itemRelease( pMatch );
@@ -358,7 +358,7 @@ static HB_BOOL hb_regex( int iRequest )
int iMax = hb_parni( 5 ); /* max nuber of matches I want, 0 = unlimited */
int iGetMatch = hb_parni( 6 ); /* Gets if want only one single match or a sub-match */
HB_BOOL fOnlyMatch = hb_parldef( 7, 1 ); /* if HB_TRUE returns only matches and sub-matches, not positions */
HB_SIZE ulOffSet = 0;
HB_SIZE nOffset = 0;
int iCount = 0;
int iSO, iEO;
@@ -384,9 +384,9 @@ static HB_BOOL hb_regex( int iRequest )
/* matched string */
hb_arraySetCL( pMatch, 1, pszString + iSO, iEO - iSO );
/* begin of match */
hb_arraySetNS( pMatch, 2, ulOffSet + iSO + 1 );
hb_arraySetNS( pMatch, 2, nOffset + iSO + 1 );
/* End of match */
hb_arraySetNS( pMatch, 3, ulOffSet + iEO );
hb_arraySetNS( pMatch, 3, nOffset + iEO );
}
else
{
@@ -421,9 +421,9 @@ static HB_BOOL hb_regex( int iRequest )
/* matched string */
hb_arraySetCL( pMatch, 1, pszString + iSO, iEO - iSO );
/* begin of match */
hb_arraySetNS( pMatch, 2, ulOffSet + iSO + 1 );
hb_arraySetNS( pMatch, 2, nOffset + iSO + 1 );
/* End of match */
hb_arraySetNS( pMatch, 3, ulOffSet + iEO );
hb_arraySetNS( pMatch, 3, nOffset + iEO );
}
else
{
@@ -447,13 +447,13 @@ static HB_BOOL hb_regex( int iRequest )
iEO = HB_REGMATCH_EO( aMatches, 0 );
if( iEO == -1 )
break;
ulLen -= iEO;
nLen -= iEO;
pszString += iEO;
ulOffSet += iEO;
nOffset += iEO;
iCount++;
}
while( iEO && ulLen && ( iMax == 0 || iCount < iMax ) &&
( iMatches = hb_regexec( pRegEx, pszString, ulLen, iMaxMatch, aMatches ) ) > 0 );
while( iEO && nLen && ( iMax == 0 || iCount < iMax ) &&
( iMatches = hb_regexec( pRegEx, pszString, nLen, iMaxMatch, aMatches ) ) > 0 );
hb_itemReturnRelease( pRetArray );
fResult = HB_TRUE;
break;

View File

@@ -67,12 +67,12 @@ static int hb_regcomp( PHB_REGEX pRegEx, const char * szRegEx )
return -1;
}
static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE ulLen,
static int hb_regexec( PHB_REGEX pRegEx, const char * szString, HB_SIZE nLen,
int iMatches, HB_REGMATCH * aMatches )
{
HB_SYMBOL_UNUSED( pRegEx );
HB_SYMBOL_UNUSED( szString );
HB_SYMBOL_UNUSED( ulLen );
HB_SYMBOL_UNUSED( nLen );
HB_SYMBOL_UNUSED( iMatches );
HB_SYMBOL_UNUSED( aMatches );
return -1;
@@ -106,11 +106,11 @@ HB_BOOL hb_regexIs( PHB_ITEM pItem )
return hb_itemGetPtrGC( pItem, &s_gcRegexFuncs ) != NULL;
}
PHB_REGEX hb_regexCompile( const char *szRegEx, HB_SIZE ulLen, int iFlags )
PHB_REGEX hb_regexCompile( const char *szRegEx, HB_SIZE nLen, int iFlags )
{
PHB_REGEX pRegEx;
HB_SYMBOL_UNUSED( ulLen );
HB_SYMBOL_UNUSED( nLen );
pRegEx = ( PHB_REGEX ) hb_gcAllocate( sizeof( HB_REGEX ), &s_gcRegexFuncs );
memset( pRegEx, 0, sizeof( HB_REGEX ) );
@@ -141,12 +141,12 @@ PHB_REGEX hb_regexGet( PHB_ITEM pRegExItm, int iFlags )
}
else if( HB_IS_STRING( pRegExItm ) )
{
HB_SIZE ulLen = hb_itemGetCLen( pRegExItm );
HB_SIZE nLen = hb_itemGetCLen( pRegExItm );
const char * szRegEx = hb_itemGetCPtr( pRegExItm );
if( ulLen > 0 )
if( nLen > 0 )
{
fArgError = HB_FALSE;
pRegEx = hb_regexCompile( szRegEx, ulLen, iFlags );
pRegEx = hb_regexCompile( szRegEx, nLen, iFlags );
}
}
}
@@ -168,13 +168,13 @@ void hb_regexFree( PHB_REGEX pRegEx )
}
}
HB_BOOL hb_regexMatch( PHB_REGEX pRegEx, const char *szString, HB_SIZE ulLen, HB_BOOL fFull )
HB_BOOL hb_regexMatch( PHB_REGEX pRegEx, const char *szString, HB_SIZE nLen, HB_BOOL fFull )
{
HB_REGMATCH aMatches[ HB_REGMATCH_SIZE( 1 ) ];
HB_BOOL fMatch;
fMatch = ( s_reg_exec )( pRegEx, szString, ulLen, 1, aMatches ) > 0;
fMatch = ( s_reg_exec )( pRegEx, szString, nLen, 1, aMatches ) > 0;
return fMatch && ( !fFull ||
( HB_REGMATCH_SO( aMatches, 0 ) == 0 &&
HB_REGMATCH_EO( aMatches, 0 ) == ( int ) ulLen ) );
HB_REGMATCH_EO( aMatches, 0 ) == ( int ) nLen ) );
}

View File

@@ -2580,7 +2580,7 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD,
{
HB_SOCKET maxsd, sd;
int i, ret;
HB_SIZE ulLen, ulPos, ul;
HB_SIZE nLen, nPos, ul;
PHB_ITEM pItemSets[ 3 ];
HB_BOOL pSet[ 3 ];
fd_set fds[ 3 ], *pfds[ 3 ];
@@ -2597,11 +2597,11 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD,
for( i = 0; i < 3; i++ )
{
ret = 0;
ulLen = pItemSets[ i ] ? hb_arrayLen( pItemSets[ i ] ) : 0;
if( ulLen > 0 )
nLen = pItemSets[ i ] ? hb_arrayLen( pItemSets[ i ] ) : 0;
if( nLen > 0 )
{
FD_ZERO( &fds[ i ] );
for( ul = 1; ul <= ulLen; ul++ )
for( ul = 1; ul <= nLen; ul++ )
{
if( pFunc )
sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) );
@@ -2642,11 +2642,11 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD,
{
if( pfds[ i ] && pSet[ i ] )
{
ulPos = 0;
nPos = 0;
if( ret > 0 )
{
ulLen = hb_arrayLen( pItemSets[ i ] );
for( ul = 1; ul <= ulLen; ul++ )
nLen = hb_arrayLen( pItemSets[ i ] );
for( ul = 1; ul <= nLen; ul++ )
{
if( pFunc )
sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) );
@@ -2662,15 +2662,15 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD,
}
if( sd != HB_NO_SOCKET && FD_ISSET( sd, pfds[ i ] ) )
{
if( ++ulPos != ul )
if( ++nPos != ul )
{
hb_itemCopy( hb_arrayGetItemPtr( pItemSets[ i ], ulPos ),
hb_itemCopy( hb_arrayGetItemPtr( pItemSets[ i ], nPos ),
hb_arrayGetItemPtr( pItemSets[ i ], ul ) );
}
}
}
}
hb_arraySize( pItemSets[ i ], ulPos );
hb_arraySize( pItemSets[ i ], nPos );
}
}

View File

@@ -391,17 +391,17 @@ HB_FUNC( HB_SOCKETRECV )
{
PHB_ITEM pItem = hb_param( 2, HB_IT_STRING );
char * pBuffer;
HB_SIZE iLen;
HB_SIZE nLen;
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &iLen ) )
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &nLen ) )
{
if( HB_ISNUM( 3 ) )
{
long lRead = hb_parnl( 3 );
if( lRead >= 0 && lRead < ( long ) iLen )
iLen = lRead;
if( lRead >= 0 && lRead < ( long ) nLen )
nLen = lRead;
}
hb_retnl( hb_socketRecv( pSocket->socket, pBuffer, ( long ) iLen,
hb_retnl( hb_socketRecv( pSocket->socket, pBuffer, ( long ) nLen,
hb_parni( 4 ), hb_parnintdef( 5, -1 ) ) );
return;
}
@@ -416,9 +416,9 @@ HB_FUNC( HB_SOCKETRECVFROM )
{
PHB_ITEM pItem = hb_param( 2, HB_IT_STRING );
char * pBuffer;
HB_SIZE iLen;
HB_SIZE nLen;
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &iLen ) )
if( pItem && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pItem, &pBuffer, &nLen ) )
{
void * addr = NULL;
unsigned int len;
@@ -427,10 +427,10 @@ HB_FUNC( HB_SOCKETRECVFROM )
if( HB_ISNUM( 3 ) )
{
long lRead = hb_parnl( 3 );
if( lRead >= 0 && lRead < ( long ) iLen )
iLen = lRead;
if( lRead >= 0 && lRead < ( long ) nLen )
nLen = lRead;
}
hb_retnl( lRet = hb_socketRecvFrom( pSocket->socket, pBuffer, ( long ) iLen,
hb_retnl( lRet = hb_socketRecvFrom( pSocket->socket, pBuffer, ( long ) nLen,
hb_parni( 4 ), &addr, &len,
hb_parnintdef( 6, -1 ) ) );
if( HB_ISBYREF( 5 ) )

View File

@@ -56,20 +56,20 @@
typedef struct
{
char * pData;
HB_SIZE ulLen;
HB_SIZE ulMax;
HB_SIZE nLen;
HB_SIZE nMax;
} BUFFERTYPE;
static void bufadd( BUFFERTYPE * pBuf, const char * pAdd, HB_SIZE ulLen )
static void bufadd( BUFFERTYPE * pBuf, const char * pAdd, HB_SIZE nLen )
{
if( pBuf->ulLen + ulLen >= pBuf->ulMax )
if( pBuf->nLen + nLen >= pBuf->nMax )
{
pBuf->ulMax += ( pBuf->ulMax >> 1 ) + ulLen;
pBuf->pData = ( char * ) hb_xrealloc( pBuf->pData, pBuf->ulMax );
pBuf->nMax += ( pBuf->nMax >> 1 ) + nLen;
pBuf->pData = ( char * ) hb_xrealloc( pBuf->pData, pBuf->nMax );
}
memcpy( pBuf->pData + pBuf->ulLen, pAdd, ulLen );
pBuf->ulLen += ulLen;
pBuf->pData[ pBuf->ulLen ] = '\0';
memcpy( pBuf->pData + pBuf->nLen, pAdd, nLen );
pBuf->nLen += nLen;
pBuf->pData[ pBuf->nLen ] = '\0';
}
PHB_ITEM hb_strFormat( PHB_ITEM pItemReturn, PHB_ITEM pItemFormat, int iCount, PHB_ITEM * pItemArray )
@@ -78,16 +78,16 @@ PHB_ITEM hb_strFormat( PHB_ITEM pItemReturn, PHB_ITEM pItemFormat, int iCount, P
PHB_ITEM pItem;
const char *pFmt, *pFmtEnd, *pFmtSave;
int i, iParam, iParamNo, iWidth, iDec;
HB_SIZE ulSize;
HB_SIZE nSize;
HB_BOOL fLeftAlign, fForceSign, fPadZero, fSpaceSign, fSign;
pFmt = hb_itemGetCPtr( pItemFormat );
ulSize = hb_itemGetCLen( pItemFormat );
pFmtEnd = pFmt + ulSize;
nSize = hb_itemGetCLen( pItemFormat );
pFmtEnd = pFmt + nSize;
buffer.ulMax = ulSize + 16;
buffer.ulLen = 0;
buffer.pData = ( char* ) hb_xgrab( buffer.ulMax );
buffer.nMax = nSize + 16;
buffer.nLen = 0;
buffer.pData = ( char * ) hb_xgrab( buffer.nMax );
buffer.pData[ 0 ] = '\0';
iParam = 0;
@@ -434,23 +434,23 @@ PHB_ITEM hb_strFormat( PHB_ITEM pItemReturn, PHB_ITEM pItemFormat, int iCount, P
{
const char * pStr = hb_itemGetCPtr( pItem );
ulSize = hb_itemGetCLen( pItem );
nSize = hb_itemGetCLen( pItem );
if( iDec >= 0 )
{
if( ( HB_SIZE ) iDec < ulSize )
ulSize = iDec;
if( ( HB_SIZE ) iDec < nSize )
nSize = iDec;
}
if( fLeftAlign )
bufadd( &buffer, pStr, ulSize );
bufadd( &buffer, pStr, nSize );
if( iWidth > 1 )
{
for( i = ( int ) ulSize; i < iWidth; i++ )
for( i = ( int ) nSize; i < iWidth; i++ )
bufadd( &buffer, " ", 1 );
}
if( ! fLeftAlign )
bufadd( &buffer, pStr, ulSize );
bufadd( &buffer, pStr, nSize );
break;
}
@@ -461,7 +461,7 @@ PHB_ITEM hb_strFormat( PHB_ITEM pItemReturn, PHB_ITEM pItemFormat, int iCount, P
pFmt++;
}
pItemReturn = hb_itemPutCL( pItemReturn, buffer.pData, buffer.ulLen );
pItemReturn = hb_itemPutCL( pItemReturn, buffer.pData, buffer.nLen );
hb_xfree( buffer.pData );
return pItemReturn;
}

View File

@@ -59,16 +59,16 @@ HB_FUNC( HB_STRSHRINK )
if( pText )
{
HB_ISIZ lLen = hb_itemGetCLen( pText );
HB_ISIZ lShrinkBy = hb_parnldef( 2, 1 );
HB_ISIZ nLen = hb_itemGetCLen( pText );
HB_ISIZ nShrinkBy = hb_parnldef( 2, 1 );
if( lShrinkBy > 0 )
if( nShrinkBy > 0 )
{
if( lShrinkBy < lLen )
lLen -= lShrinkBy;
if( nShrinkBy < nLen )
nLen -= nShrinkBy;
else
lLen = 0;
hb_retclen( hb_itemGetCPtr( pText ), lLen );
nLen = 0;
hb_retclen( hb_itemGetCPtr( pText ), nLen );
}
else
hb_itemReturn( pText );

View File

@@ -59,14 +59,14 @@
#define _HB_TOK_ISDELIM 4
#define _HB_TOK_STRIP_QUUTE 8
static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE ulLen,
const char * szDelim, HB_SIZE ulDelim,
static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE nDelim,
int iFlags )
{
HB_SIZE ul = 0, ulTokens = 1;
HB_SIZE ul = 0, nTokens = 1;
char cQuote = 0;
while( ul < ulLen )
while( ul < nLen )
{
if( cQuote )
{
@@ -77,30 +77,30 @@ static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE ulLen,
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( ulDelim == 1 || !memcmp( szLine + ul, szDelim, ulDelim ) ) )
( nDelim == 1 || !memcmp( szLine + ul, szDelim, nDelim ) ) )
{
++ulTokens;
++nTokens;
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < ulLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
}
ul += ulDelim - 1;
ul += nDelim - 1;
}
++ul;
}
return ulTokens;
return nTokens;
}
static const char * hb_tokenGet( const char * szLine, HB_SIZE ulLen,
const char * szDelim, HB_SIZE ulDelim,
int iFlags, HB_SIZE ulToken, HB_SIZE * pulLen )
static const char * hb_tokenGet( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE nDelim,
int iFlags, HB_SIZE nToken, HB_SIZE * pnLen )
{
HB_SIZE ul, ulStart;
HB_SIZE ul, nStart;
char cQuote = 0;
for( ul = ulStart = 0; ul < ulLen; ++ul )
for( ul = nStart = 0; ul < nLen; ++ul )
{
if( cQuote )
{
@@ -111,43 +111,43 @@ static const char * hb_tokenGet( const char * szLine, HB_SIZE ulLen,
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( ulDelim == 1 || !memcmp( szLine + ul, szDelim, ulDelim ) ) )
( nDelim == 1 || !memcmp( szLine + ul, szDelim, nDelim ) ) )
{
if( --ulToken == 0 )
if( --nToken == 0 )
{
* pulLen = ul - ulStart;
return szLine + ulStart;
* pnLen = ul - nStart;
return szLine + nStart;
}
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < ulLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
}
ulStart = ul + ulDelim;
nStart = ul + nDelim;
}
}
if( --ulToken == 0 )
if( --nToken == 0 )
{
* pulLen = ul - ulStart;
return szLine + ulStart;
* pnLen = ul - nStart;
return szLine + nStart;
}
* pulLen = 0;
* pnLen = 0;
return NULL;
}
static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE ulLen,
const char * szDelim, HB_SIZE ulDelim,
static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE nDelim,
int iFlags )
{
HB_SIZE ulTokens = hb_tokenCount( szLine, ulLen, szDelim, ulDelim, iFlags );
PHB_ITEM pArray = hb_itemArrayNew( ulTokens );
HB_SIZE nTokens = hb_tokenCount( szLine, nLen, szDelim, nDelim, iFlags );
PHB_ITEM pArray = hb_itemArrayNew( nTokens );
if( ulTokens )
if( nTokens )
{
HB_SIZE ul, ulStart, ulToken;
HB_SIZE ul, nStart, nToken;
char cQuote = 0;
for( ul = ulStart = ulToken = 0; ul < ulLen; ++ul )
for( ul = nStart = nToken = 0; ul < nLen; ++ul )
{
if( cQuote )
{
@@ -158,45 +158,45 @@ static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE ulLen,
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( ulDelim == 1 || !memcmp( szLine + ul, szDelim, ulDelim ) ) )
( nDelim == 1 || !memcmp( szLine + ul, szDelim, nDelim ) ) )
{
hb_arraySetCL( pArray, ++ulToken, szLine + ulStart, ul - ulStart );
hb_arraySetCL( pArray, ++nToken, szLine + nStart, ul - nStart );
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ul + 1 < ulLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
while( ul + 1 < nLen && szLine[ ul + 1 ] == szDelim[ 0 ] )
++ul;
}
ulStart = ul + ulDelim;
nStart = ul + nDelim;
}
}
hb_arraySetCL( pArray, ++ulToken, szLine + ulStart, ul - ulStart );
hb_arraySetCL( pArray, ++nToken, szLine + nStart, ul - nStart );
}
return pArray;
}
static HB_BOOL hb_tokenParam( int iParam, HB_SIZE ulSkip,
const char ** pszLine, HB_SIZE * pulLen,
const char ** pszDelim, HB_SIZE * pulDelim,
static HB_BOOL hb_tokenParam( int iParam, HB_SIZE nSkip,
const char ** pszLine, HB_SIZE * pnLen,
const char ** pszDelim, HB_SIZE * pnDelim,
int * piFlags )
{
const char * szLine = hb_parc( 1 ), * szDelim = NULL;
HB_SIZE ulLen = hb_parclen( 1 ), ulDelim = 0;
HB_SIZE nLen = hb_parclen( 1 ), nDelim = 0;
int iFlags = 0;
if( ulLen )
if( nLen )
{
if( ulSkip )
if( nSkip )
{
szLine += ulSkip;
if( ulLen <= ulSkip )
ulLen = 0;
szLine += nSkip;
if( nLen <= nSkip )
nLen = 0;
else
ulLen -= ulSkip;
nLen -= nSkip;
}
ulDelim = hb_parclen( iParam );
if( ulDelim )
nDelim = hb_parclen( iParam );
if( nDelim )
{
szDelim = hb_parc( iParam );
iFlags |= _HB_TOK_ISDELIM;
@@ -204,18 +204,18 @@ static HB_BOOL hb_tokenParam( int iParam, HB_SIZE ulSkip,
else
{
szDelim = " ";
ulDelim = 1;
nDelim = 1;
}
if( ( iFlags & _HB_TOK_ISDELIM ) == 0 )
{
while( ulLen && * szLine == szDelim[ 0 ] )
while( nLen && * szLine == szDelim[ 0 ] )
{
++szLine;
--ulLen;
--nLen;
}
while( ulLen && szLine[ ulLen - 1 ] == szDelim[ 0 ] )
--ulLen;
while( nLen && szLine[ nLen - 1 ] == szDelim[ 0 ] )
--nLen;
}
if( hb_parl( iParam + 1 ) )
{
@@ -225,8 +225,8 @@ static HB_BOOL hb_tokenParam( int iParam, HB_SIZE ulSkip,
}
}
*pulLen = ulLen;
*pulDelim = ulDelim;
*pnLen = nLen;
*pnDelim = nDelim;
*pszLine = szLine;
*pszDelim = szDelim;
*piFlags = iFlags;
@@ -237,11 +237,11 @@ static HB_BOOL hb_tokenParam( int iParam, HB_SIZE ulSkip,
HB_FUNC( HB_TOKENCOUNT )
{
const char * szLine, * szDelim;
HB_SIZE ulLen, ulDelim;
HB_SIZE nLen, nDelim;
int iFlags;
if( hb_tokenParam( 2, 0, &szLine, &ulLen, &szDelim, &ulDelim, &iFlags ) )
hb_retns( hb_tokenCount( szLine, ulLen, szDelim, ulDelim, iFlags ) );
if( hb_tokenParam( 2, 0, &szLine, &nLen, &szDelim, &nDelim, &iFlags ) )
hb_retns( hb_tokenCount( szLine, nLen, szDelim, nDelim, iFlags ) );
else
hb_retns( 0 );
}
@@ -249,14 +249,14 @@ HB_FUNC( HB_TOKENCOUNT )
HB_FUNC( HB_TOKENGET )
{
const char * szLine, * szDelim;
HB_SIZE ulLen, ulDelim;
HB_SIZE nLen, nDelim;
int iFlags;
if( hb_tokenParam( 3, 0, &szLine, &ulLen, &szDelim, &ulDelim, &iFlags ) )
if( hb_tokenParam( 3, 0, &szLine, &nLen, &szDelim, &nDelim, &iFlags ) )
{
szLine = hb_tokenGet( szLine, ulLen, szDelim, ulDelim, iFlags,
hb_parns( 2 ), &ulLen );
hb_retclen( szLine, ulLen );
szLine = hb_tokenGet( szLine, nLen, szDelim, nDelim, iFlags,
hb_parns( 2 ), &nLen );
hb_retclen( szLine, nLen );
}
else
hb_retc_null();
@@ -269,22 +269,22 @@ HB_FUNC( HB_TOKENGET )
HB_FUNC( HB_TOKENPTR )
{
const char * szLine, * szDelim, * szToken;
HB_SIZE ulLen, ulDelim, ulSkip, ulToken;
HB_SIZE nLen, nDelim, nSkip, nToken;
int iFlags;
if( hb_tokenParam( 3, hb_parns( 2 ), &szLine, &ulLen, &szDelim, &ulDelim, &iFlags ) )
if( hb_tokenParam( 3, hb_parns( 2 ), &szLine, &nLen, &szDelim, &nDelim, &iFlags ) )
{
szToken = hb_tokenGet( szLine, ulLen, szDelim, ulDelim, iFlags,
1, &ulToken );
if( szToken && ulLen > ulToken )
ulSkip = szToken - hb_parc( 1 ) + ulToken + ulDelim;
szToken = hb_tokenGet( szLine, nLen, szDelim, nDelim, iFlags,
1, &nToken );
if( szToken && nLen > nToken )
nSkip = szToken - hb_parc( 1 ) + nToken + nDelim;
else
ulSkip = hb_parclen( 1 ) + 1;
nSkip = hb_parclen( 1 ) + 1;
/* return position to start next search from */
hb_storns( ulSkip, 2 );
hb_storns( nSkip, 2 );
/* return token */
hb_retclen( szToken, ulToken );
hb_retclen( szToken, nToken );
}
else
{
@@ -296,11 +296,11 @@ HB_FUNC( HB_TOKENPTR )
HB_FUNC( HB_ATOKENS )
{
const char * szLine, * szDelim;
HB_SIZE ulLen, ulDelim;
HB_SIZE nLen, nDelim;
int iFlags;
if( hb_tokenParam( 2, 0, &szLine, &ulLen, &szDelim, &ulDelim, &iFlags ) )
hb_itemReturnRelease( hb_tokenArray( szLine, ulLen, szDelim, ulDelim, iFlags ) );
if( hb_tokenParam( 2, 0, &szLine, &nLen, &szDelim, &nDelim, &iFlags ) )
hb_itemReturnRelease( hb_tokenArray( szLine, nLen, szDelim, nDelim, iFlags ) );
else
hb_errRT_BASE_SubstR( EG_ARG, 1123, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}

View File

@@ -63,17 +63,17 @@
#define _HB_Z_COMPRESSBOUND
#endif
static HB_SIZE hb_zlibUncompressedSize( const char * szSrc, HB_SIZE ulLen,
static HB_SIZE hb_zlibUncompressedSize( const char * szSrc, HB_SIZE nLen,
int * piResult )
{
Byte buffer[ 1024 ];
z_stream stream;
HB_SIZE ulDest = 0;
HB_SIZE nDest = 0;
memset( &stream, 0, sizeof( z_stream ) );
stream.next_in = ( Bytef * ) szSrc;
stream.avail_in = ( uInt ) ulLen;
stream.avail_in = ( uInt ) nLen;
/*
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
@@ -93,13 +93,13 @@ static HB_SIZE hb_zlibUncompressedSize( const char * szSrc, HB_SIZE ulLen,
if( *piResult == Z_STREAM_END )
{
ulDest = stream.total_out;
nDest = stream.total_out;
*piResult = Z_OK;
}
inflateEnd( &stream );
}
return ulDest;
return nDest;
}
/*
@@ -149,14 +149,14 @@ HB_FUNC( HB_ZUNCOMPRESSLEN )
if( szData )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
int iResult = Z_OK;
if( ulLen )
ulLen = hb_zlibUncompressedSize( szData, ulLen, &iResult );
if( nLen )
nLen = hb_zlibUncompressedSize( szData, nLen, &iResult );
if( iResult == Z_OK )
hb_retnint( ulLen );
hb_retnint( nLen );
else
hb_retni( -1 );
@@ -175,9 +175,9 @@ HB_FUNC( HB_ZCOMPRESS )
const char * szData = hb_parc( 1 );
if( szData )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
if( ulLen )
if( nLen )
{
PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL;
uLong ulDstLen;
@@ -195,7 +195,7 @@ HB_FUNC( HB_ZCOMPRESS )
{
ulDstLen = HB_ISNUM( 2 ) ? ( uLong ) hb_parns( 2 ) :
#if defined( _HB_Z_COMPRESSBOUND )
compressBound( ( uLong ) ulLen );
compressBound( ( uLong ) nLen );
#else
0;
#endif
@@ -205,9 +205,9 @@ HB_FUNC( HB_ZCOMPRESS )
if( pDest )
{
if( HB_ISNUM( 4 ) )
iResult = compress2( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) ulLen, hb_parni( 4 ) );
iResult = compress2( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) nLen, hb_parni( 4 ) );
else
iResult = compress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) ulLen );
iResult = compress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) nLen );
if( !pBuffer )
{
@@ -245,9 +245,9 @@ HB_FUNC( HB_ZUNCOMPRESS )
if( szData )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
if( ulLen )
if( nLen )
{
uLong ulDstLen;
char * pDest = NULL;
@@ -263,7 +263,7 @@ HB_FUNC( HB_ZUNCOMPRESS )
else
{
ulDstLen = HB_ISNUM( 2 ) ? ( uLong ) hb_parns( 2 ) :
( uLong ) hb_zlibUncompressedSize( szData, ulLen, &iResult );
( uLong ) hb_zlibUncompressedSize( szData, nLen, &iResult );
if( iResult == Z_OK )
{
pDest = ( char * ) hb_xalloc( ulDstLen + 1 );
@@ -274,7 +274,7 @@ HB_FUNC( HB_ZUNCOMPRESS )
if( iResult == Z_OK )
{
iResult = uncompress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) ulLen );
iResult = uncompress( ( Bytef * ) pDest, &ulDstLen, ( Bytef * ) szData, ( uLong ) nLen );
if( !pBuffer )
{

View File

@@ -165,20 +165,20 @@ HB_FUNC( HB_GZREAD )
{
PHB_ITEM pBuffer = HB_ISBYREF( 2 ) ? hb_param( 2, HB_IT_STRING ) : NULL;
char * szBuffer;
HB_SIZE ulLen;
HB_SIZE nLen;
if( pBuffer && hb_itemGetWriteCL( pBuffer, &szBuffer, &ulLen ) )
if( pBuffer && hb_itemGetWriteCL( pBuffer, &szBuffer, &nLen ) )
{
gzFile gz = hb_gzParam( 1 );
if( gz )
{
if( HB_ISNUM( 3 ) )
{
HB_SIZE ulLim = hb_parns( 3 );
if( ulLim < ulLen )
ulLen = ulLim;
HB_SIZE nLim = hb_parns( 3 );
if( nLim < nLen )
nLen = nLim;
}
hb_retni( gzread( gz, szBuffer, ( unsigned ) ulLen ) );
hb_retni( gzread( gz, szBuffer, ( unsigned ) nLen ) );
}
}
else

File diff suppressed because it is too large Load Diff

View File

@@ -68,9 +68,9 @@ static void hb_memoread( HB_BOOL bHandleEOF )
if( fhnd != FS_ERROR )
{
HB_SIZE ulSize = hb_fsSeek( fhnd, 0, FS_END );
HB_SIZE nSize = hb_fsSeek( fhnd, 0, FS_END );
if( ulSize != 0 )
if( nSize != 0 )
{
void * pbyBuffer;
@@ -85,18 +85,18 @@ static void hb_memoread( HB_BOOL bHandleEOF )
hb_fsRead( fhnd, &cEOF, sizeof( char ) );
if( cEOF == HB_CHAR_EOF )
ulSize--;
nSize--;
}
#else
HB_SYMBOL_UNUSED( bHandleEOF );
#endif
pbyBuffer = hb_xgrab( ulSize + sizeof( char ) );
pbyBuffer = hb_xgrab( nSize + sizeof( char ) );
hb_fsSeek( fhnd, 0, FS_SET );
hb_fsReadLarge( fhnd, pbyBuffer, ulSize );
hb_fsReadLarge( fhnd, pbyBuffer, nSize );
hb_retclen_buffer( ( char * ) pbyBuffer, ulSize );
hb_retclen_buffer( ( char * ) pbyBuffer, nSize );
}
else
hb_retc_null();
@@ -132,9 +132,9 @@ static HB_BOOL hb_memowrit( HB_BOOL bHandleEOF )
if( fhnd != FS_ERROR )
{
HB_SIZE ulSize = hb_itemGetCLen( pString );
HB_SIZE nSize = hb_itemGetCLen( pString );
bRetVal = ( hb_fsWriteLarge( fhnd, hb_itemGetCPtr( pString ), ulSize ) == ulSize );
bRetVal = ( hb_fsWriteLarge( fhnd, hb_itemGetCPtr( pString ), nSize ) == nSize );
/* NOTE: CA-Cl*pper will add the EOF even if the write failed. [vszakats] */
/* NOTE: CA-Cl*pper will not return .F. when the EOF could not be written. [vszakats] */

View File

@@ -62,32 +62,32 @@ HB_FUNC( SUBSTR )
if( pText && HB_ISNUM( 2 ) )
{
HB_ISIZ lPos = hb_parns( 2 );
HB_ISIZ lSize = hb_itemGetCLen( pText );
HB_ISIZ nPos = hb_parns( 2 );
HB_ISIZ nSize = hb_itemGetCLen( pText );
if( lPos < 0 )
if( nPos < 0 )
{
lPos += lSize;
if( lPos < 0 )
lPos = 0;
nPos += nSize;
if( nPos < 0 )
nPos = 0;
}
else if( lPos )
else if( nPos )
{
lPos--;
nPos--;
}
if( lPos < lSize )
if( nPos < nSize )
{
HB_ISIZ lLen;
HB_ISIZ nLen;
if( hb_pcount() >= 3 )
{
if( HB_ISNUM( 3 ) )
{
lLen = hb_parns( 3 );
nLen = hb_parns( 3 );
if( lLen > lSize - lPos )
lLen = lSize - lPos;
if( nLen > nSize - nPos )
nLen = nSize - nPos;
}
else
{
@@ -97,14 +97,14 @@ HB_FUNC( SUBSTR )
}
}
else
lLen = lSize - lPos;
nLen = nSize - nPos;
if( lLen > 0 )
if( nLen > 0 )
{
if( lLen == lSize )
if( nLen == nSize )
hb_itemReturn( pText );
else
hb_retclen( hb_itemGetCPtr( pText ) + lPos, lLen );
hb_retclen( hb_itemGetCPtr( pText ) + nPos, nLen );
}
else
hb_retc_null();

View File

@@ -97,16 +97,16 @@ HB_FUNC( TRANSFORM )
{
char szPicDate[ 11 ];
const char * szPic = hb_itemGetCPtr( pPic );
HB_SIZE ulPicLen = hb_itemGetCLen( pPic );
HB_SIZE nPicLen = hb_itemGetCLen( pPic );
HB_USHORT uiPicFlags; /* Function flags */
HB_SIZE ulParamS = 0; /* To avoid GCC -O2 warning */
HB_SIZE nParamS = 0; /* To avoid GCC -O2 warning */
char cParamL = '\0'; /* To avoid GCC -O2 warning */
char * szResult;
HB_SIZE ulResultPos;
HB_SIZE nResultPos;
HB_SIZE ulOffset = 0;
HB_SIZE nOffset = 0;
/* ======================================================= */
/* Analyze picture functions */
@@ -123,12 +123,12 @@ HB_FUNC( TRANSFORM )
/* Skip the "@" char */
szPic++;
ulPicLen--;
nPicLen--;
/* Go through all function chars, until the end of the picture string
or any whitespace found. */
while( ulPicLen && ! bDone )
while( nPicLen && ! bDone )
{
switch( hb_charUpper( *szPic ) )
{
@@ -170,12 +170,12 @@ HB_FUNC( TRANSFORM )
break;
case 'S':
uiPicFlags |= PF_WIDTH;
ulParamS = 0;
while( ulPicLen > 1 && *( szPic + 1 ) >= '0' && *( szPic + 1 ) <= '9' )
nParamS = 0;
while( nPicLen > 1 && *( szPic + 1 ) >= '0' && *( szPic + 1 ) <= '9' )
{
szPic++;
ulPicLen--;
ulParamS = ( ulParamS * 10 ) + ( ( HB_SIZE ) ( *szPic - '0' ) );
nPicLen--;
nParamS = ( nParamS * 10 ) + ( ( HB_SIZE ) ( *szPic - '0' ) );
}
break;
case 'T':
@@ -190,7 +190,7 @@ HB_FUNC( TRANSFORM )
}
szPic++;
ulPicLen--;
nPicLen--;
}
}
@@ -201,8 +201,8 @@ HB_FUNC( TRANSFORM )
if( HB_IS_STRING( pValue ) )
{
const char * szExp = hb_itemGetCPtr( pValue );
HB_SIZE ulExpLen = hb_itemGetCLen( pValue );
HB_SIZE ulExpPos = 0;
HB_SIZE nExpLen = hb_itemGetCLen( pValue );
HB_SIZE nExpPos = 0;
HB_BOOL bAnyPic = HB_FALSE;
HB_BOOL bFound = HB_FALSE;
@@ -213,26 +213,26 @@ HB_FUNC( TRANSFORM )
{
hb_dateFormat( "XXXXXXXX", szPicDate, hb_setGetDateFormat() );
szPic = szPicDate;
ulPicLen = strlen( szPicDate );
nPicLen = strlen( szPicDate );
}
szResult = ( char * ) hb_xgrab( ulExpLen + ulPicLen + 1 );
ulResultPos = 0;
szResult = ( char * ) hb_xgrab( nExpLen + nPicLen + 1 );
nResultPos = 0;
/* Template string */
if( ulPicLen )
if( nPicLen )
{
while( ulPicLen ) /* Analyze picture mask */
while( nPicLen ) /* Analyze picture mask */
{
if( ulExpPos < ulExpLen )
if( nExpPos < nExpLen )
{
switch( *szPic )
{
/* Upper */
case '!':
{
szResult[ ulResultPos++ ] = ( char ) hb_charUpper( szExp[ ulExpPos ] );
ulExpPos++;
szResult[ nResultPos++ ] = ( char ) hb_charUpper( szExp[ nExpPos ] );
nExpPos++;
bAnyPic = HB_TRUE;
break;
}
@@ -249,8 +249,8 @@ HB_FUNC( TRANSFORM )
case 'x':
case 'X':
{
szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( szExp[ ulExpPos ] ) : szExp[ ulExpPos ];
ulExpPos++;
szResult[ nResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( szExp[ nExpPos ] ) : szExp[ nExpPos ];
nExpPos++;
bAnyPic = HB_TRUE;
break;
}
@@ -259,11 +259,11 @@ HB_FUNC( TRANSFORM )
case 'y':
case 'Y':
{
szResult[ ulResultPos++ ] = ( szExp[ ulExpPos ] == 't' ||
szExp[ ulExpPos ] == 'T' ||
szExp[ ulExpPos ] == 'y' ||
szExp[ ulExpPos ] == 'Y' ) ? ( char ) 'Y' : ( char ) 'N';
ulExpPos++;
szResult[ nResultPos++ ] = ( szExp[ nExpPos ] == 't' ||
szExp[ nExpPos ] == 'T' ||
szExp[ nExpPos ] == 'y' ||
szExp[ nExpPos ] == 'Y' ) ? ( char ) 'Y' : ( char ) 'N';
nExpPos++;
bAnyPic = HB_TRUE;
break;
}
@@ -271,10 +271,10 @@ HB_FUNC( TRANSFORM )
/* Other choices */
default:
{
szResult[ ulResultPos++ ] = *szPic;
szResult[ nResultPos++ ] = *szPic;
if( !( uiPicFlags & PF_REMAIN ) )
ulExpPos++;
nExpPos++;
}
}
}
@@ -285,7 +285,7 @@ HB_FUNC( TRANSFORM )
{
/* NOTE: This is a FoxPro compatible [jarabal] */
#if defined( HB_COMPAT_FOXPRO )
ulPicLen = 0;
nPicLen = 0;
break;
#else
switch( *szPic )
@@ -304,23 +304,23 @@ HB_FUNC( TRANSFORM )
case 'y':
case 'Y':
{
szResult[ ulResultPos++ ] = ' ';
szResult[ nResultPos++ ] = ' ';
break;
}
default:
szResult[ ulResultPos++ ] = *szPic;
szResult[ nResultPos++ ] = *szPic;
}
#endif
}
szPic++;
ulPicLen--;
nPicLen--;
}
}
else
{
while( ulExpPos++ < ulExpLen )
while( nExpPos++ < nExpLen )
{
if( uiPicFlags & PF_EXCHANG )
{
@@ -328,26 +328,26 @@ HB_FUNC( TRANSFORM )
{
case ',':
{
szResult[ ulResultPos++ ] = '.';
szResult[ nResultPos++ ] = '.';
break;
}
case '.':
{
if( !bFound && ulResultPos )
if( !bFound && nResultPos )
{
szResult[ ulResultPos++ ] = ',';
szResult[ nResultPos++ ] = ',';
bFound = HB_TRUE;
}
break;
}
default:
szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
szResult[ nResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
}
}
else
{
szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
szResult[ nResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
}
szExp++;
}
@@ -355,19 +355,19 @@ HB_FUNC( TRANSFORM )
if( ( uiPicFlags & PF_REMAIN ) && ! bAnyPic )
{
while( ulExpPos++ < ulExpLen )
while( nExpPos++ < nExpLen )
{
szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
szResult[ nResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? ( char ) hb_charUpper( *szExp ) : *szExp;
szExp++;
}
}
/* Any chars left ? */
if( ( uiPicFlags & PF_REMAIN ) && ulPicLen )
if( ( uiPicFlags & PF_REMAIN ) && nPicLen )
{
/* Export remainder */
while( ulPicLen-- )
szResult[ ulResultPos++ ] = ' ';
while( nPicLen-- )
szResult[ nResultPos++ ] = ' ';
}
if( uiPicFlags & PF_BRITISH )
@@ -387,7 +387,7 @@ HB_FUNC( TRANSFORM )
* ? transform( "ab", "@E" )
* [druzus]
*/
if( ulResultPos >= 5 )
if( nResultPos >= 5 )
{
szPicDate[ 0 ] = szResult[ 0 ];
szPicDate[ 1 ] = szResult[ 1 ];
@@ -419,14 +419,14 @@ HB_FUNC( TRANSFORM )
{
hb_dateFormat( "99999999", szPicDate, hb_setGetDateFormat() );
szPic = szPicDate;
ulPicLen = strlen( szPicDate );
nPicLen = strlen( szPicDate );
}
for( i = iWidth = iDec = 0; i < ulPicLen; i++ )
for( i = iWidth = iDec = 0; i < nPicLen; i++ )
{
if( szPic[ i ] == '.' )
{
while( ++i < ulPicLen )
while( ++i < nPicLen )
{
if( szPic[ i ] == '9' || szPic[ i ] == '#' ||
szPic[ i ] == '$' || szPic[ i ] == '*' )
@@ -513,7 +513,7 @@ HB_FUNC( TRANSFORM )
}
}
if( ulPicLen == 0 )
if( nPicLen == 0 )
{
if( uiPicFlags & PF_EXCHANG )
{
@@ -533,9 +533,9 @@ HB_FUNC( TRANSFORM )
char * szStr = szResult;
/* allocate 4 additional bytes for possible ") CR" or ") DB" suffix */
szResult = ( char * ) hb_xgrab( ulPicLen + 5 );
szResult = ( char * ) hb_xgrab( nPicLen + 5 );
for( i = iCount = 0; i < ulPicLen; i++ )
for( i = iCount = 0; i < nPicLen; i++ )
{
cPic = szPic[ i ];
if( cPic == '9' || cPic == '#' )
@@ -583,7 +583,7 @@ HB_FUNC( TRANSFORM )
if( ( uiPicFlags & PF_PARNEGWOS ) )
{
iCount = 0;
if( ulPicLen && i > 1 )
if( nPicLen && i > 1 )
{
if( *szPic == *szResult && ( *szPic == '*' || *szPic == '$' ) &&
szResult[ 1 ] == ' ' )
@@ -595,14 +595,14 @@ HB_FUNC( TRANSFORM )
#ifndef HB_CLP_STRICT
/* This is not Clipper compatible */
if( szResult[ iCount ] >= '1' && szResult[ iCount ] <= '9' &&
( ulPicLen == 0 || szPic[ iCount ] == '9' ||
( nPicLen == 0 || szPic[ iCount ] == '9' ||
szPic[ iCount ] != szResult[ iCount ] ) )
{
szResult[ iCount ] = '(';
for( ++iCount; ( HB_SIZE ) iCount < i; iCount++ )
{
if( szResult[ iCount ] >= '0' && szResult[ iCount ] <= '9' &&
( ulPicLen == 0 || szPic[ iCount ] == '9' ||
( nPicLen == 0 || szPic[ iCount ] == '9' ||
szPic[ iCount ] != szResult[ iCount ] ) )
szResult[ iCount ] = '*';
}
@@ -617,12 +617,12 @@ HB_FUNC( TRANSFORM )
#ifndef HB_CLP_STRICT
/* This is not Clipper compatible */
if( *szResult >= '1' && *szResult <= '9' &&
( ulPicLen == 0 || *szPic == '9' || *szPic != *szResult ) )
( nPicLen == 0 || *szPic == '9' || *szPic != *szResult ) )
{
for( iCount = 1; ( HB_SIZE ) iCount < i; iCount++ )
{
if( szResult[ iCount ] >= '0' && szResult[ iCount ] <= '9' &&
( ulPicLen == 0 || szPic[ iCount ] == '9' ||
( nPicLen == 0 || szPic[ iCount ] == '9' ||
szPic[ iCount ] != szResult[ iCount ] ) )
szResult[ iCount ] = '*';
}
@@ -630,7 +630,7 @@ HB_FUNC( TRANSFORM )
#endif
*szResult = '(';
szResult[ i++ ] = ')';
ulOffset = 1;
nOffset = 1;
}
if( ( uiPicFlags & PF_DEBIT ) )
@@ -647,7 +647,7 @@ HB_FUNC( TRANSFORM )
szResult[ i++ ] = 'R';
}
ulResultPos = i;
nResultPos = i;
szResult[ i ] = '\0';
}
@@ -708,7 +708,7 @@ HB_FUNC( TRANSFORM )
#endif
hb_dateFormat( hb_itemGetDS( pValue, szDate ), szResult, szDateFormat );
ulResultPos = strlen( szResult );
nResultPos = strlen( szResult );
#ifdef HB_CLP_STRICT
if( uiPicFlags & PF_BRITISH )
@@ -721,7 +721,7 @@ HB_FUNC( TRANSFORM )
* but this is buffer overflow and I do not plan to
* replicated it too [druzus]
*/
if( ulResultPos >= 5 )
if( nResultPos >= 5 )
{
szNewFormat[ 0 ] = szResult[ 0 ];
szNewFormat[ 1 ] = szResult[ 1 ];
@@ -737,15 +737,15 @@ HB_FUNC( TRANSFORM )
/* Here we also respect the date format modified for @E [druzus]
*/
hb_dateFormat( "99999999", szPicDate, szDateFormat );
ulPicLen = strlen( szPicDate );
nPicLen = strlen( szPicDate );
for( nFor = 0; nFor < ulPicLen; nFor++ )
for( nFor = 0; nFor < nPicLen; nFor++ )
{
if( szPicDate[ nFor ] != '9' )
{
memmove( szResult + nFor + 1, szResult + nFor, 12 - nFor );
szResult[ nFor ] = szPicDate[ nFor ];
ulResultPos++;
nResultPos++;
}
}
szResult[ 12 ] = '\0';
@@ -824,7 +824,7 @@ HB_FUNC( TRANSFORM )
char szDate[ 9 ];
hb_dateFormat( hb_dateDecStr( szDate, lDate ), szResult, szDateFormat );
}
ulResultPos = strlen( szResult );
nResultPos = strlen( szResult );
#ifdef HB_CLP_STRICT
if( uiPicFlags & PF_BRITISH )
@@ -837,7 +837,7 @@ HB_FUNC( TRANSFORM )
* but this is buffer overflow and I do not plan to
* replicated it too [druzus]
*/
if( ulResultPos >= 5 )
if( nResultPos >= 5 )
{
szNewFormat[ 0 ] = szResult[ 0 ];
szNewFormat[ 1 ] = szResult[ 1 ];
@@ -853,15 +853,15 @@ HB_FUNC( TRANSFORM )
/* Here we also respect the date format modified for @E [druzus]
*/
hb_dateFormat( "99999999", szPicDate, szDateFormat );
ulPicLen = strlen( szPicDate );
nPicLen = strlen( szPicDate );
for( nFor = 0; nFor < ulPicLen; nFor++ )
for( nFor = 0; nFor < nPicLen; nFor++ )
{
if( szPicDate[ nFor ] != '9' )
{
memmove( szResult + nFor + 1, szResult + nFor, 28 - nFor );
szResult[ nFor ] = szPicDate[ nFor ];
ulResultPos++;
nResultPos++;
}
}
szResult[ 28 ] = '\0';
@@ -882,15 +882,15 @@ HB_FUNC( TRANSFORM )
{
hb_dateFormat( "99999999", szPicDate, hb_setGetDateFormat() );
szPic = szPicDate;
ulPicLen = strlen( szPicDate );
nPicLen = strlen( szPicDate );
}
ulResultPos = 0;
szResult = ( char * ) hb_xgrab( ulPicLen + 2 );
nResultPos = 0;
szResult = ( char * ) hb_xgrab( nPicLen + 2 );
for( ; ( ulPicLen || !bDone ) && !bExit ; ulResultPos++, szPic++, ulPicLen-- )
for( ; ( nPicLen || !bDone ) && !bExit ; nResultPos++, szPic++, nPicLen-- )
{
if( ulPicLen )
if( nPicLen )
cPic = *szPic;
else
{
@@ -905,11 +905,11 @@ HB_FUNC( TRANSFORM )
{
if( !bDone )
{
szResult[ ulResultPos ] = hb_itemGetL( pValue ) ? 'Y' : 'N';
szResult[ nResultPos ] = hb_itemGetL( pValue ) ? 'Y' : 'N';
bDone = HB_TRUE; /* Logical written */
}
else
szResult[ ulResultPos ] = ' ';
szResult[ nResultPos ] = ' ';
break;
}
@@ -920,17 +920,17 @@ HB_FUNC( TRANSFORM )
{
if( !bDone )
{
szResult[ ulResultPos ] = hb_itemGetL( pValue ) ? 'T' : 'F';
szResult[ nResultPos ] = hb_itemGetL( pValue ) ? 'T' : 'F';
bDone = HB_TRUE;
}
else
szResult[ ulResultPos ] = ' ';
szResult[ nResultPos ] = ' ';
break;
}
default:
szResult[ ulResultPos ] = cPic;
szResult[ nResultPos ] = cPic;
}
if( !( uiPicFlags & PF_REMAIN ) )
@@ -943,30 +943,30 @@ HB_FUNC( TRANSFORM )
else
{
szResult = NULL; /* To avoid GCC -O2 warning */
ulResultPos = 0; /* To avoid GCC -O2 warning */
nResultPos = 0; /* To avoid GCC -O2 warning */
bError = HB_TRUE;
}
if( ! bError )
{
if( uiPicFlags & PF_EMPTY )
memset( szResult, ' ', ulResultPos );
memset( szResult, ' ', nResultPos );
else if( uiPicFlags & PF_LEFT )
{
/* Trim left and pad with spaces */
HB_SIZE ulFirstChar = ulOffset;
HB_SIZE nFirstChar = nOffset;
while( ulFirstChar < ulResultPos && szResult[ ulFirstChar ] == ' ' )
ulFirstChar++;
while( nFirstChar < nResultPos && szResult[ nFirstChar ] == ' ' )
nFirstChar++;
if( ulFirstChar > ulOffset && ulFirstChar < ulResultPos )
if( nFirstChar > nOffset && nFirstChar < nResultPos )
{
memmove( szResult + ulOffset, szResult + ulFirstChar, ulResultPos - ulFirstChar );
memset( szResult + ulOffset + ulResultPos - ulFirstChar, ' ', ulFirstChar - ulOffset );
memmove( szResult + nOffset, szResult + nFirstChar, nResultPos - nFirstChar );
memset( szResult + nOffset + nResultPos - nFirstChar, ' ', nFirstChar - nOffset );
}
}
hb_retclen_buffer( szResult, ( ulParamS && ulResultPos > ulParamS ) ? ulParamS : ulResultPos );
hb_retclen_buffer( szResult, ( nParamS && nResultPos > nParamS ) ? nParamS : nResultPos );
}
}
else if( pPic || HB_ISNIL( 2 ) ) /* Picture is an empty string or NIL */