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

* src/rtl/binnum.c
  * src/rtl/ampm.c
  * src/rtl/descend.c
  * src/rtl/at.c
  * src/rtl/console.c
  * src/rtl/cdpapi.c
  * src/rtl/accept.c
  * src/rtl/filebuf.c
  * src/rtl/cdpapihb.c
  * src/rtl/ati.c
  * src/rtl/binnumx.c
    * Renamed variables.

  * contrib/hbodbc/odbc.c
  * contrib/rddsql/sddodbc/odbcdd.c
    * Formatting.

  * contrib/hbbmcdx/bmdbfcdx.c
    ! Prefixed static variable with 's_'

  * contrib/hbbmcdx/hbbmcdx.h
    * Synced with include/hbrddcdx.h

  * utils/hbmk2/hbmk2.prg
    ! Fixed problem with generated implib name when using -implib option.
      It only worked as expected with bcc.
This commit is contained in:
Viktor Szakats
2010-02-10 13:14:37 +00:00
parent 65388ee4af
commit 5381546a40
17 changed files with 567 additions and 537 deletions

View File

@@ -17,6 +17,34 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-10 14:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/binnum.c
* src/rtl/ampm.c
* src/rtl/descend.c
* src/rtl/at.c
* src/rtl/console.c
* src/rtl/cdpapi.c
* src/rtl/accept.c
* src/rtl/filebuf.c
* src/rtl/cdpapihb.c
* src/rtl/ati.c
* src/rtl/binnumx.c
* Renamed variables.
* contrib/hbodbc/odbc.c
* contrib/rddsql/sddodbc/odbcdd.c
* Formatting.
* contrib/hbbmcdx/bmdbfcdx.c
! Prefixed static variable with 's_'
* contrib/hbbmcdx/hbbmcdx.h
* Synced with include/hbrddcdx.h
* utils/hbmk2/hbmk2.prg
! Fixed problem with generated implib name when using -implib option.
It only worked as expected with bcc.
2010-02-10 12:34 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/pp/Makefile
* harbour/src/pp/hbpp.c
@@ -91,22 +119,22 @@
+ contrib/hbide/docs/idemainpage.html
+ contrib/hbide/docs/interfaceelements.html
+ contrib/hbide/docs/multiviews.html
* contrib/hbide/resources/help.png
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/ideobject.prg
+ Implemented basics of ib-build help mechanism.
It is working in a limited manner and is scheduled to be
matured in next few days, at-least from operations
point-of-view. QtextBrowser() accepts a sub-set of
It is working in a limited manner and is scheduled to be
matured in next few days, at-least from operations
point-of-view. QtextBrowser() accepts a sub-set of
html commands and hence is very limited in appearnce.
As we have decided against QtWebkit, this implementation
may not look highly professional, will surely solve
our purpose.
may not look highly professional, will surely solve
our purpose.
If someone is willing to extend help in this direction,
then following are the guidelines how you should design
@@ -121,7 +149,7 @@
8. Select the whole source with Ctrl+A and copy with Ctrl+C.
9. Create a .html file with notepad, paste the source, and save.
The process is lengthy, but no other html editor solves our
The process is lengthy, but no other html editor solves our
purpose due to limited html tags availability in QTextBrowser.
2010-02-09 21:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

View File

@@ -142,7 +142,7 @@ static LPCDXTAG hb_cdxGetActiveTag( CDXAREAP pArea );
static void hb_cdxClearLogPosInfo( CDXAREAP pArea );
static HB_BOOL bTurbo = HB_FALSE;
static HB_BOOL s_bTurbo = HB_FALSE;
static RDDFUNCS cdxSuper;
static const RDDFUNCS cdxTable =
{
@@ -1364,7 +1364,7 @@ static HB_BOOL hb_cdxIndexLockRead( LPCDXINDEX pIndex )
pIndex->RdLck = HB_TRUE;
#endif
if( bTurbo )
if( s_bTurbo )
{
pIndex->lockRead++;
hb_cdxIndexCheckVersion( pIndex );
@@ -1450,7 +1450,7 @@ static HB_BOOL hb_cdxIndexUnLockRead( LPCDXINDEX pIndex )
hb_cdxIndexPoolFree( pIndex, CDX_PAGECACHESIZE );
if( bTurbo )
if( s_bTurbo )
{
#ifdef HB_CDX_DBGCODE
if( pIndex->pArea->dbfarea.fShared && pIndex->fShared &&
@@ -6947,8 +6947,8 @@ static HB_ERRCODE hb_cdxSeekWild( CDXAREAP pArea, HB_BOOL fSoftSeek, PHB_ITEM pK
HB_FUNC( BM_TURBO )
{
bTurbo = HB_ISLOG( 1 ) ? hb_parl( 1 ) : HB_FALSE;
hb_retl( bTurbo );
s_bTurbo = HB_ISLOG( 1 ) ? hb_parl( 1 ) : HB_FALSE;
hb_retl( s_bTurbo );
}
HB_FUNC( BM_DBGETFILTERARRAY )

View File

@@ -3,7 +3,7 @@
*/
/*
* BMDBFCDX RDD (ver.2)
* DBFCDX RDD (ver.2) + BMDBFCDX patch
*
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
* Copyright 2003 Przemyslaw Czerpak <druzus@acn.waw.pl>
@@ -56,7 +56,7 @@
#include "hbapirdd.h"
#include "hbdbferr.h"
#define HB_EXTERNAL_RDDDBF_USE
#include "hbrdddbf.h"
HB_EXTERN_BEGIN
@@ -138,6 +138,7 @@ HB_EXTERN_BEGIN
#define HB_CDXMAXKEY( x ) ( ( HB_USHORT ) ( ( x ) > CDX_MAXKEY ? CDX_MAXKEY : ( x ) ) )
#define HB_CDXBITMASK( x ) ( ( HB_LONG ) ( ( 1L << ( x ) ) - 1 ) )
/* #define FAST_GOCOLD( A ) ((A)->dbfarea.fRecordChanged || (A)->fCdxAppend ? (SELF_GOCOLD((AREAP)(A))) : HB_SUCCESS) */
#define FAST_GOCOLD( A ) SELF_GOCOLD(A)
@@ -192,33 +193,33 @@ HB_EXTERN_BEGIN
/* Compact Index Header Record */
typedef struct _CDXTAGHEADER
{
HB_BYTE rootPtr [ 4 ]; /* offset of the root node */
HB_BYTE freePtr [ 4 ]; /* offset of list of free pages or -1 */
HB_BYTE reserved1[ 4 ]; /* Version number ??? */
HB_BYTE keySize [ 2 ]; /* key length */
HB_BYTE indexOpt; /* index options see CDX_TYPE_* */
HB_BYTE indexSig; /* index signature */
HB_BYTE reserved2[ 478 ];
HB_BYTE codepage[ 5 ]; /* VFP codepage */
HB_BYTE ignoreCase; /* 1 = ignore case, key converted to upper */
HB_BYTE reserved3[ 2 ];
HB_BYTE ascendFlg[ 2 ]; /* 0 = ascending 1 = descending */
HB_BYTE forExpPos[ 2 ]; /* offset of filter expression */
HB_BYTE forExpLen[ 2 ]; /* length of filter expression */
HB_BYTE keyExpPos[ 2 ]; /* offset of key expression */
HB_BYTE keyExpLen[ 2 ]; /* length of key expression */
HB_BYTE keyExpPool[ CDX_HEADEREXPLEN ];
HB_BYTE rootPtr [ 4 ]; /* offset of the root node */
HB_BYTE freePtr [ 4 ]; /* offset of list of free pages or -1 */
HB_BYTE reserved1[ 4 ]; /* Version number ??? */
HB_BYTE keySize [ 2 ]; /* key length */
HB_BYTE indexOpt; /* index options see CDX_TYPE_* */
HB_BYTE indexSig; /* index signature */
HB_BYTE reserved2[ 478 ];
HB_BYTE codepage[ 5 ]; /* VFP codepage */
HB_BYTE ignoreCase; /* 1 = ignore case, key converted to upper */
HB_BYTE reserved3[ 2 ];
HB_BYTE ascendFlg[ 2 ]; /* 0 = ascending 1 = descending */
HB_BYTE forExpPos[ 2 ]; /* offset of filter expression */
HB_BYTE forExpLen[ 2 ]; /* length of filter expression */
HB_BYTE keyExpPos[ 2 ]; /* offset of key expression */
HB_BYTE keyExpLen[ 2 ]; /* length of key expression */
HB_BYTE keyExpPool[ CDX_HEADEREXPLEN ];
} CDXTAGHEADER;
typedef CDXTAGHEADER * LPCDXTAGHEADER;
/* Compact Index Interior Node Record */
typedef struct _CDXINTNODE
{
HB_BYTE attr [ 2 ]; /* node type see CDX_NODE_* */
HB_BYTE nKeys [ 2 ]; /* number of keys */
HB_BYTE leftPtr [ 4 ]; /* offset of left node or -1 */
HB_BYTE rightPtr[ 4 ]; /* offset of right node or -1 */
HB_BYTE keyPool [ CDX_INT_FREESPACE ];
HB_BYTE attr [ 2 ]; /* node type see CDX_NODE_* */
HB_BYTE nKeys [ 2 ]; /* number of keys */
HB_BYTE leftPtr [ 4 ]; /* offset of left node or -1 */
HB_BYTE rightPtr[ 4 ]; /* offset of right node or -1 */
HB_BYTE keyPool [ CDX_INT_FREESPACE ];
} CDXINTNODE;
typedef CDXINTNODE * LPCDXINTNODE;
typedef CDXINTNODE CDXNODE;
@@ -227,19 +228,19 @@ typedef CDXNODE * LPCDXNODE;
/* Compact Index Exterior Node Record */
typedef struct _CDXEXTNODE
{
HB_BYTE attr [ 2 ]; /* node type see CDX_NODE_* */
HB_BYTE nKeys [ 2 ]; /* number of keys */
HB_BYTE leftPtr [ 4 ]; /* offset of left node or -1 */
HB_BYTE rightPtr[ 4 ]; /* offset of right node or -1 */
HB_BYTE freeSpc [ 2 ]; /* free space available in a page */
HB_BYTE recMask [ 4 ]; /* record number mask */
HB_BYTE dupMask; /* duplicate bytes count mask */
HB_BYTE trlMask; /* trailing bytes count mask */
HB_BYTE recBits; /* number of bits for record number */
HB_BYTE dupBits; /* number of bits for duplicate count */
HB_BYTE trlBits; /* number of bits for trailing count */
HB_BYTE keyBytes; /* total number of bytes for recnn/dup/trail info */
HB_BYTE keyPool [ CDX_EXT_FREESPACE ]; /* rec/dup/trl */
HB_BYTE attr [ 2 ]; /* node type see CDX_NODE_* */
HB_BYTE nKeys [ 2 ]; /* number of keys */
HB_BYTE leftPtr [ 4 ]; /* offset of left node or -1 */
HB_BYTE rightPtr[ 4 ]; /* offset of right node or -1 */
HB_BYTE freeSpc [ 2 ]; /* free space available in a page */
HB_BYTE recMask [ 4 ]; /* record number mask */
HB_BYTE dupMask; /* duplicate bytes count mask */
HB_BYTE trlMask; /* trailing bytes count mask */
HB_BYTE recBits; /* number of bits for record number */
HB_BYTE dupBits; /* number of bits for duplicate count */
HB_BYTE trlBits; /* number of bits for trailing count */
HB_BYTE keyBytes; /* total number of bytes for recnn/dup/trail info */
HB_BYTE keyPool [ CDX_EXT_FREESPACE ]; /* rec/dup/trl */
} CDXEXTNODE;
typedef CDXEXTNODE * LPCDXEXTNODE;
@@ -262,36 +263,36 @@ typedef CDXKEY * LPCDXKEY;
typedef struct _CDXPAGE
{
HB_ULONG Page;
HB_ULONG Left;
HB_ULONG Right;
HB_ULONG Page;
HB_ULONG Left;
HB_ULONG Right;
HB_BYTE PageType;
int iKeys;
int iCurKey;
HB_BYTE PageType;
int iKeys;
int iCurKey;
HB_BOOL fChanged;
HB_BYTE bUsed;
HB_BOOL fChanged;
HB_BYTE bUsed;
HB_ULONG RNMask;
HB_BYTE ReqByte;
HB_BYTE RNBits;
HB_BYTE DCBits;
HB_BYTE TCBits;
HB_BYTE DCMask;
HB_BYTE TCMask;
HB_BOOL fBufChanged;
HB_ULONG RNMask;
HB_BYTE ReqByte;
HB_BYTE RNBits;
HB_BYTE DCBits;
HB_BYTE TCBits;
HB_BYTE DCMask;
HB_BYTE TCMask;
HB_BOOL fBufChanged;
union
{
CDXEXTNODE extNode;
CDXINTNODE intNode;
} node;
HB_BYTE bufKeyVal[ CDX_MAXKEY ]; /* buffer for leaf key val or added branch key */
HB_SHORT bufKeyNum; /* do not change these vars' order */
HB_SHORT bufKeyPos; /* they have to be just after the node */
HB_SHORT bufKeyLen; /* and maybe temporary overwriten when adding */
HB_SHORT iFree; /* new key to interior node record. */
HB_BYTE * pKeyBuf; /* pointer to uncompressed leaf page key pool */
HB_BYTE bufKeyVal[ CDX_MAXKEY ]; /* buffer for leaf key val or added branch key */
HB_SHORT bufKeyNum; /* do not change these vars' order */
HB_SHORT bufKeyPos; /* they have to be just after the node */
HB_SHORT bufKeyLen; /* and maybe temporary overwriten when adding */
HB_SHORT iFree; /* new key to interior node record. */
HB_BYTE * pKeyBuf; /* pointer to uncompressed leaf page key pool */
/* HB_SHORT iKeyInBuf; */
struct _CDXPAGE * Owner;
@@ -362,77 +363,77 @@ typedef struct _CDXTAG
struct _CDXTAG * pNext; /* pointer to next tag in index */
/* CDXSTACK PageStack[ CDX_STACKSIZE ]; */ /* stack with page path to current key */
LPCDXPAGE RootPage; /* pointer to root of keys tree in memory */
LPCDXKEY CurKey; /* current value of key expression */
LPCDXKEY HotKey; /* value of hot key expression */
HB_BOOL HotFor; /* index FOR condition for HotKey */
LPCDXPAGE RootPage; /* pointer to root of keys tree in memory */
LPCDXKEY CurKey; /* current value of key expression */
LPCDXKEY HotKey; /* value of hot key expression */
HB_BOOL HotFor; /* index FOR condition for HotKey */
PHB_ITEM topScope; /* Top scope HB_ITEM */
LPCDXKEY topScopeKey; /* Top scope index key */
PHB_ITEM bottomScope; /* Bottom scope HB_ITEM */
LPCDXKEY bottomScopeKey; /* Bottom index key */
PHB_ITEM topScope; /* Top scope HB_ITEM */
LPCDXKEY topScopeKey; /* Top scope index key */
PHB_ITEM bottomScope; /* Bottom scope HB_ITEM */
LPCDXKEY bottomScopeKey; /* Bottom index key */
LPCDXPAGE pagePool; /* page buffer in memory */
LPCDXPAGE pagePool; /* page buffer in memory */
} CDXTAG;
typedef CDXTAG * LPCDXTAG;
typedef struct _CDXINDEX
{
char * szFileName; /* Name of index file */
char * szRealName; /* Real name of index file */
PHB_FILE pFile; /* Index file handle */
char * szFileName; /* Name of index file */
char * szRealName; /* Real name of index file */
PHB_FILE pFile; /* Index file handle */
struct _CDXAREA * pArea; /* Parent WorkArea */
struct _CDXINDEX * pNext; /* The next index in the list */
LPCDXTAG pCompound; /* Compound tag */
LPCDXTAG TagList; /* List of tags in index file */
HB_BOOL fShared; /* Shared file */
HB_BOOL fReadonly; /* Read only file */
HB_BOOL fDelete; /* delete on close flag */
HB_ULONG nextAvail; /* offset to next free page in the end of index file */
HB_ULONG freePage; /* offset to next free page inside index file */
LPCDXLIST freeLst; /* list of free pages in index file */
int lockWrite; /* number of write lock set */
int lockRead; /* number of read lock set */
HB_FOFFSET ulLockPos; /* readlock position for CL53 lock scheme */
LPCDXTAG pCompound; /* Compound tag */
LPCDXTAG TagList; /* List of tags in index file */
HB_BOOL fShared; /* Shared file */
HB_BOOL fReadonly; /* Read only file */
HB_BOOL fDelete; /* delete on close flag */
HB_ULONG nextAvail; /* offset to next free page in the end of index file */
HB_ULONG freePage; /* offset to next free page inside index file */
LPCDXLIST freeLst; /* list of free pages in index file */
int lockWrite; /* number of write lock set */
int lockRead; /* number of read lock set */
HB_FOFFSET ulLockPos; /* readlock position for CL53 lock scheme */
#ifdef HB_CDX_DBGCODE
HB_BOOL RdLck;
HB_BOOL WrLck;
HB_BOOL RdLck;
HB_BOOL WrLck;
#endif
HB_BOOL fChanged; /* changes written to index, need upadte ulVersion */
HB_ULONG ulVersion; /* network version/update flag */
HB_BOOL fFlush; /* changes written to index, need upadte ulVersion */
HB_BOOL fChanged; /* changes written to index, need upadte ulVersion */
HB_ULONG ulVersion; /* network version/update flag */
HB_BOOL fFlush; /* changes written to index, need upadte ulVersion */
} CDXINDEX;
typedef CDXINDEX * LPCDXINDEX;
/* for index creation */
typedef struct
{
HB_FOFFSET nOffset; /* offset in temporary file */
HB_ULONG ulKeys; /* number of keys in page */
HB_ULONG ulKeyBuf; /* number of keys in memory buffer */
HB_ULONG ulCurKey; /* current key in memory buffer */
HB_BYTE * pKeyPool; /* memory buffer */
HB_FOFFSET nOffset; /* offset in temporary file */
HB_ULONG ulKeys; /* number of keys in page */
HB_ULONG ulKeyBuf; /* number of keys in memory buffer */
HB_ULONG ulCurKey; /* current key in memory buffer */
HB_BYTE * pKeyPool; /* memory buffer */
} CDXSWAPPAGE;
typedef CDXSWAPPAGE * LPCDXSWAPPAGE;
typedef struct
{
LPCDXTAG pTag; /* current Tag */
HB_FHANDLE hTempFile; /* handle to temporary file */
char * szTempFileName; /* temporary file name */
int keyLen; /* key length */
HB_BYTE bTrl; /* filler char for shorter keys */
HB_BOOL fUnique; /* HB_TRUE if index is unique */
HB_BOOL fReindex; /* HB_TRUE if reindexing is in process */
HB_ULONG ulMaxRec; /* the highest record number */
HB_ULONG ulTotKeys; /* total number of keys indexed */
HB_ULONG ulKeys; /* keys in curently created page */
HB_ULONG ulPages; /* number of pages */
HB_ULONG ulCurPage; /* current page */
HB_ULONG ulPgKeys; /* maximum number of key in page memory buffer */
HB_ULONG ulMaxKey; /* maximum number of keys in single page */
HB_BYTE * pKeyPool; /* memory buffer for current page then for pages */
LPCDXSWAPPAGE pSwapPage; /* list of pages */
LPCDXTAG pTag; /* current Tag */
HB_FHANDLE hTempFile; /* handle to temporary file */
char * szTempFileName; /* temporary file name */
int keyLen; /* key length */
HB_BYTE bTrl; /* filler char for shorter keys */
HB_BOOL fUnique; /* HB_TRUE if index is unique */
HB_BOOL fReindex; /* HB_TRUE if reindexing is in process */
HB_ULONG ulMaxRec; /* the highest record number */
HB_ULONG ulTotKeys; /* total number of keys indexed */
HB_ULONG ulKeys; /* keys in curently created page */
HB_ULONG ulPages; /* number of pages */
HB_ULONG ulCurPage; /* current page */
HB_ULONG ulPgKeys; /* maximum number of key in page memory buffer */
HB_ULONG ulMaxKey; /* maximum number of keys in single page */
HB_BYTE * pKeyPool; /* memory buffer for current page then for pages */
LPCDXSWAPPAGE pSwapPage; /* list of pages */
LPCDXPAGE NodeList[ CDX_STACKSIZE ]; /* Stack of pages */
HB_ULONG ulFirst;
HB_ULONG * pSortedPages;
@@ -440,7 +441,7 @@ typedef struct
HB_ULONG ulLastRec;
HB_BYTE * pRecBuff;
#ifndef HB_CDX_PACKTRAIL
int iLastTrl; /* last key trailing spaces */
int iLastTrl; /* last key trailing spaces */
#endif
} CDXSORTINFO;
typedef CDXSORTINFO * LPCDXSORTINFO;
@@ -456,7 +457,7 @@ typedef CDXSORTINFO * LPCDXSORTINFO;
typedef struct _CDXAREA
{
DBFAREA dbfarea;
DBFAREA dbfarea;
/*
* CDX's additions to the workarea structure
@@ -466,11 +467,12 @@ typedef struct _CDXAREA
* example.
*/
HB_BOOL fCdxAppend; /* Appended record changed */
LPCDXINDEX lpIndexes; /* Pointer to indexes array */
HB_USHORT uiTag; /* current tag focus */
LPCDXSORTINFO pSort; /* Index build structure */
HB_BYTE * bCdxSortTab; /* Table with storted characters */
LPCDXINDEX lpIndexes; /* Pointer to indexes array */
HB_BYTE * bCdxSortTab; /* Table with sorted characters */
HB_BOOL fCdxAppend; /* Appended record changed */
HB_USHORT uiTag; /* current tag focus */
} CDXAREA;

View File

@@ -98,7 +98,7 @@
#endif
#ifndef SQL_NO_DATA
#define SQL_NO_DATA SQL_NO_DATA_FOUND
# define SQL_NO_DATA SQL_NO_DATA_FOUND
#endif
HB_FUNC( SQLALLOCENV ) /* @hEnv --> nRetCode */

View File

@@ -55,7 +55,7 @@
#include "hbvm.h"
#if defined( HB_OS_WIN )
#include <windows.h>
# include <windows.h>
#endif
#if defined( __XCC__ ) || defined( __LCC__ )

View File

@@ -90,7 +90,7 @@ HB_FUNC( __ACCEPTSTR )
HB_FUNC( __ACCEPT )
{
char szAcceptResult[ ACCEPT_BUFFER_LEN ];
HB_SIZE ulLen = 0;
HB_SIZE nLen = 0;
int input = 0;
/* cPrompt(s) passed ? */
@@ -107,24 +107,24 @@ HB_FUNC( __ACCEPT )
{
case K_BS:
case K_LEFT:
if( ulLen > 0 )
if( nLen > 0 )
{
hb_conOutAlt( "\x8", sizeof( char ) ); /* Erase it from the screen. */
ulLen--; /* Adjust input count to get rid of last character */
--nLen; /* Adjust input count to get rid of last character */
}
break;
default:
if( ulLen < ( ACCEPT_BUFFER_LEN - 1 ) && input >= 32 && input <= 255 )
if( nLen < ( ACCEPT_BUFFER_LEN - 1 ) && input >= 32 && input <= 255 )
{
szAcceptResult[ ulLen ] = ( char ) input; /* Accept the input */
hb_conOutAlt( &szAcceptResult[ ulLen ], sizeof( char ) ); /* Then display it */
ulLen++; /* Then adjust the input count */
szAcceptResult[ nLen ] = ( char ) input; /* Accept the input */
hb_conOutAlt( &szAcceptResult[ nLen ], sizeof( char ) ); /* Then display it */
++nLen; /* Then adjust the input count */
}
}
}
szAcceptResult[ ulLen ] = '\0';
szAcceptResult[ nLen ] = '\0';
#ifdef HB_CLP_UNDOC
hb_strncpy( hb_acceptBuffer(), szAcceptResult, ACCEPT_BUFFER_LEN - 1 );

View File

@@ -54,22 +54,22 @@
HB_FUNC( AMPM )
{
HB_SIZE ulTimeLen = hb_parclen( 1 );
char * pszResult = ( char * ) hb_xgrab( HB_MAX( ulTimeLen, 2 ) + 3 + 1 );
HB_SIZE nTimeLen = hb_parclen( 1 );
char * pszResult = ( char * ) hb_xgrab( HB_MAX( nTimeLen, 2 ) + 3 + 1 );
int iHour = 0;
HB_BOOL bAM;
if( ulTimeLen )
if( nTimeLen )
{
const char * pszTime = hb_parc( 1 );
memcpy( pszResult, pszTime, ulTimeLen );
iHour = ( int ) hb_strVal( pszTime, ulTimeLen );
memcpy( pszResult, pszTime, nTimeLen );
iHour = ( int ) hb_strVal( pszTime, nTimeLen );
}
if( iHour == 0 || iHour == 24 )
{
if( ulTimeLen < 2 )
ulTimeLen = 2;
if( nTimeLen < 2 )
nTimeLen = 2;
pszResult[ 0 ] = '1';
pszResult[ 1 ] = '2';
@@ -77,8 +77,8 @@ HB_FUNC( AMPM )
}
else if( iHour > 12 )
{
if( ulTimeLen < 2 )
ulTimeLen = 2;
if( nTimeLen < 2 )
nTimeLen = 2;
iHour -= 12;
pszResult[ 0 ] = ( char ) ( iHour / 10 ) + '0';
@@ -92,7 +92,7 @@ HB_FUNC( AMPM )
else
bAM = ( iHour != 12 );
memcpy( pszResult + ulTimeLen, bAM ? " am" : " pm", 4 );
memcpy( pszResult + nTimeLen, bAM ? " am" : " pm", 4 );
hb_retclen_buffer( pszResult, ulTimeLen + 3 );
hb_retclen_buffer( pszResult, nTimeLen + 3 );
}

View File

@@ -63,25 +63,25 @@ HB_FUNC( HB_AT )
if( pText && pSub )
{
HB_SIZE ulTextLength = hb_itemGetCLen( pText );
HB_SIZE ulStart = HB_ISNUM( 3 ) ? hb_parnl( 3 ) : 1;
HB_SIZE ulEnd = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parnl( 4 ) : ulTextLength;
HB_SIZE ulPos;
HB_SIZE nTextLength = hb_itemGetCLen( pText );
HB_SIZE nStart = HB_ISNUM( 3 ) ? hb_parnl( 3 ) : 1;
HB_SIZE nEnd = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parnl( 4 ) : nTextLength;
HB_SIZE nPos;
if( ulStart > ulTextLength || ulEnd < ulStart )
if( nStart > nTextLength || nEnd < nStart )
hb_retnl( 0 );
else
{
if( ulEnd > ulTextLength )
ulEnd = ulTextLength;
if( nEnd > nTextLength )
nEnd = nTextLength;
ulPos = hb_strAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ),
hb_itemGetCPtr( pText ) + ulStart - 1, ulEnd - ulStart + 1 );
nPos = hb_strAt( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ),
hb_itemGetCPtr( pText ) + nStart - 1, nEnd - nStart + 1 );
if( ulPos > 0 )
ulPos += ( ulStart - 1 );
if( nPos > 0 )
nPos += ( nStart - 1 );
hb_retnl( ulPos );
hb_retnl( nPos );
}
}
else

View File

@@ -55,34 +55,34 @@
#include "hbapiitm.h"
#include "hbapierr.h"
static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE ulSubLen, const char * szText, HB_SIZE ulLen )
static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strAt(%s, %lu, %s, %lu)", szSub, ulSubLen, szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strAt(%s, %lu, %s, %lu)", 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( hb_charLower( szText[ ulPos ] ) == hb_charLower( szSub[ ulSubPos ] ) )
if( hb_charLower( szText[ nPos ] ) == hb_charLower( 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;
@@ -98,7 +98,7 @@ HB_FUNC( HB_ATI )
HB_SIZE ulTextLength = hb_itemGetCLen( pText );
HB_SIZE ulStart = HB_ISNUM( 3 ) ? hb_parnl( 3 ) : 1;
HB_SIZE ulEnd = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parnl( 4 ) : ulTextLength;
HB_SIZE ulPos;
HB_SIZE nPos;
if( ulStart > ulTextLength || ulEnd < ulStart )
hb_retnl( 0 );
@@ -107,13 +107,13 @@ HB_FUNC( HB_ATI )
if( ulEnd > ulTextLength )
ulEnd = ulTextLength;
ulPos = hb_strAtI( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ),
hb_itemGetCPtr( pText ) + ulStart - 1, ulEnd - ulStart + 1 );
nPos = hb_strAtI( hb_itemGetCPtr( pSub ), hb_itemGetCLen( pSub ),
hb_itemGetCPtr( pText ) + ulStart - 1, ulEnd - ulStart + 1 );
if( ulPos > 0 )
ulPos += ( ulStart - 1 );
if( nPos > 0 )
nPos += ( ulStart - 1 );
hb_retnl( ulPos );
hb_retnl( nPos );
}
}
else

View File

@@ -61,8 +61,8 @@ HB_FUNC( BIN2W )
if( pItem )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
if( ulLen )
HB_SIZE nLen = hb_itemGetCLen( pItem );
if( nLen )
{
const char * pszString = hb_itemGetCPtr( pItem );
uiResult = HB_GET_LE_INT16( pszString );
@@ -78,8 +78,8 @@ HB_FUNC( BIN2I )
if( pItem )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
if( ulLen )
HB_SIZE nLen = hb_itemGetCLen( pItem );
if( nLen )
{
const char * pszString = hb_itemGetCPtr( pItem );
iResult = HB_GET_LE_UINT16( pszString );
@@ -95,11 +95,11 @@ HB_FUNC( BIN2L )
if( pItem )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
if( ulLen )
HB_SIZE nLen = hb_itemGetCLen( pItem );
if( nLen )
{
const char * pszString = hb_itemGetCPtr( pItem );
if( ulLen >= 3 )
if( nLen >= 3 )
iResult = HB_GET_LE_INT32( pszString );
else
iResult = HB_GET_LE_UINT16( pszString );

View File

@@ -65,11 +65,11 @@ HB_FUNC( BIN2U )
if( pItem )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
if( ulLen )
HB_SIZE nLen = hb_itemGetCLen( pItem );
if( nLen )
{
const char * pszString = hb_itemGetCPtr( pItem );
if( ulLen >= 3 )
if( nLen >= 3 )
uiResult = HB_GET_LE_UINT32( pszString );
else
uiResult = HB_GET_LE_UINT16( pszString );

View File

@@ -221,38 +221,38 @@ int hb_charUpper( int iChar )
return HB_TOUPPER( iChar );
}
char * hb_strLower( char * szText, HB_SIZE ulLen )
char * hb_strLower( char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strLower(%s, %lu)", szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strLower(%s, %lu)", szText, nLen));
{
PHB_CODEPAGE cdp = hb_vmCDP();
HB_SIZE u;
if( cdp )
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
szText[ u ] = ( char ) cdp->lower[ ( HB_UCHAR ) szText[ u ] ];
else
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
szText[ u ] = HB_TOLOWER( szText[ u ] );
}
return szText;
}
char * hb_strUpper( char * szText, HB_SIZE ulLen )
char * hb_strUpper( char * szText, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strUpper(%s, %lu)", szText, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strUpper(%s, %lu)", szText, nLen));
{
PHB_CODEPAGE cdp = hb_vmCDP();
HB_SIZE u;
if( cdp )
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
szText[ u ] = ( char ) cdp->upper[ ( HB_UCHAR ) szText[ u ] ];
else
for( u = 0; u < ulLen; u++ )
for( u = 0; u < nLen; u++ )
szText[ u ] = HB_TOUPPER( szText[ u ] );
}
@@ -311,28 +311,28 @@ static int hb_cdpMultiWeight( PHB_CODEPAGE cdp, const char * szChar )
return 0;
}
int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
const char * szSecond, HB_SIZE ulLenSecond,
int hb_cdpcmp( const char * szFirst, HB_SIZE nLenFirst,
const char * szSecond, HB_SIZE nLenSecond,
PHB_CODEPAGE cdp, HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n, n1, n2;
HB_SIZE ul, ulLen;
HB_SIZE ul, nLen;
ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
if( cdp->sort == NULL )
{
iRet = memcmp( szFirst, szSecond, ulLen );
iRet = memcmp( szFirst, szSecond, nLen );
}
else if( cdp->nMulti )
{
for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul )
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
{
HB_UCHAR u1 = ( HB_UCHAR ) * szFirst;
HB_UCHAR u2 = ( HB_UCHAR ) * szSecond;
n1 = cdp->sort[ u1 ];
if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < ulLenFirst - 1 ) &&
( ul < nLenFirst - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMultiWeight( cdp, szFirst );
@@ -340,13 +340,13 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
{
n1 = n;
++szFirst;
if( --ulLenFirst < ulLen )
ulLen = ulLenFirst;
if( --nLenFirst < nLen )
nLen = nLenFirst;
}
}
n2 = cdp->sort[ u2 ];
if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < ulLenSecond - 1 ) &&
( ul < nLenSecond - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMultiWeight( cdp, szSecond );
@@ -354,8 +354,8 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
{
n2 = n;
++szSecond;
if( --ulLenSecond < ulLen )
ulLen = ulLenSecond;
if( --nLenSecond < nLen )
nLen = nLenSecond;
}
}
if( n1 != n2 )
@@ -374,7 +374,7 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
iRet = ( u1 < u2 ) ? -1 : 1;
break;
}
if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) )
if( iAcc == 0 && ( fExact || ( nLenFirst == nLenSecond && cdp->acc ) ) )
{
if( cdp->acc )
iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1;
@@ -386,7 +386,7 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
}
else
{
for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul )
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
{
if( *szFirst != *szSecond )
{
@@ -397,7 +397,7 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
iRet = ( n1 < n2 ) ? -1 : 1;
break;
}
if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) )
if( iAcc == 0 && ( fExact || ( nLenFirst == nLenSecond && cdp->acc ) ) )
{
if( cdp->acc )
iAcc = ( cdp->acc[ ( HB_UCHAR ) * szFirst ] <
@@ -413,9 +413,9 @@ int hb_cdpcmp( const char * szFirst, HB_SIZE ulLenFirst,
{
if( iAcc )
iRet = iAcc;
else if( ulLenSecond > ulLenFirst )
else if( nLenSecond > nLenFirst )
iRet = -1;
else if( fExact && ulLenSecond < ulLenFirst )
else if( fExact && nLenSecond < nLenFirst )
iRet = 1;
}
@@ -441,17 +441,17 @@ static int hb_cdpMultiWeightI( PHB_CODEPAGE cdp, const char * szChar )
return 0;
}
int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
const char * szSecond, HB_SIZE ulLenSecond,
int hb_cdpicmp( const char * szFirst, HB_SIZE nLenFirst,
const char * szSecond, HB_SIZE nLenSecond,
PHB_CODEPAGE cdp, HB_BOOL fExact )
{
int iRet = 0, iAcc = 0, n, n1, n2, u1, u2;
HB_SIZE ul, ulLen;
HB_SIZE ul, nLen;
ulLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond;
nLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
if( cdp->sort == NULL )
{
for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul )
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
{
u1 = cdp->upper[ ( HB_UCHAR ) * szFirst ];
u2 = cdp->upper[ ( HB_UCHAR ) * szSecond ];
@@ -464,13 +464,13 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
}
else if( cdp->nMulti )
{
for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul )
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
{
u1 = cdp->upper[ ( HB_UCHAR ) * szFirst ];
u2 = cdp->upper[ ( HB_UCHAR ) * szSecond ];
if( ( cdp->flags[ u1 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < ulLenFirst - 1 ) &&
( ul < nLenFirst - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szFirst[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMultiWeightI( cdp, szFirst );
@@ -478,8 +478,8 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
{
n1 = n;
++szFirst;
if( --ulLenFirst < ulLen )
ulLen = ulLenFirst;
if( --nLenFirst < nLen )
nLen = nLenFirst;
}
else
n1 = cdp->sort[ u1 ];
@@ -488,7 +488,7 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
n1 = cdp->sort[ u1 ];
if( ( cdp->flags[ u2 ] & HB_CDP_MULTI1 ) != 0 &&
( ul < ulLenSecond - 1 ) &&
( ul < nLenSecond - 1 ) &&
( cdp->flags[ ( HB_UCHAR ) szSecond[ 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
n = hb_cdpMultiWeightI( cdp, szSecond );
@@ -496,8 +496,8 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
{
n2 = n;
++szSecond;
if( --ulLenSecond < ulLen )
ulLen = ulLenSecond;
if( --nLenSecond < nLen )
nLen = nLenSecond;
}
else
n2 = cdp->sort[ u2 ];
@@ -521,7 +521,7 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
iRet = ( u1 < u2 ) ? -1 : 1;
break;
}
if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) )
if( iAcc == 0 && ( fExact || ( nLenFirst == nLenSecond && cdp->acc ) ) )
{
if( cdp->acc )
iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1;
@@ -533,7 +533,7 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
}
else
{
for( ul = 0; ul < ulLen; ++szFirst, ++szSecond, ++ul )
for( ul = 0; ul < nLen; ++szFirst, ++szSecond, ++ul )
{
u1 = cdp->upper[ ( HB_UCHAR ) * szFirst ];
u2 = cdp->upper[ ( HB_UCHAR ) * szSecond ];
@@ -547,7 +547,7 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
iRet = ( n1 < n2 ) ? -1 : 1;
break;
}
if( iAcc == 0 && ( fExact || ( ulLenFirst == ulLenSecond && cdp->acc ) ) )
if( iAcc == 0 && ( fExact || ( nLenFirst == nLenSecond && cdp->acc ) ) )
{
if( cdp->acc )
iAcc = ( cdp->acc[ u1 ] < cdp->acc[ u2 ] ) ? -1 : 1;
@@ -562,9 +562,9 @@ int hb_cdpicmp( const char * szFirst, HB_SIZE ulLenFirst,
{
if( iAcc )
iRet = iAcc;
else if( ulLenSecond > ulLenFirst )
else if( nLenSecond > nLenFirst )
iRet = -1;
else if( fExact && ulLenSecond < ulLenFirst )
else if( fExact && nLenSecond < nLenFirst )
iRet = 1;
}
@@ -690,42 +690,42 @@ HB_BOOL hb_cdpUTF8ToU16NextChar( HB_UCHAR ucChar, int * n, HB_WCHAR * pwc )
return HB_TRUE;
}
HB_SIZE hb_cdpUTF8StringLength( const char * pSrc, HB_SIZE ulLen )
HB_SIZE hb_cdpUTF8StringLength( const char * pSrc, HB_SIZE nLen )
{
HB_SIZE ul, ulDst;
HB_SIZE ul, nDst;
HB_WCHAR uc;
int n = 0;
for( ul = ulDst = 0; ul < ulLen; ++ul )
for( ul = nDst = 0; ul < nLen; ++ul )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ul ], &n, &uc ) )
{
if( n == 0 )
++ulDst;
++nDst;
}
}
return ulDst;
return nDst;
}
HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE ulLen, HB_SIZE ulPos )
HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE nLen, HB_SIZE nPos )
{
if( ulLen )
if( nLen )
{
HB_SIZE ul;
HB_WCHAR uc = 0;
int n = 0;
for( ul = 0; ul < ulLen && ulPos; ++ul )
for( ul = 0; ul < nLen && nPos; ++ul )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ul ], &n, &uc ) )
{
if( n == 0 )
--ulPos;
--nPos;
}
}
if( ul < ulLen )
if( ul < nLen )
{
n = 0;
do
@@ -736,7 +736,7 @@ HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE ulLen, HB_SIZE ulPos )
return uc;
}
}
while( ++ul < ulLen );
while( ++ul < nLen );
}
}
@@ -744,50 +744,50 @@ HB_SIZE hb_cdpUTF8StringPeek( const char * pSrc, HB_SIZE ulLen, HB_SIZE ulPos )
}
/* caller must free the returned buffer if not NULL */
char * hb_cdpUTF8StringSubstr( const char * pSrc, HB_SIZE ulLen,
HB_SIZE ulFrom, HB_SIZE ulCount, HB_SIZE * pulDest )
char * hb_cdpUTF8StringSubstr( const char * pSrc, HB_SIZE nLen,
HB_SIZE nFrom, HB_SIZE nCount, HB_SIZE * pulDest )
{
HB_SIZE ul, ulCnt, ulDst = 0;
HB_SIZE ul, nCnt, nDst = 0;
HB_WCHAR uc;
int n;
char * pDst = NULL;
if( ulCount && ulLen )
if( nCount && nLen )
{
n = 0;
for( ul = 0; ul < ulLen && ulFrom; ++ul )
for( ul = 0; ul < nLen && nFrom; ++ul )
{
if( hb_cdpUTF8ToU16NextChar( pSrc[ ul ], &n, &uc ) )
{
if( n == 0 )
--ulFrom;
--nFrom;
}
}
if( ul < ulLen )
if( ul < nLen )
{
ulFrom = ul;
ulCnt = ulCount;
nFrom = ul;
nCnt = nCount;
n = 0;
do
{
if( hb_cdpUTF8ToU16NextChar( pSrc[ ul ], &n, &uc ) )
{
if( n == 0 )
--ulCnt;
--nCnt;
}
}
while( ++ul < ulLen && ulCnt );
while( ++ul < nLen && nCnt );
ulDst = ul - ulFrom;
pDst = ( char * ) hb_xgrab( ulDst + 1 );
memcpy( pDst, &pSrc[ ulFrom ], ulDst );
pDst[ ulDst ] = '\0';
nDst = ul - nFrom;
pDst = ( char * ) hb_xgrab( nDst + 1 );
memcpy( pDst, &pSrc[ nFrom ], nDst );
pDst[ nDst ] = '\0';
}
}
if( pulDest )
*pulDest = ulDst;
*pulDest = nDst;
return pDst;
}
@@ -815,15 +815,15 @@ HB_BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl, HB_UCHAR ch,
}
HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const char * pSrc, HB_SIZE ulSrc,
HB_SIZE ulMax )
const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
const HB_WCHAR * uniCodes;
HB_SIZE ulS, ulD, u;
int i;
uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < ulSrc; ++ulS )
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_WCHAR wc;
@@ -835,7 +835,7 @@ HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
wc = uniCodes[ uc ];
if( cdp->nMultiUC &&
( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ulS + 1 < ulSrc &&
ulS + 1 < nSrc &&
( cdp->flags[ ( HB_UCHAR ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdp->nMulti; ++i )
@@ -860,7 +860,7 @@ HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
}
u = hb_cdpUTF8CharSize( wc );
if( ulMax && ulD + u > ulMax )
if( nMax && ulD + u > nMax )
break;
ulD += u;
}
@@ -869,15 +869,15 @@ HB_SIZE hb_cdpStrAsUTF8Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const char * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE ulDst )
const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst )
{
const HB_WCHAR * uniCodes;
HB_SIZE ulS, ulD, u;
int i;
uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS )
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_WCHAR wc;
@@ -889,7 +889,7 @@ HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
wc = uniCodes[ uc ];
if( cdp->nMultiUC &&
( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ulS + 1 < ulSrc &&
ulS + 1 < nSrc &&
( cdp->flags[ ( HB_UCHAR ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdp->nMulti; ++i )
@@ -914,7 +914,7 @@ HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
}
u = hb_cdpUTF8CharSize( wc );
if( ulD + u <= ulDst )
if( ulD + u <= nDst )
{
hb_cdpU16CharToUTF8( &pDst[ ulD ], wc );
ulD += u;
@@ -922,15 +922,15 @@ HB_SIZE hb_cdpStrToUTF8( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
else
break;
}
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD ] = '\0';
return ulD;
}
HB_SIZE hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const char * pSrc, HB_SIZE ulSrc,
HB_SIZE ulMax )
const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc = 0;
@@ -942,14 +942,14 @@ HB_SIZE hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < ulSrc; ++ulS )
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
{
if( n == 0 )
{
++ulD;
if( ulMax && ulD >= ulMax )
if( nMax && ulD >= nMax )
break;
if( wc && cdp->nMultiUC && ( fCtrl || wc >= 32 ) &&
( wc > wcMax || uniTrans[ wc ] == 0 ) )
@@ -963,7 +963,7 @@ HB_SIZE hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
break;
}
}
if( ulMax && ulD >= ulMax )
if( nMax && ulD >= nMax )
break;
}
}
@@ -974,8 +974,8 @@ HB_SIZE hb_cdpUTF8AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const char * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE ulDst )
const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst )
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc = 0;
@@ -987,7 +987,7 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS )
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) pSrc[ ulS ], &n, &wc ) )
{
@@ -1006,14 +1006,14 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
if( wc == cdp->multi[ i ].wcUp )
{
pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 0 ];
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 0 ];
break;
}
if( wc == cdp->multi[ i ].wcLo )
{
pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 1 ];
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 1 ];
break;
}
@@ -1027,7 +1027,7 @@ HB_SIZE hb_cdpUTF8ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
}
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD ] = '\0';
return ulD;
@@ -1062,22 +1062,22 @@ HB_UCHAR hb_cdpGetChar( PHB_CODEPAGE cdp, HB_BOOL fCtrl, HB_WCHAR wc )
}
HB_SIZE hb_cdpStrAsU16Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const char * pSrc, HB_SIZE ulSrc,
HB_SIZE ulMax )
const char * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
if( cdp->nMultiUC )
{
HB_SIZE ulS, ulD;
int i;
for( ulS = ulD = 0; ulS < ulSrc; ++ulS )
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
if( fCtrl || uc >= 32 )
{
if( ( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ulS + 1 < ulSrc &&
ulS + 1 < nSrc &&
( cdp->flags[ ( HB_UCHAR ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdp->nMulti; ++i )
@@ -1100,25 +1100,25 @@ HB_SIZE hb_cdpStrAsU16Len( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
}
++ulD;
if( ulMax && ulD >= ulMax )
if( nMax && ulD >= nMax )
break;
}
return ulD;
}
return ulSrc;
return nSrc;
}
HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
const char * pSrc, HB_SIZE ulSrc,
HB_WCHAR * pDst, HB_SIZE ulDst )
const char * pSrc, HB_SIZE nSrc,
HB_WCHAR * pDst, HB_SIZE nDst )
{
const HB_WCHAR * uniCodes;
HB_SIZE ulS, ulD;
int i;
uniCodes = cdp->uniTable->uniCodes;
for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS )
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulS ];
HB_WCHAR wc;
@@ -1130,7 +1130,7 @@ HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
wc = uniCodes[ uc ];
if( cdp->nMultiUC &&
( cdp->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ulS + 1 < ulSrc &&
ulS + 1 < nSrc &&
( cdp->flags[ ( HB_UCHAR ) pSrc[ ulS + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdp->nMulti; ++i )
@@ -1172,15 +1172,15 @@ HB_SIZE hb_cdpStrToU16( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
pDst[ ulD++ ] = wc;
#endif
}
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD ] = '\0';
return ulD;
}
HB_SIZE hb_cdpU16AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
const HB_WCHAR * pSrc, HB_SIZE ulSrc,
HB_SIZE ulMax )
const HB_WCHAR * pSrc, HB_SIZE nSrc,
HB_SIZE nMax )
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc;
@@ -1192,11 +1192,11 @@ HB_SIZE hb_cdpU16AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < ulSrc; ++ulS )
for( ulS = ulD = 0; ulS < nSrc; ++ulS )
{
wc = pSrc[ ulS ];
++ulD;
if( ulMax && ulD >= ulMax )
if( nMax && ulD >= nMax )
break;
if( wc && cdp->nMultiUC && ( fCtrl || wc >= 32 ) &&
( wc > wcMax || uniTrans[ wc ] == 0 ) )
@@ -1210,7 +1210,7 @@ HB_SIZE hb_cdpU16AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
break;
}
}
if( ulMax && ulD >= ulMax )
if( nMax && ulD >= nMax )
break;
}
}
@@ -1219,8 +1219,8 @@ HB_SIZE hb_cdpU16AsStrLen( PHB_CODEPAGE cdp, HB_BOOL fCtrl,
}
HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
const HB_WCHAR * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE ulDst )
const HB_WCHAR * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst )
{
HB_UCHAR * uniTrans;
HB_WCHAR wcMax, wc;
@@ -1232,7 +1232,7 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
uniTrans = cdp->uniTable->uniTrans;
wcMax = cdp->uniTable->wcMax;
for( ulS = ulD = 0; ulS < ulSrc && ulD < ulDst; ++ulS )
for( ulS = ulD = 0; ulS < nSrc && ulD < nDst; ++ulS )
{
#if !defined( HB_BIG_ENDIAN ) && !defined( HB_LITTLE_ENDIAN )
if( iEndian == HB_CDP_ENDIAN_LITTLE )
@@ -1263,14 +1263,14 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
if( wc == cdp->multi[ i ].wcUp )
{
pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 0 ];
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 0 ];
break;
}
if( wc == cdp->multi[ i ].wcLo )
{
pDst[ ulD++ ] = cdp->multi[ i ].cFirst[ 1 ];
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD++ ] = cdp->multi[ i ].cLast[ 1 ];
break;
}
@@ -1282,7 +1282,7 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
}
}
if( ulD < ulDst )
if( ulD < nDst )
pDst[ ulD ] = '\0';
return ulD;
@@ -1292,17 +1292,17 @@ HB_SIZE hb_cdpU16ToStr( PHB_CODEPAGE cdp, HB_BOOL fCtrl, int iEndian,
/*
* CP translations
*/
HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE ulSrc, HB_SIZE ulMax,
HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE nSrc, HB_SIZE nMax,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
HB_SIZE ulSize;
HB_SIZE nSize;
if( cdpIn && cdpOut && cdpIn->uniTable != cdpOut->uniTable )
{
if( cdpIn == &s_utf8_codepage )
return hb_cdpUTF8AsStrLen( cdpOut, HB_FALSE, pSrc, ulSrc, ulMax );
return hb_cdpUTF8AsStrLen( cdpOut, HB_FALSE, pSrc, nSrc, nMax );
else if( cdpOut == &s_utf8_codepage )
return hb_cdpStrAsUTF8Len( cdpIn, HB_FALSE, pSrc, ulSrc, ulMax );
return hb_cdpStrAsUTF8Len( cdpIn, HB_FALSE, pSrc, nSrc, nMax );
else
{
HB_UCHAR * uniTrans;
@@ -1318,14 +1318,14 @@ HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE ulSrc, HB_SIZE ulMax,
HB_SIZE ul;
int i;
for( ul = ulSize = 0; ul < ulSrc && ( ulMax == 0 || ulSize < ulMax ); ++ul, ++ulSize )
for( ul = nSize = 0; ul < nSrc && ( nMax == 0 || nSize < nMax ); ++ul, ++nSize )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ul ];
HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ];
if( cdpIn->nMultiUC &&
( cdpIn->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ul + 1 < ulSrc &&
ul + 1 < nSrc &&
( cdpIn->flags[ ( HB_UCHAR ) pSrc[ ul + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdpIn->nMulti; ++i )
@@ -1350,14 +1350,14 @@ HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE ulSrc, HB_SIZE ulMax,
}
if( wc && ( wc > wcMax || uniTrans[ wc ] ) && cdpOut->nMultiUC &&
( ulMax == 0 || ulSize + 1 < ulMax ) )
( nMax == 0 || nSize + 1 < nMax ) )
{
for( i = 0; i < cdpOut->nMulti; ++i )
{
if( wc == cdpOut->multi[ i ].wcUp ||
wc == cdpOut->multi[ i ].wcLo )
{
++ulSize;
++nSize;
break;
}
}
@@ -1365,27 +1365,27 @@ HB_SIZE hb_cdpTransLen( const char * pSrc, HB_SIZE ulSrc, HB_SIZE ulMax,
}
}
else
ulSize = ( ulMax && ulSrc > ulMax ) ? ulMax : ulSrc;
nSize = ( nMax && nSrc > nMax ) ? nMax : nSrc;
}
}
else
ulSize = ( ulMax && ulSrc > ulMax ) ? ulMax : ulSrc;
nSize = ( nMax && nSrc > nMax ) ? nMax : nSrc;
return ulSize;
return nSize;
}
HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE ulDst,
HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE nDst,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
HB_SIZE ulSize;
HB_SIZE nSize;
if( cdpIn && cdpOut && cdpIn->uniTable != cdpOut->uniTable )
{
if( cdpIn == &s_utf8_codepage )
return hb_cdpUTF8ToStr( cdpOut, HB_FALSE, pSrc, ulSrc, pDst, ulDst );
return hb_cdpUTF8ToStr( cdpOut, HB_FALSE, pSrc, nSrc, pDst, nDst );
else if( cdpOut == &s_utf8_codepage )
return hb_cdpStrToUTF8( cdpIn, HB_FALSE, pSrc, ulSrc, pDst, ulDst );
return hb_cdpStrToUTF8( cdpIn, HB_FALSE, pSrc, nSrc, pDst, nDst );
else
{
HB_UCHAR * uniTrans;
@@ -1401,14 +1401,14 @@ HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE ulSrc,
HB_SIZE ul;
int i;
for( ul = ulSize = 0; ul < ulSrc && ulSize < ulDst; ++ul, ++ulSize )
for( ul = nSize = 0; ul < nSrc && nSize < nDst; ++ul, ++nSize )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ul ];
HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ];
if( cdpIn->nMultiUC &&
( cdpIn->flags[ uc ] & HB_CDP_MULTI1 ) != 0 &&
ul + 1 < ulSrc &&
ul + 1 < nSrc &&
( cdpIn->flags[ ( HB_UCHAR ) pSrc[ ul + 1 ] ] & HB_CDP_MULTI2 ) != 0 )
{
for( i = 0; i < cdpIn->nMulti; ++i )
@@ -1442,9 +1442,9 @@ HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE ulSrc,
{
if( wc == cdpOut->multi[ i ].wcUp )
{
if( ulSize + 1 < ulDst )
if( nSize + 1 < nDst )
{
pDst[ ulSize++ ] = cdpOut->multi[ i ].cFirst[ 0 ];
pDst[ nSize++ ] = cdpOut->multi[ i ].cFirst[ 0 ];
uc = cdpOut->multi[ i ].cLast[ 0 ];
}
else
@@ -1453,9 +1453,9 @@ HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE ulSrc,
}
if( wc == cdpOut->multi[ i ].wcLo )
{
if( ulSize + 1 < ulDst )
if( nSize + 1 < nDst )
{
pDst[ ulSize++ ] = cdpOut->multi[ i ].cFirst[ 1 ];
pDst[ nSize++ ] = cdpOut->multi[ i ].cFirst[ 1 ];
uc = cdpOut->multi[ i ].cLast[ 1 ];
}
else
@@ -1466,34 +1466,34 @@ HB_SIZE hb_cdpTransTo( const char * pSrc, HB_SIZE ulSrc,
}
}
pDst[ ulSize ] = uc;
pDst[ nSize ] = uc;
}
}
else
{
if( ulSrc > ulDst )
ulSrc = ulDst;
for( ulSize = 0; ulSize < ulSrc; ++ulSize )
if( nSrc > nDst )
nSrc = nDst;
for( nSize = 0; nSize < nSrc; ++nSize )
{
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ ulSize ];
HB_UCHAR uc = ( HB_UCHAR ) pSrc[ nSize ];
HB_WCHAR wc = cdpIn->uniTable->uniCodes[ uc ];
if( wc && wc <= wcMax && uniTrans[ wc ] )
uc = uniTrans[ wc ];
pDst[ ulSize ] = uc;
pDst[ nSize ] = uc;
}
}
}
}
else
{
ulSize = ( ulSrc > ulDst ) ? ulDst : ulSrc;
memcpy( pDst, pSrc, ulSize );
nSize = ( nSrc > nDst ) ? nDst : nSrc;
memcpy( pDst, pSrc, nSize );
}
if( ulSize < ulDst )
pDst[ ulSize ] = '\0';
if( nSize < nDst )
pDst[ nSize ] = '\0';
return ulSize;
return nSize;
}
int hb_cdpTranslateChar( int iChar, HB_BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
@@ -1515,84 +1515,84 @@ int hb_cdpTranslateChar( int iChar, HB_BOOL fCtrl, PHB_CODEPAGE cdpIn, PHB_CODEP
return iChar;
}
HB_SIZE hb_cdpnDupLen( const char * pSrc, HB_SIZE ulSrc,
HB_SIZE hb_cdpnDupLen( const char * pSrc, HB_SIZE nSrc,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
return hb_cdpTransLen( pSrc, ulSrc, 0, cdpIn, cdpOut );
return hb_cdpTransLen( pSrc, nSrc, 0, cdpIn, cdpOut );
}
HB_SIZE hb_cdpnDup2Len( const char * pSrc, HB_SIZE ulSrc, HB_SIZE ulMax,
HB_SIZE hb_cdpnDup2Len( const char * pSrc, HB_SIZE nSrc, HB_SIZE nMax,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
return hb_cdpTransLen( pSrc, ulSrc, ulMax, cdpIn, cdpOut );
return hb_cdpTransLen( pSrc, nSrc, nMax, cdpIn, cdpOut );
}
char * hb_cdpnDup( const char * pSrc, HB_SIZE * pulLen,
char * hb_cdpnDup( const char * pSrc, HB_SIZE * pnLen,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
char * pDst;
HB_SIZE ulDst;
HB_SIZE nDst;
ulDst = hb_cdpTransLen( pSrc, *pulLen, 0, cdpIn, cdpOut );
pDst = ( char * ) hb_xgrab( ulDst + 1 );
hb_cdpTransTo( pSrc, *pulLen, pDst, ulDst + 1, cdpIn, cdpOut );
*pulLen = ulDst;
nDst = hb_cdpTransLen( pSrc, *pnLen, 0, cdpIn, cdpOut );
pDst = ( char * ) hb_xgrab( nDst + 1 );
hb_cdpTransTo( pSrc, *pnLen, pDst, nDst + 1, cdpIn, cdpOut );
*pnLen = nDst;
return pDst;
}
const char * hb_cdpnDup2( const char * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE * pulDst,
const char * hb_cdpnDup2( const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE * pnDst,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
* pulDst = hb_cdpTransTo( pSrc, ulSrc, pDst, *pulDst, cdpIn, cdpOut );
* pnDst = hb_cdpTransTo( pSrc, nSrc, pDst, *pnDst, cdpIn, cdpOut );
return pDst;
}
const char * hb_cdpnDup3( const char * pSrc, HB_SIZE ulSrc,
char * pDst, HB_SIZE * pulDst,
char ** pFree, HB_SIZE * pulSize,
const char * hb_cdpnDup3( const char * pSrc, HB_SIZE nSrc,
char * pDst, HB_SIZE * pnDst,
char ** pFree, HB_SIZE * pnSize,
PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
if( cdpIn && cdpOut && cdpIn->uniTable != cdpOut->uniTable && ulSrc )
if( cdpIn && cdpOut && cdpIn->uniTable != cdpOut->uniTable && nSrc )
{
char * pPrev = NULL;
HB_SIZE ulDst = hb_cdpTransLen( pSrc, ulSrc, 0, cdpIn, cdpOut );
HB_SIZE nDst = hb_cdpTransLen( pSrc, nSrc, 0, cdpIn, cdpOut );
if( pDst == NULL )
{
pDst = *pFree;
if( pDst == NULL && *pulSize > 0 )
if( pDst == NULL && *pnSize > 0 )
pDst = ( char * ) pSrc;
}
if( ulDst >= *pulSize || ( pDst == pSrc &&
if( nDst >= *pnSize || ( pDst == pSrc &&
( cdpOut == &s_utf8_codepage || cdpOut->nMultiUC ) ) )
{
pPrev = *pFree;
pDst = *pFree = ( char * ) hb_xgrab( ulDst + 1 );
*pulSize = ulDst + 1;
pDst = *pFree = ( char * ) hb_xgrab( nDst + 1 );
*pnSize = nDst + 1;
}
ulDst = hb_cdpTransTo( pSrc, ulSrc, pDst, *pulSize, cdpIn, cdpOut );
nDst = hb_cdpTransTo( pSrc, nSrc, pDst, *pnSize, cdpIn, cdpOut );
if( pPrev )
hb_xfree( pPrev );
if( pulDst )
*pulDst = ulDst;
if( pnDst )
*pnDst = nDst;
return pDst;
}
if( pulDst )
*pulDst = ulSrc;
if( pnDst )
*pnDst = nSrc;
return pSrc;
}
char * hb_cdpDup( const char * pszSrc, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
HB_SIZE ulLen = ( HB_SIZE ) strlen( pszSrc );
return hb_cdpnDup( pszSrc, &ulLen, cdpIn, cdpOut );
HB_SIZE nLen = ( HB_SIZE ) strlen( pszSrc );
return hb_cdpnDup( pszSrc, &nLen, cdpIn, cdpOut );
}
@@ -1609,7 +1609,7 @@ static PHB_CODEPAGE hb_buildCodePage( const char * id, const char * info,
int iMulti, iAcc, iAccUp, iAccLo, iSortUp, iSortLo, i;
const char * pup, * plo;
HB_UCHAR ucUp, ucLo, ucUp2, ucLo2;
HB_SIZE ulSize, ul;
HB_SIZE nSize, ul;
HB_UCHAR * buffer, * flags, * upper, * lower, * sort, * acc;
HB_UCHAR used[ 256 ];
PHB_CODEPAGE cdp;
@@ -1725,20 +1725,20 @@ static PHB_CODEPAGE hb_buildCodePage( const char * id, const char * info,
else if( nACSort != HB_CDP_ACSORT_NONE )
lSort = HB_TRUE;
ulSize = 0x300;
nSize = 0x300;
if( lSort )
{
ulSize += 0x100;
nSize += 0x100;
if( nACSort == HB_CDP_ACSORT_INTERLEAVED )
ulSize += 0x100;
nSize += 0x100;
}
ul = ulSize;
ulSize += sizeof( HB_CODEPAGE );
ul = nSize;
nSize += sizeof( HB_CODEPAGE );
if( iMulti )
ulSize += iMulti * sizeof( HB_MULTICHAR );
nSize += iMulti * sizeof( HB_MULTICHAR );
buffer = ( HB_UCHAR * ) hb_xgrab( ulSize );
memset( buffer, '\0', ulSize );
buffer = ( HB_UCHAR * ) hb_xgrab( nSize );
memset( buffer, '\0', nSize );
cdp = ( PHB_CODEPAGE ) &buffer[ ul ];
cdp->buffer = buffer;

View File

@@ -66,23 +66,23 @@
#define HB_MAX_UTF8 3
static HB_SIZE utf8pos( const char * szUTF8, HB_SIZE ulLen, HB_SIZE ulUTF8Pos )
static HB_SIZE utf8pos( const char * szUTF8, HB_SIZE nLen, HB_SIZE nUTF8Pos )
{
if( ulUTF8Pos )
if( nUTF8Pos )
{
HB_SIZE ul, ul2;
HB_SIZE n1, n2;
HB_WCHAR uc;
int n = 0;
for( ul = ul2 = 0; ul < ulLen; ++ul )
for( n1 = n2 = 0; n1 < nLen; ++n1 )
{
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) szUTF8[ ul ], &n, &uc ) )
if( hb_cdpUTF8ToU16NextChar( ( HB_UCHAR ) szUTF8[ n1 ], &n, &uc ) )
{
if( n == 0 )
{
if( --ulUTF8Pos == 0 )
return ul2 + 1;
ul2 = ul + 1;
if( --nUTF8Pos == 0 )
return n2 + 1;
n2 = n1 + 1;
}
}
}
@@ -129,19 +129,19 @@ HB_FUNC( __NATSORTVER )
*/
HB_FUNC( HB_TRANSLATE )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
const char * szIdIn = hb_parc( 2 );
const char * szIdOut = hb_parc( 3 );
if( ulLen && ( szIdIn || szIdOut ) )
if( nLen && ( szIdIn || szIdOut ) )
{
PHB_CODEPAGE cdpIn = szIdIn ? hb_cdpFindExt( szIdIn ) : hb_vmCDP();
PHB_CODEPAGE cdpOut = szIdOut ? hb_cdpFindExt( szIdOut ) : hb_vmCDP();
if( cdpIn && cdpOut && cdpIn->uniTable != cdpOut->uniTable )
{
char * szResult = hb_cdpnDup( hb_parc( 1 ), &ulLen, cdpIn, cdpOut );
hb_retclen_buffer( szResult, ulLen );
char * szResult = hb_cdpnDup( hb_parc( 1 ), &nLen, cdpIn, cdpOut );
hb_retclen_buffer( szResult, nLen );
}
else
hb_itemReturn( hb_param( 1, HB_IT_STRING ) );
@@ -170,11 +170,11 @@ HB_FUNC( HB_UTF8ASC )
if( pszString )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nLen = hb_parclen( 1 );
HB_WCHAR wc = 0;
int n = 0;
while( ulLen-- )
while( nLen-- )
{
if( hb_cdpUTF8ToU16NextChar( ( unsigned char ) *pszString++, &n, &wc ) )
{
@@ -190,24 +190,24 @@ HB_FUNC( HB_UTF8ASC )
HB_FUNC( HB_STRTOUTF8 )
{
HB_SIZE ulLen = hb_parclen( 1 ), ulDest = 0;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
const char * szString;
char * szDest = NULL;
if( ulLen )
if( nLen )
{
PHB_CODEPAGE cdp = HB_ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_vmCDP();
if( cdp )
{
szString = hb_parc( 1 );
ulDest = hb_cdpStrAsUTF8Len( cdp, HB_FALSE, szString, ulLen, 0 );
szDest = ( char * ) hb_xgrab( ulDest + 1 );
hb_cdpStrToUTF8( cdp, HB_FALSE, szString, ulLen, szDest, ulDest + 1 );
nDest = hb_cdpStrAsUTF8Len( cdp, HB_FALSE, szString, nLen, 0 );
szDest = ( char * ) hb_xgrab( nDest + 1 );
hb_cdpStrToUTF8( cdp, HB_FALSE, szString, nLen, szDest, nDest + 1 );
}
}
if( szDest )
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
@@ -218,24 +218,24 @@ HB_FUNC( HB_UTF8TOSTR )
if( szString )
{
HB_SIZE ulLen = hb_parclen( 1 ), ulDest = 0;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
char * szDest = NULL;
if( ulLen )
if( nLen )
{
PHB_CODEPAGE cdp = HB_ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_vmCDP();
if( cdp )
{
szString = hb_parc( 1 );
ulDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, szString, ulLen, 0 );
szDest = ( char * ) hb_xgrab( ulDest + 1 );
hb_cdpUTF8ToStr( cdp, HB_FALSE, szString, ulLen, szDest, ulDest + 1 );
nDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, szString, nLen, 0 );
szDest = ( char * ) hb_xgrab( nDest + 1 );
hb_cdpUTF8ToStr( cdp, HB_FALSE, szString, nLen, szDest, nDest + 1 );
}
}
if( szDest )
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
@@ -251,24 +251,24 @@ HB_FUNC( HB_UTF8SUBSTR )
if( szString && ( iPCount < 2 || ( HB_ISNUM( 2 ) && ( iPCount < 3 || HB_ISNUM( 3 ) ) ) ) )
{
char * szDest = NULL;
HB_SIZE ulLen = hb_parclen( 1 ), ulDest = 0;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
HB_ISIZ lFrom = hb_parnl( 2 );
HB_ISIZ lCount = iPCount < 3 ? ( HB_ISIZ ) ulLen : hb_parnl( 3 );
HB_ISIZ lCount = iPCount < 3 ? ( HB_ISIZ ) nLen : hb_parnl( 3 );
if( lFrom < 0 )
{
lFrom += hb_cdpUTF8StringLength( szString, ulLen );
lFrom += hb_cdpUTF8StringLength( szString, nLen );
if( lFrom < 0 )
lFrom = 0;
}
else if( lFrom )
--lFrom;
if( ulLen && lCount > 0 )
szDest = hb_cdpUTF8StringSubstr( szString, ulLen,
lFrom, lCount, &ulDest );
if( nLen && lCount > 0 )
szDest = hb_cdpUTF8StringSubstr( szString, nLen,
lFrom, lCount, &nDest );
if( szDest )
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
@@ -282,16 +282,16 @@ HB_FUNC( HB_UTF8LEFT )
if( szString && HB_ISNUM( 2 ) )
{
HB_ISIZ lLen = hb_parnl( 2 );
HB_SIZE ulDest = 0;
HB_ISIZ lLenReq = hb_parnl( 2 );
HB_SIZE nDest = 0;
char * szDest = NULL;
if( lLen > 0 )
if( lLenReq > 0 )
szDest = hb_cdpUTF8StringSubstr( szString, hb_parclen( 1 ),
0, lLen, &ulDest );
0, lLenReq, &nDest );
if( szDest )
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
@@ -305,21 +305,21 @@ HB_FUNC( HB_UTF8RIGHT )
if( szString && HB_ISNUM( 2 ) )
{
HB_ISIZ lLen = hb_parnl( 2 ), lFrom;
HB_SIZE ulLen = hb_parclen( 1 ), ulDest = 0;
HB_ISIZ lLenReq = hb_parnl( 2 ), lFrom;
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
char * szDest = NULL;
if( ulLen && lLen > 0 )
if( nLen && lLenReq > 0 )
{
lFrom = hb_cdpUTF8StringLength( szString, ulLen ) - lLen;
lFrom = hb_cdpUTF8StringLength( szString, nLen ) - lLenReq;
if( lFrom < 0 )
lFrom = 0;
szDest = hb_cdpUTF8StringSubstr( szString, ulLen,
lFrom, lLen, &ulDest );
szDest = hb_cdpUTF8StringSubstr( szString, nLen,
lFrom, lLenReq, &nDest );
}
if( szDest )
hb_retclen_buffer( szDest, ulDest );
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
@@ -333,11 +333,11 @@ HB_FUNC( HB_UTF8PEEK )
if( szString && HB_ISNUM( 2 ) )
{
HB_SIZE ulPos = hb_parnl( 2 );
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE nPos = hb_parnl( 2 );
HB_SIZE nLen = hb_parclen( 1 );
if( ulPos > 0 && ulPos <= ulLen )
hb_retnint( hb_cdpUTF8StringPeek( szString, ulLen, ulPos - 1 ) );
if( nPos > 0 && nPos <= nLen )
hb_retnint( hb_cdpUTF8StringPeek( szString, nLen, nPos - 1 ) );
else
hb_retni( 0 );
}
@@ -352,40 +352,40 @@ HB_FUNC( HB_UTF8POKE )
if( pText && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
{
const char * szString = hb_itemGetCPtr( pText );
HB_SIZE ulLen = hb_parclen( 1 ), ulPos;
HB_SIZE nLen = hb_parclen( 1 ), nPos;
ulPos = utf8pos( szString, ulLen, hb_parnl( 2 ) );
if( ulPos )
nPos = utf8pos( szString, nLen, hb_parnl( 2 ) );
if( nPos )
{
HB_WCHAR uc, uc2;
int n, n2;
--ulPos;
--nPos;
uc = ( HB_WCHAR ) hb_parni( 3 );
n = hb_cdpUTF8CharSize( uc );
n2 = 0;
hb_cdpUTF8ToU16NextChar( szString[ulPos], &n2, &uc2 );
hb_cdpUTF8ToU16NextChar( szString[nPos], &n2, &uc2 );
++n2;
if( n == n2 )
{
char * szText;
if( hb_itemGetWriteCL( pText, &szText, &ulLen ) &&
ulPos + n <= ulLen )
if( hb_itemGetWriteCL( pText, &szText, &nLen ) &&
nPos + n <= nLen )
{
hb_cdpU16CharToUTF8( &szText[ulPos], uc );
hb_cdpU16CharToUTF8( &szText[nPos], uc );
}
hb_itemReturn( pText );
}
else
{
char * szResult = ( char * ) hb_xgrab( ulLen - n2 + n + 1 );
char * szResult = ( char * ) hb_xgrab( nLen - n2 + n + 1 );
memcpy( szResult, szString, ulPos );
hb_cdpU16CharToUTF8( &szResult[ulPos], uc );
memcpy( szResult + ulPos + n, szString + ulPos + n2, ulLen - ulPos - n2 );
memcpy( szResult, szString, nPos );
hb_cdpU16CharToUTF8( &szResult[nPos], uc );
memcpy( szResult + nPos + n, szString + nPos + n2, nLen - nPos - n2 );
if( HB_ISBYREF( 1 ) )
hb_storclen( szResult, ulLen - n2 + n, 1 );
hb_retclen_buffer( szResult, ulLen - n2 + n );
hb_storclen( szResult, nLen - n2 + n, 1 );
hb_retclen_buffer( szResult, nLen - n2 + n );
}
}
else
@@ -401,43 +401,43 @@ HB_FUNC( HB_UTF8STUFF )
if( szString && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISCHAR( 4 ) )
{
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE ulPos = hb_parnl( 2 );
HB_SIZE ulDel = hb_parnl( 3 );
HB_SIZE ulIns = hb_parclen( 4 );
HB_SIZE ulTot;
HB_SIZE nLen = hb_parclen( 1 );
HB_SIZE nPos = hb_parnl( 2 );
HB_SIZE nDel = hb_parnl( 3 );
HB_SIZE nIns = hb_parclen( 4 );
HB_SIZE nTot;
if( ulPos )
if( nPos )
{
ulPos = utf8pos( szString, ulLen, ulPos );
if( ulPos == 0 )
ulPos = ulLen;
nPos = utf8pos( szString, nLen, nPos );
if( nPos == 0 )
nPos = nLen;
else
ulPos--;
nPos--;
}
if( ulDel )
if( nDel )
{
if( ulPos < ulLen )
if( nPos < nLen )
{
ulDel = utf8pos( szString + ulPos, ulLen - ulPos, ulDel + 1 );
if( ulDel == 0 )
ulDel = ulLen - ulPos;
nDel = utf8pos( szString + nPos, nLen - nPos, nDel + 1 );
if( nDel == 0 )
nDel = nLen - nPos;
else
ulDel--;
nDel--;
}
else
ulDel = 0;
nDel = 0;
}
if( ( ulTot = ulLen + ulIns - ulDel ) > 0 )
if( ( nTot = nLen + nIns - nDel ) > 0 )
{
char * szResult = ( char * ) hb_xgrab( ulTot + 1 );
char * szResult = ( char * ) hb_xgrab( nTot + 1 );
hb_xmemcpy( szResult, szString, ulPos );
hb_xmemcpy( szResult + ulPos, hb_parc( 4 ), ulIns );
hb_xmemcpy( szResult + ulPos + ulIns, szString + ulPos + ulDel,
ulLen - ( ulPos + ulDel ) );
hb_retclen_buffer( szResult, ulTot );
hb_xmemcpy( szResult, szString, nPos );
hb_xmemcpy( szResult + nPos, hb_parc( 4 ), nIns );
hb_xmemcpy( szResult + nPos + nIns, szString + nPos + nDel,
nLen - ( nPos + nDel ) );
hb_retclen_buffer( szResult, nTot );
}
else
hb_retc_null();

View File

@@ -208,88 +208,88 @@ HB_FUNC( HB_OSNEWLINE )
}
/* Output an item to STDOUT */
void hb_conOutStd( const char * szStr, HB_SIZE ulLen )
void hb_conOutStd( const char * szStr, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_conOutStd(%s, %lu)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_conOutStd(%s, %lu)", szStr, nLen));
if( ulLen == 0 )
ulLen = ( HB_SIZE ) strlen( szStr );
if( nLen == 0 )
nLen = ( HB_SIZE ) strlen( szStr );
if( ulLen > 0 )
hb_gtOutStd( szStr, ulLen );
if( nLen > 0 )
hb_gtOutStd( szStr, nLen );
}
/* Output an item to STDERR */
void hb_conOutErr( const char * szStr, HB_SIZE ulLen )
void hb_conOutErr( const char * szStr, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_conOutErr(%s, %lu)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_conOutErr(%s, %lu)", szStr, nLen));
if( ulLen == 0 )
ulLen = ( HB_SIZE ) strlen( szStr );
if( nLen == 0 )
nLen = ( HB_SIZE ) strlen( szStr );
if( ulLen > 0 )
hb_gtOutErr( szStr, ulLen );
if( nLen > 0 )
hb_gtOutErr( szStr, nLen );
}
/* Output an item to the screen and/or printer and/or alternate */
void hb_conOutAlt( const char * szStr, HB_SIZE ulLen )
void hb_conOutAlt( const char * szStr, HB_SIZE nLen )
{
HB_FHANDLE hFile;
HB_TRACE(HB_TR_DEBUG, ("hb_conOutAlt(%s, %lu)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_conOutAlt(%s, %lu)", szStr, nLen));
if( hb_setGetConsole() )
hb_gtWriteCon( szStr, ulLen );
hb_gtWriteCon( szStr, nLen );
if( hb_setGetAlternate() && ( hFile = hb_setGetAltHan() ) != FS_ERROR )
{
/* Print to alternate file if SET ALTERNATE ON and valid alternate file */
hb_fsWriteLarge( hFile, szStr, ulLen );
hb_fsWriteLarge( hFile, szStr, nLen );
}
if( ( hFile = hb_setGetExtraHan() ) != FS_ERROR )
{
/* Print to extra file if valid alternate file */
hb_fsWriteLarge( hFile, szStr, ulLen );
hb_fsWriteLarge( hFile, szStr, nLen );
}
if( ( hFile = hb_setGetPrinterHandle( HB_SET_PRN_CON ) ) != FS_ERROR )
{
/* Print to printer if SET PRINTER ON and valid printer file */
hb_fsWriteLarge( hFile, szStr, ulLen );
hb_prnPos()->col += ( int ) ulLen;
hb_fsWriteLarge( hFile, szStr, nLen );
hb_prnPos()->col += ( int ) nLen;
}
}
/* Output an item to the screen and/or printer */
static void hb_conOutDev( const char * szStr, HB_SIZE ulLen )
static void hb_conOutDev( const char * szStr, HB_SIZE nLen )
{
HB_FHANDLE hFile;
HB_TRACE(HB_TR_DEBUG, ("hb_conOutDev(%s, %lu)", szStr, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_conOutDev(%s, %lu)", szStr, nLen));
if( ( hFile = hb_setGetPrinterHandle( HB_SET_PRN_DEV ) ) != FS_ERROR )
{
/* Display to printer if SET DEVICE TO PRINTER and valid printer file */
hb_fsWriteLarge( hFile, szStr, ulLen );
hb_prnPos()->col += ( int ) ulLen;
hb_fsWriteLarge( hFile, szStr, nLen );
hb_prnPos()->col += ( int ) nLen;
}
else
/* Otherwise, display to console */
hb_gtWrite( szStr, ulLen );
hb_gtWrite( szStr, nLen );
}
static char * hb_itemStringCon( PHB_ITEM pItem, HB_SIZE * pulLen, HB_BOOL * pfFreeReq )
static char * hb_itemStringCon( PHB_ITEM pItem, HB_SIZE * pnLen, HB_BOOL * pfFreeReq )
{
/* logical values in device output (not console, stdout or stderr) are
shown as single letter */
if( HB_IS_LOGICAL( pItem ) )
{
*pulLen = 1;
*pnLen = 1;
*pfFreeReq = HB_FALSE;
return ( char * ) ( hb_itemGetL( pItem ) ? "T" : "F" );
}
return hb_itemString( pItem, pulLen, pfFreeReq );
return hb_itemString( pItem, pnLen, pfFreeReq );
}
HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */
@@ -299,14 +299,14 @@ HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fFree;
if( iParam > 1 )
hb_conOutStd( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
if( ulLen )
hb_conOutStd( pszString, ulLen );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &nLen, &fFree );
if( nLen )
hb_conOutStd( pszString, nLen );
if( fFree )
hb_xfree( pszString );
}
@@ -319,14 +319,14 @@ HB_FUNC( OUTERR ) /* writes a list of values to the standard error device */
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fFree;
if( iParam > 1 )
hb_conOutErr( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
if( ulLen )
hb_conOutErr( pszString, ulLen );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &nLen, &fFree );
if( nLen )
hb_conOutErr( pszString, nLen );
if( fFree )
hb_xfree( pszString );
}
@@ -339,14 +339,14 @@ HB_FUNC( QQOUT ) /* writes a list of values to the current device (screen or pri
for( iParam = 1; iParam <= iPCount; iParam++ )
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fFree;
if( iParam > 1 )
hb_conOutAlt( " ", 1 );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree );
if( ulLen )
hb_conOutAlt( pszString, ulLen );
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &nLen, &fFree );
if( nLen )
hb_conOutAlt( pszString, nLen );
if( fFree )
hb_xfree( pszString );
}
@@ -510,7 +510,7 @@ HB_FUNC( SETPRC ) /* Sets the current printer row and column positions */
HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or printer), but is not affected by SET ALTERNATE */
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL fFree;
if( HB_ISCHAR( 2 ) )
@@ -520,9 +520,9 @@ HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or prin
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 2 ) );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &ulLen, &fFree );
if( ulLen )
hb_conOutDev( pszString, ulLen );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &nLen, &fFree );
if( nLen )
hb_conOutDev( pszString, nLen );
if( fFree )
hb_xfree( pszString );
@@ -530,9 +530,9 @@ HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or prin
}
else if( hb_pcount() >= 1 )
{
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &ulLen, &fFree );
if( ulLen )
hb_conOutDev( pszString, ulLen );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &nLen, &fFree );
if( nLen )
hb_conOutDev( pszString, nLen );
if( fFree )
hb_xfree( pszString );
}
@@ -541,7 +541,7 @@ HB_FUNC( DEVOUT ) /* writes a single value to the current device (screen or prin
HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected by SET ALTERNATE */
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL bFreeReq;
if( HB_ISCHAR( 2 ) )
@@ -551,9 +551,9 @@ HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected b
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 2 ) );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &ulLen, &bFreeReq );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &nLen, &bFreeReq );
hb_gtWrite( pszString, ulLen );
hb_gtWrite( pszString, nLen );
if( bFreeReq )
hb_xfree( pszString );
@@ -562,9 +562,9 @@ HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected b
}
else if( hb_pcount() >= 1 )
{
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &ulLen, &bFreeReq );
pszString = hb_itemStringCon( hb_param( 1, HB_IT_ANY ), &nLen, &bFreeReq );
hb_gtWrite( pszString, ulLen );
hb_gtWrite( pszString, nLen );
if( bFreeReq )
hb_xfree( pszString );
@@ -578,7 +578,7 @@ HB_FUNC( DISPOUT ) /* writes a single value to the screen, but is not affected b
HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position, but is not affected by SET ALTERNATE */
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL bFreeReq;
if( HB_ISCHAR( 4 ) )
@@ -588,9 +588,9 @@ HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 4 ) );
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &ulLen, &bFreeReq );
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &nLen, &bFreeReq );
hb_gtWriteAt( hb_parni( 1 ), hb_parni( 2 ), pszString, ulLen );
hb_gtWriteAt( hb_parni( 1 ), hb_parni( 2 ), pszString, nLen );
if( bFreeReq )
hb_xfree( pszString );
@@ -599,9 +599,9 @@ HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position
}
else if( hb_pcount() >= 3 )
{
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &ulLen, &bFreeReq );
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &nLen, &bFreeReq );
hb_gtWriteAt( hb_parni( 1 ), hb_parni( 2 ), pszString, ulLen );
hb_gtWriteAt( hb_parni( 1 ), hb_parni( 2 ), pszString, nLen );
if( bFreeReq )
hb_xfree( pszString );
@@ -615,11 +615,11 @@ HB_FUNC( HB_DISPOUTAT )
if( hb_pcount() >= 3 )
{
char * pszString;
HB_SIZE ulLen;
HB_SIZE nLen;
HB_BOOL bFreeReq;
int iColor;
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &ulLen, &bFreeReq );
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &nLen, &bFreeReq );
if( HB_ISCHAR( 4 ) )
iColor = hb_gtColorToN( hb_parc( 4 ) );
@@ -628,7 +628,7 @@ HB_FUNC( HB_DISPOUTAT )
else
iColor = -1;
hb_gtPutText( hb_parni( 1 ), hb_parni( 2 ), pszString, ulLen, iColor );
hb_gtPutText( hb_parni( 1 ), hb_parni( 2 ), pszString, nLen, iColor );
if( bFreeReq )
hb_xfree( pszString );

View File

@@ -53,15 +53,15 @@
#include "hbapi.h"
#include "hbapiitm.h"
void hb_strDescend( char * szStringTo, const char * szStringFrom, HB_SIZE ulLen )
void hb_strDescend( char * szStringTo, const char * szStringFrom, HB_SIZE nLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_strDescend(%p, %s, %lu)", szStringTo, szStringFrom, ulLen));
HB_TRACE(HB_TR_DEBUG, ("hb_strDescend(%p, %s, %lu)", szStringTo, szStringFrom, nLen));
if( ulLen == 1 && szStringFrom[ 0 ] == '\0' )
if( nLen == 1 && szStringFrom[ 0 ] == '\0' )
szStringTo[ 0 ] = '\0';
else
{
for(; ulLen--; szStringTo++, szStringFrom++ )
for(; nLen--; szStringTo++, szStringFrom++ )
*szStringTo = ( char ) ( 256 - *szStringFrom );
}
}
@@ -74,13 +74,13 @@ HB_FUNC( DESCEND )
{
if( HB_IS_STRING( pItem ) )
{
HB_SIZE ulLen = hb_itemGetCLen( pItem );
HB_SIZE nLen = hb_itemGetCLen( pItem );
if( ulLen > 0 )
if( nLen > 0 )
{
char * szBuffer = ( char * ) hb_xgrab( ulLen + 1 );
hb_strDescend( szBuffer, hb_itemGetCPtr( pItem ), ulLen );
hb_retclen_buffer( szBuffer, ulLen );
char * szBuffer = ( char * ) hb_xgrab( nLen + 1 );
hb_strDescend( szBuffer, hb_itemGetCPtr( pItem ), nLen );
hb_retclen_buffer( szBuffer, nLen );
}
else
hb_retc_null();

View File

@@ -516,16 +516,16 @@ static HB_BOOL s_fileLock( PHB_FILE pFile, HB_FOFFSET ulStart, HB_FOFFSET ulLen,
return fResult;
}
static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * buffer, HB_SIZE ulSize,
static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * buffer, HB_SIZE nSize,
HB_FOFFSET llOffset )
{
return hb_fsReadAt( pFile->hFile, buffer, ulSize, llOffset );
return hb_fsReadAt( pFile->hFile, buffer, nSize, llOffset );
}
static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * buffer, HB_SIZE ulSize,
static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * buffer, HB_SIZE nSize,
HB_FOFFSET llOffset )
{
return hb_fsWriteAt( pFile->hFile, buffer, ulSize, llOffset );
return hb_fsWriteAt( pFile->hFile, buffer, nSize, llOffset );
}
static HB_BOOL s_fileTruncAt( PHB_FILE pFile, HB_FOFFSET llOffset )
@@ -669,16 +669,16 @@ HB_BOOL hb_fileLock( PHB_FILE pFile, HB_FOFFSET ulStart, HB_FOFFSET ulLen,
return pFile->pFuncs->Lock( pFile, ulStart, ulLen, iType );
}
HB_SIZE hb_fileReadAt( PHB_FILE pFile, void * buffer, HB_SIZE ulSize,
HB_SIZE hb_fileReadAt( PHB_FILE pFile, void * buffer, HB_SIZE nSize,
HB_FOFFSET llOffset )
{
return pFile->pFuncs->ReadAt( pFile, buffer, ulSize, llOffset );
return pFile->pFuncs->ReadAt( pFile, buffer, nSize, llOffset );
}
HB_SIZE hb_fileWriteAt( PHB_FILE pFile, const void * buffer, HB_SIZE ulSize,
HB_SIZE hb_fileWriteAt( PHB_FILE pFile, const void * buffer, HB_SIZE nSize,
HB_FOFFSET llOffset )
{
return pFile->pFuncs->WriteAt( pFile, buffer, ulSize, llOffset );
return pFile->pFuncs->WriteAt( pFile, buffer, nSize, llOffset );
}
HB_BOOL hb_fileTruncAt( PHB_FILE pFile, HB_FOFFSET llOffset )

View File

@@ -4530,7 +4530,6 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
cOpt_Link := StrTran( cOpt_Link, "{LB}" , ArrayToList( l_aLIBA,, nOpt_Esc ) )
cOpt_Link := StrTran( cOpt_Link, "{OE}" , FN_Escape( PathSepToTarget( hbmk, l_cPROGNAME ), nOpt_Esc ) )
cOpt_Link := StrTran( cOpt_Link, "{OM}" , FN_Escape( PathSepToTarget( hbmk, FN_ExtSet( l_cPROGNAME, ".map" ) ), nOpt_Esc ) )
cOpt_Link := StrTran( cOpt_Link, "{OI}" , FN_Escape( PathSepToTarget( hbmk, FN_ExtSet( l_cPROGNAME, cLibLibExt ) ), nOpt_Esc ) )
cOpt_Link := StrTran( cOpt_Link, "{DL}" , ArrayToList( hbmk[ _HBMK_aLIBPATH ], cLibPathSep, nOpt_Esc, cLibPathPrefix ) )
cOpt_Link := StrTran( cOpt_Link, "{DB}" , l_cHB_BIN_INSTALL )
@@ -4619,6 +4618,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
cOpt_Dyn := StrTran( cOpt_Dyn, "{LB}" , ArrayToList( l_aLIBA,, nOpt_Esc ) )
cOpt_Dyn := StrTran( cOpt_Dyn, "{OD}" , FN_Escape( PathSepToTarget( hbmk, l_cPROGNAME ), nOpt_Esc ) )
cOpt_Dyn := StrTran( cOpt_Dyn, "{OM}" , FN_Escape( PathSepToTarget( hbmk, FN_ExtSet( l_cPROGNAME, ".map" ) ), nOpt_Esc ) )
cOpt_Dyn := StrTran( cOpt_Dyn, "{OI}" , FN_Escape( PathSepToTarget( hbmk, FN_ExtSet( l_cPROGNAME, cLibLibExt ) ), nOpt_Esc ) )
cOpt_Dyn := StrTran( cOpt_Dyn, "{DL}" , ArrayToList( hbmk[ _HBMK_aLIBPATH ], cLibPathSep, nOpt_Esc, cLibPathPrefix ) )
cOpt_Dyn := StrTran( cOpt_Dyn, "{DB}" , l_cHB_BIN_INSTALL )