2010-07-07 22:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/vm/fm.c
! Fixed two remaining format strings for size value.
* src/nortl/nortl.c
! Fixed format strings for size value. (BTW the signedness
differs from fm.c, is this intended?)
* long -> HB_ISIZ in fm stat.
* src/rdd/dbfcdx/dbfcdx1.c
* HB_ULONG -> HB_SIZE in hb_cdxSortSortPage().
* src/nortl/nortl.c
* src/macro/macrolex.c
* src/rtl/gtwin/gtwin.c
* src/rtl/gtstd/gtstd.c
* src/rtl/gtcgi/gtcgi.c
* src/rtl/gtpca/gtpca.c
* src/rtl/gtwvt/gtwvt.c
* src/rdd/dbfntx/dbfntx1.c
* src/rdd/dbfnsx/dbfnsx1.c
* src/rdd/dbfcdx/dbfcdx1.c
* src/rdd/dbsql.c
* src/rdd/wacore.c
* src/rdd/sdf1.c
* src/rdd/dbcmd.c
* src/rdd/delim1.c
* src/rdd/dbf1.c
* src/rdd/hsx/hsx.c
* src/rdd/usrrdd/usrrdd.c
* src/rdd/hbsix/sxfname.c
* src/rdd/hbsix/sxtable.c
* src/rdd/hbsix/sxutil.c
* src/rdd/hbsix/sxcompr.c
* src/rdd/hbsix/sxcrypt.c
* HB_SIZE/HB_ISIZ variables renamed.
(objects verified)
This commit is contained in:
@@ -16,6 +16,44 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-07-07 22:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/vm/fm.c
|
||||
! Fixed two remaining format strings for size value.
|
||||
|
||||
* src/nortl/nortl.c
|
||||
! Fixed format strings for size value. (BTW the signedness
|
||||
differs from fm.c, is this intended?)
|
||||
* long -> HB_ISIZ in fm stat.
|
||||
|
||||
* src/rdd/dbfcdx/dbfcdx1.c
|
||||
* HB_ULONG -> HB_SIZE in hb_cdxSortSortPage().
|
||||
|
||||
* src/nortl/nortl.c
|
||||
* src/macro/macrolex.c
|
||||
* src/rtl/gtwin/gtwin.c
|
||||
* src/rtl/gtstd/gtstd.c
|
||||
* src/rtl/gtcgi/gtcgi.c
|
||||
* src/rtl/gtpca/gtpca.c
|
||||
* src/rtl/gtwvt/gtwvt.c
|
||||
* src/rdd/dbfntx/dbfntx1.c
|
||||
* src/rdd/dbfnsx/dbfnsx1.c
|
||||
* src/rdd/dbfcdx/dbfcdx1.c
|
||||
* src/rdd/dbsql.c
|
||||
* src/rdd/wacore.c
|
||||
* src/rdd/sdf1.c
|
||||
* src/rdd/dbcmd.c
|
||||
* src/rdd/delim1.c
|
||||
* src/rdd/dbf1.c
|
||||
* src/rdd/hsx/hsx.c
|
||||
* src/rdd/usrrdd/usrrdd.c
|
||||
* src/rdd/hbsix/sxfname.c
|
||||
* src/rdd/hbsix/sxtable.c
|
||||
* src/rdd/hbsix/sxutil.c
|
||||
* src/rdd/hbsix/sxcompr.c
|
||||
* src/rdd/hbsix/sxcrypt.c
|
||||
* HB_SIZE/HB_ISIZ variables renamed.
|
||||
(objects verified)
|
||||
|
||||
2010-07-07 20:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/make.hbs
|
||||
! Fixed stdalone mode to create target in their usual GNU Make
|
||||
|
||||
@@ -61,8 +61,8 @@ typedef struct _HB_MACRO_LEX
|
||||
{
|
||||
const char * pString;
|
||||
char * pDst;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE ulSrc;
|
||||
HB_SIZE nLen;
|
||||
HB_SIZE nSrc;
|
||||
HB_BOOL quote;
|
||||
char pBuffer[ 2 ];
|
||||
}
|
||||
@@ -81,8 +81,8 @@ HB_BOOL hb_macroLexNew( HB_MACRO_PTR pMacro )
|
||||
*/
|
||||
pMacro->pLex = hb_xgrab( sizeof( HB_MACRO_LEX ) + pMacro->length );
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->pString = pMacro->string;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->ulLen = pMacro->length;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->ulSrc = 0;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->nLen = pMacro->length;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->nSrc = 0;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->quote = HB_TRUE;
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->pDst =
|
||||
( ( PHB_MACRO_LEX ) pMacro->pLex )->pBuffer;
|
||||
@@ -103,17 +103,17 @@ void hb_macroLexDelete( HB_MACRO_PTR pMacro )
|
||||
|
||||
static void hb_lexSkipBlank( PHB_MACRO_LEX pLex )
|
||||
{
|
||||
while( pLex->ulSrc < pLex->ulLen &&
|
||||
( pLex->pString[ pLex->ulSrc ] == ' ' ||
|
||||
pLex->pString[ pLex->ulSrc ] == '\t' ) )
|
||||
pLex->ulSrc++;
|
||||
while( pLex->nSrc < pLex->nLen &&
|
||||
( pLex->pString[ pLex->nSrc ] == ' ' ||
|
||||
pLex->pString[ pLex->nSrc ] == '\t' ) )
|
||||
pLex->nSrc++;
|
||||
}
|
||||
|
||||
static void hb_lexIdentCopy( PHB_MACRO_LEX pLex )
|
||||
{
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
char ch = pLex->pString[ pLex->ulSrc ];
|
||||
char ch = pLex->pString[ pLex->nSrc ];
|
||||
if( ch >= 'a' && ch <= 'z' )
|
||||
*pLex->pDst++ = ch - ( 'a' - 'A' );
|
||||
else if( ( ch >= 'A' && ch <= 'Z' ) ||
|
||||
@@ -121,7 +121,7 @@ static void hb_lexIdentCopy( PHB_MACRO_LEX pLex )
|
||||
*pLex->pDst++ = ch;
|
||||
else
|
||||
break;
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,9 @@ static int hb_lexTimestampGet( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro,
|
||||
char * dst = pLex->pDst;
|
||||
|
||||
pLex->quote = HB_FALSE;
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
char ch = pLex->pString[ pLex->ulSrc++ ];
|
||||
char ch = pLex->pString[ pLex->nSrc++ ];
|
||||
if( ch == '"' )
|
||||
{
|
||||
fOK = HB_TRUE;
|
||||
@@ -160,9 +160,9 @@ static int hb_lexDateGet( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro,
|
||||
int iYear, iMonth, iDay;
|
||||
|
||||
pLex->quote = HB_FALSE;
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
char ch = pLex->pString[ pLex->ulSrc++ ];
|
||||
char ch = pLex->pString[ pLex->nSrc++ ];
|
||||
if( ch == '"' )
|
||||
{
|
||||
fOK = HB_TRUE;
|
||||
@@ -189,9 +189,9 @@ static int hb_lexStringCopy( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro,
|
||||
{
|
||||
pLex->quote = HB_FALSE;
|
||||
yylval_ptr->valChar.string = pLex->pDst;
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
char ch = pLex->pString[ pLex->ulSrc++ ];
|
||||
char ch = pLex->pString[ pLex->nSrc++ ];
|
||||
if( ch == cDelim )
|
||||
{
|
||||
yylval_ptr->valChar.length = pLex->pDst - yylval_ptr->valChar.string;
|
||||
@@ -209,58 +209,58 @@ static int hb_lexStringCopy( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro,
|
||||
static int hb_lexStringExtCopy( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro,
|
||||
PHB_MACRO_LEX pLex )
|
||||
{
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
pLex->quote = HB_FALSE;
|
||||
yylval_ptr->valChar.string = pLex->pDst;
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
char ch = pLex->pString[ pLex->ulSrc++ ];
|
||||
char ch = pLex->pString[ pLex->nSrc++ ];
|
||||
if( ch == '\\' )
|
||||
{
|
||||
if( pLex->ulSrc < pLex->ulLen )
|
||||
if( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
*pLex->pDst++ = ch;
|
||||
ch = pLex->pString[ pLex->ulSrc++ ];
|
||||
ch = pLex->pString[ pLex->nSrc++ ];
|
||||
}
|
||||
}
|
||||
else if( ch == '"' )
|
||||
{
|
||||
ulLen = pLex->pDst - yylval_ptr->valChar.string;
|
||||
nLen = pLex->pDst - yylval_ptr->valChar.string;
|
||||
*pLex->pDst++ = '\0';
|
||||
hb_strRemEscSeq( ( char * ) yylval_ptr->valChar.string, &ulLen );
|
||||
yylval_ptr->valChar.length = ulLen;
|
||||
hb_strRemEscSeq( ( char * ) yylval_ptr->valChar.string, &nLen );
|
||||
yylval_ptr->valChar.length = nLen;
|
||||
return LITERAL;
|
||||
}
|
||||
*pLex->pDst++ = ch;
|
||||
}
|
||||
ulLen = pLex->pDst - yylval_ptr->valChar.string;
|
||||
nLen = pLex->pDst - yylval_ptr->valChar.string;
|
||||
*pLex->pDst++ = '\0';
|
||||
hb_strRemEscSeq( ( char * ) yylval_ptr->valChar.string, &ulLen );
|
||||
yylval_ptr->valChar.length = ulLen;
|
||||
hb_strRemEscSeq( ( char * ) yylval_ptr->valChar.string, &nLen );
|
||||
yylval_ptr->valChar.length = nLen;
|
||||
hb_macroError( EG_SYNTAX, pMacro );
|
||||
return LITERAL;
|
||||
}
|
||||
|
||||
static int hb_lexNumConv( YYSTYPE *yylval_ptr, PHB_MACRO_LEX pLex, HB_SIZE ulLen )
|
||||
static int hb_lexNumConv( YYSTYPE *yylval_ptr, PHB_MACRO_LEX pLex, HB_SIZE nLen )
|
||||
{
|
||||
HB_MAXINT lNumber;
|
||||
double dNumber;
|
||||
int iDec, iWidth;
|
||||
|
||||
if( hb_compStrToNum( pLex->pString + pLex->ulSrc, ulLen,
|
||||
if( hb_compStrToNum( pLex->pString + pLex->nSrc, nLen,
|
||||
&lNumber, &dNumber, &iDec, &iWidth ) )
|
||||
{
|
||||
yylval_ptr->valDouble.dNumber = dNumber;
|
||||
yylval_ptr->valDouble.bDec = ( HB_UCHAR ) iDec;
|
||||
yylval_ptr->valDouble.bWidth = ( HB_UCHAR ) iWidth;
|
||||
pLex->ulSrc += ulLen;
|
||||
pLex->nSrc += nLen;
|
||||
return NUM_DOUBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval_ptr->valLong.lNumber = lNumber;
|
||||
yylval_ptr->valLong.bWidth = ( HB_UCHAR ) iWidth;
|
||||
pLex->ulSrc += ulLen;
|
||||
pLex->nSrc += nLen;
|
||||
return NUM_LONG;
|
||||
}
|
||||
}
|
||||
@@ -269,9 +269,9 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
{
|
||||
PHB_MACRO_LEX pLex = ( PHB_MACRO_LEX ) pMacro->pLex;
|
||||
|
||||
while( pLex->ulSrc < pLex->ulLen )
|
||||
while( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
unsigned char ch = ( unsigned char ) pLex->pString[ pLex->ulSrc++ ];
|
||||
unsigned char ch = ( unsigned char ) pLex->pString[ pLex->nSrc++ ];
|
||||
switch( ch )
|
||||
{
|
||||
case ' ':
|
||||
@@ -299,137 +299,137 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
|
||||
case '!':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return NE2;
|
||||
}
|
||||
return NOT;
|
||||
|
||||
case '<':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '>' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '>' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return NE2;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return LE;
|
||||
}
|
||||
return '<';
|
||||
|
||||
case '>':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return GE;
|
||||
}
|
||||
return '>';
|
||||
|
||||
case '=':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return EQ;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '>' && HB_SUPPORT_HARBOUR )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '>' && HB_SUPPORT_HARBOUR )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return HASHOP;
|
||||
}
|
||||
return '=';
|
||||
|
||||
case '+':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '+' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '+' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return INC;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return PLUSEQ;
|
||||
}
|
||||
return '+';
|
||||
|
||||
case '-':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '-' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '-' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return DEC;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return MINUSEQ;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '>' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '>' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return ALIASOP;
|
||||
}
|
||||
return '-';
|
||||
|
||||
case '*':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '*' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '*' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
pLex->nSrc++;
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return EXPEQ;
|
||||
}
|
||||
return POWER;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return MULTEQ;
|
||||
}
|
||||
return '*';
|
||||
|
||||
case '/':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return DIVEQ;
|
||||
}
|
||||
return '/';
|
||||
|
||||
case '%':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return MODEQ;
|
||||
}
|
||||
return '%';
|
||||
|
||||
case '^':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return EXPEQ;
|
||||
}
|
||||
return POWER;
|
||||
|
||||
case ':':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->pString[ pLex->ulSrc ] == '=' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '=' )
|
||||
{
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return INASSIGN;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == ':' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == ':' )
|
||||
{
|
||||
yylval_ptr->string = "SELF";
|
||||
return IDENTIFIER;
|
||||
@@ -438,63 +438,63 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
|
||||
case '.':
|
||||
pLex->quote = HB_TRUE;
|
||||
if( pLex->ulSrc < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ pLex->ulSrc ] ) )
|
||||
if( pLex->nSrc < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ pLex->nSrc ] ) )
|
||||
{
|
||||
HB_SIZE ul = pLex->ulSrc;
|
||||
while( ++ul < pLex->ulLen &&
|
||||
HB_SIZE ul = pLex->nSrc;
|
||||
while( ++ul < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) ) {};
|
||||
ul -= --pLex->ulSrc;
|
||||
ul -= --pLex->nSrc;
|
||||
return hb_lexNumConv( yylval_ptr, pLex, ul );
|
||||
}
|
||||
if( pLex->ulLen - pLex->ulSrc >= 4 &&
|
||||
pLex->pString[ pLex->ulSrc + 3 ] == '.' )
|
||||
if( pLex->nLen - pLex->nSrc >= 4 &&
|
||||
pLex->pString[ pLex->nSrc + 3 ] == '.' )
|
||||
{
|
||||
if( ( pLex->pString[ pLex->ulSrc + 0 ] | ('a' - 'A') ) == 'a' &&
|
||||
( pLex->pString[ pLex->ulSrc + 1 ] | ('a' - 'A') ) == 'n' &&
|
||||
( pLex->pString[ pLex->ulSrc + 2 ] | ('a' - 'A') ) == 'd' )
|
||||
if( ( pLex->pString[ pLex->nSrc + 0 ] | ('a' - 'A') ) == 'a' &&
|
||||
( pLex->pString[ pLex->nSrc + 1 ] | ('a' - 'A') ) == 'n' &&
|
||||
( pLex->pString[ pLex->nSrc + 2 ] | ('a' - 'A') ) == 'd' )
|
||||
{
|
||||
pLex->ulSrc += 4;
|
||||
pLex->nSrc += 4;
|
||||
return AND;
|
||||
}
|
||||
if( ( pLex->pString[ pLex->ulSrc + 0 ] | ('a' - 'A') ) == 'n' &&
|
||||
( pLex->pString[ pLex->ulSrc + 1 ] | ('a' - 'A') ) == 'o' &&
|
||||
( pLex->pString[ pLex->ulSrc + 2 ] | ('a' - 'A') ) == 't' )
|
||||
if( ( pLex->pString[ pLex->nSrc + 0 ] | ('a' - 'A') ) == 'n' &&
|
||||
( pLex->pString[ pLex->nSrc + 1 ] | ('a' - 'A') ) == 'o' &&
|
||||
( pLex->pString[ pLex->nSrc + 2 ] | ('a' - 'A') ) == 't' )
|
||||
{
|
||||
pLex->ulSrc += 4;
|
||||
pLex->nSrc += 4;
|
||||
return NOT;
|
||||
}
|
||||
}
|
||||
if( pLex->ulLen - pLex->ulSrc >= 3 &&
|
||||
pLex->pString[ pLex->ulSrc + 2 ] == '.' )
|
||||
if( pLex->nLen - pLex->nSrc >= 3 &&
|
||||
pLex->pString[ pLex->nSrc + 2 ] == '.' )
|
||||
{
|
||||
if( ( pLex->pString[ pLex->ulSrc + 0 ] | ('a' - 'A') ) == 'o' &&
|
||||
( pLex->pString[ pLex->ulSrc + 1 ] | ('a' - 'A') ) == 'r' )
|
||||
if( ( pLex->pString[ pLex->nSrc + 0 ] | ('a' - 'A') ) == 'o' &&
|
||||
( pLex->pString[ pLex->nSrc + 1 ] | ('a' - 'A') ) == 'r' )
|
||||
{
|
||||
pLex->ulSrc += 3;
|
||||
pLex->nSrc += 3;
|
||||
return OR;
|
||||
}
|
||||
}
|
||||
if( pLex->ulLen - pLex->ulSrc >= 2 &&
|
||||
pLex->pString[ pLex->ulSrc + 1 ] == '.' )
|
||||
if( pLex->nLen - pLex->nSrc >= 2 &&
|
||||
pLex->pString[ pLex->nSrc + 1 ] == '.' )
|
||||
{
|
||||
if( ( pLex->pString[ pLex->ulSrc ] | ('a' - 'A') ) == 't' ||
|
||||
( pLex->pString[ pLex->ulSrc ] | ('a' - 'A') ) == 'y' )
|
||||
if( ( pLex->pString[ pLex->nSrc ] | ('a' - 'A') ) == 't' ||
|
||||
( pLex->pString[ pLex->nSrc ] | ('a' - 'A') ) == 'y' )
|
||||
{
|
||||
pLex->quote = HB_FALSE;
|
||||
pLex->ulSrc += 2;
|
||||
pLex->nSrc += 2;
|
||||
return TRUEVALUE;
|
||||
}
|
||||
if( ( pLex->pString[ pLex->ulSrc ] | ('a' - 'A') ) == 'f' ||
|
||||
( pLex->pString[ pLex->ulSrc ] | ('a' - 'A') ) == 'n' )
|
||||
if( ( pLex->pString[ pLex->nSrc ] | ('a' - 'A') ) == 'f' ||
|
||||
( pLex->pString[ pLex->nSrc ] | ('a' - 'A') ) == 'n' )
|
||||
{
|
||||
pLex->quote = HB_FALSE;
|
||||
pLex->ulSrc += 2;
|
||||
pLex->nSrc += 2;
|
||||
return FALSEVALUE;
|
||||
}
|
||||
if( pLex->pString[ pLex->ulSrc ] == '.' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '.' )
|
||||
{
|
||||
pLex->ulSrc += 2;
|
||||
pLex->nSrc += 2;
|
||||
return EPSILON;
|
||||
}
|
||||
}
|
||||
@@ -514,32 +514,32 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
return hb_lexStringCopy( yylval_ptr, pMacro, pLex, '"' );
|
||||
|
||||
case '&':
|
||||
if( pLex->ulSrc < pLex->ulLen )
|
||||
if( pLex->nSrc < pLex->nLen )
|
||||
{
|
||||
if( HB_ISFIRSTIDCHAR( pLex->pString[ pLex->ulSrc ] ) )
|
||||
if( HB_ISFIRSTIDCHAR( pLex->pString[ pLex->nSrc ] ) )
|
||||
{
|
||||
/* [&<keyword>[.[<nextidchars>]]]+ */
|
||||
int iParts = 0;
|
||||
pLex->quote = HB_FALSE;
|
||||
yylval_ptr->string = pLex->pDst;
|
||||
pLex->ulSrc--;
|
||||
pLex->nSrc--;
|
||||
do
|
||||
{
|
||||
++iParts;
|
||||
*pLex->pDst++ = '&';
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
hb_lexIdentCopy( pLex );
|
||||
if( pLex->pString[ pLex->ulSrc ] == '.' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '.' )
|
||||
{
|
||||
++iParts;
|
||||
*pLex->pDst++ = '.';
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
hb_lexIdentCopy( pLex );
|
||||
}
|
||||
}
|
||||
while( pLex->ulLen - pLex->ulSrc > 1 &&
|
||||
pLex->pString[ pLex->ulSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->ulSrc + 1 ] ) );
|
||||
while( pLex->nLen - pLex->nSrc > 1 &&
|
||||
pLex->pString[ pLex->nSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->nSrc + 1 ] ) );
|
||||
if( iParts == 2 && *( pLex->pDst - 1 ) == '.' )
|
||||
{
|
||||
pLex->pDst--;
|
||||
@@ -555,9 +555,9 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
}
|
||||
return MACROTEXT;
|
||||
}
|
||||
else if( pLex->pString[ pLex->ulSrc ] == '\'' ||
|
||||
pLex->pString[ pLex->ulSrc ] == '"' ||
|
||||
pLex->pString[ pLex->ulSrc ] == '[' )
|
||||
else if( pLex->pString[ pLex->nSrc ] == '\'' ||
|
||||
pLex->pString[ pLex->nSrc ] == '"' ||
|
||||
pLex->pString[ pLex->nSrc ] == '[' )
|
||||
hb_macroError( EG_SYNTAX, pMacro );
|
||||
}
|
||||
pLex->quote = HB_TRUE;
|
||||
@@ -566,23 +566,23 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
default:
|
||||
if( HB_ISDIGIT( ch ) )
|
||||
{
|
||||
HB_SIZE ul = pLex->ulSrc;
|
||||
HB_SIZE n = pLex->nSrc;
|
||||
|
||||
pLex->quote = HB_FALSE;
|
||||
if( ch == '0' && ul < pLex->ulLen )
|
||||
if( ch == '0' && n < pLex->nLen )
|
||||
{
|
||||
if( pLex->pString[ ul ] == 'd' || pLex->pString[ ul ] == 'D' )
|
||||
if( pLex->pString[ n ] == 'd' || pLex->pString[ n ] == 'D' )
|
||||
{
|
||||
while( ++ul < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) ) {};
|
||||
if( ul - pLex->ulSrc == 9 )
|
||||
while( ++n < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ n ] ) ) {};
|
||||
if( n - pLex->nSrc == 9 )
|
||||
{
|
||||
int year, month, day;
|
||||
hb_dateStrGet( pLex->pString + pLex->ulSrc + 1,
|
||||
hb_dateStrGet( pLex->pString + pLex->nSrc + 1,
|
||||
&year, &month, &day );
|
||||
yylval_ptr->valLong.lNumber =
|
||||
hb_dateEncode( year, month, day );
|
||||
pLex->ulSrc = ul;
|
||||
pLex->nSrc = n;
|
||||
if( yylval_ptr->valLong.lNumber == 0 &&
|
||||
( year != 0 || month != 0 || day != 0 ) )
|
||||
{
|
||||
@@ -590,121 +590,121 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
}
|
||||
return NUM_DATE;
|
||||
}
|
||||
else if( ul - pLex->ulSrc == 2 &&
|
||||
pLex->pString[ pLex->ulSrc + 1 ] == '0' )
|
||||
else if( n - pLex->nSrc == 2 &&
|
||||
pLex->pString[ pLex->nSrc + 1 ] == '0' )
|
||||
{
|
||||
yylval_ptr->valLong.lNumber = 0;
|
||||
return NUM_DATE;
|
||||
}
|
||||
ul = pLex->ulSrc;
|
||||
n = pLex->nSrc;
|
||||
}
|
||||
else if( pLex->pString[ ul ] == 'x' ||
|
||||
pLex->pString[ ul ] == 'X' )
|
||||
else if( pLex->pString[ n ] == 'x' ||
|
||||
pLex->pString[ n ] == 'X' )
|
||||
{
|
||||
while( ++ul < pLex->ulLen &&
|
||||
HB_ISXDIGIT( pLex->pString[ ul ] ) ) {};
|
||||
if( ul == pLex->ulSrc + 1 )
|
||||
--ul;
|
||||
while( ++n < pLex->nLen &&
|
||||
HB_ISXDIGIT( pLex->pString[ n ] ) ) {};
|
||||
if( n == pLex->nSrc + 1 )
|
||||
--n;
|
||||
}
|
||||
else
|
||||
{
|
||||
while( ul < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) )
|
||||
++ul;
|
||||
if( pLex->ulLen - ul > 1 && pLex->pString[ ul ] == '.' &&
|
||||
HB_ISDIGIT( pLex->pString[ ul + 1 ] ) )
|
||||
while( n < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ n ] ) )
|
||||
++n;
|
||||
if( pLex->nLen - n > 1 && pLex->pString[ n ] == '.' &&
|
||||
HB_ISDIGIT( pLex->pString[ n + 1 ] ) )
|
||||
{
|
||||
while( ++ul < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) ) {};
|
||||
while( ++n < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ n ] ) ) {};
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( ul < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) )
|
||||
++ul;
|
||||
if( pLex->ulLen - ul > 1 && pLex->pString[ ul ] == '.' &&
|
||||
HB_ISDIGIT( pLex->pString[ ul + 1 ] ) )
|
||||
while( n < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ n ] ) )
|
||||
++n;
|
||||
if( pLex->nLen - n > 1 && pLex->pString[ n ] == '.' &&
|
||||
HB_ISDIGIT( pLex->pString[ n + 1 ] ) )
|
||||
{
|
||||
while( ++ul < pLex->ulLen &&
|
||||
HB_ISDIGIT( pLex->pString[ ul ] ) ) {};
|
||||
while( ++n < pLex->nLen &&
|
||||
HB_ISDIGIT( pLex->pString[ n ] ) ) {};
|
||||
}
|
||||
}
|
||||
ul -= --pLex->ulSrc;
|
||||
return hb_lexNumConv( yylval_ptr, pLex, ul );
|
||||
n -= --pLex->nSrc;
|
||||
return hb_lexNumConv( yylval_ptr, pLex, n );
|
||||
}
|
||||
else if( HB_ISFIRSTIDCHAR( ch ) )
|
||||
{
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
pLex->quote = HB_FALSE;
|
||||
yylval_ptr->string = pLex->pDst;
|
||||
*pLex->pDst++ = ch - ( ( ch >= 'a' && ch <= 'z' ) ? 'a' - 'A' : 0 );
|
||||
hb_lexIdentCopy( pLex );
|
||||
if( pLex->ulLen - pLex->ulSrc > 1 &&
|
||||
pLex->pString[ pLex->ulSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->ulSrc + 1 ] ) )
|
||||
if( pLex->nLen - pLex->nSrc > 1 &&
|
||||
pLex->pString[ pLex->nSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->nSrc + 1 ] ) )
|
||||
{
|
||||
/* [<keyword>][&<keyword>[.[<nextidchars>]]]+ */
|
||||
do
|
||||
{
|
||||
*pLex->pDst++ = '&';
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
hb_lexIdentCopy( pLex );
|
||||
if( pLex->pString[ pLex->ulSrc ] == '.' )
|
||||
if( pLex->pString[ pLex->nSrc ] == '.' )
|
||||
{
|
||||
*pLex->pDst++ = '.';
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
hb_lexIdentCopy( pLex );
|
||||
}
|
||||
}
|
||||
while( pLex->ulLen - pLex->ulSrc > 1 &&
|
||||
pLex->pString[ pLex->ulSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->ulSrc + 1 ] ) );
|
||||
while( pLex->nLen - pLex->nSrc > 1 &&
|
||||
pLex->pString[ pLex->nSrc ] == '&' &&
|
||||
HB_ISFIRSTIDCHAR( pLex->pString[ pLex->nSrc + 1 ] ) );
|
||||
*pLex->pDst++ = '\0';
|
||||
return MACROTEXT;
|
||||
}
|
||||
ulLen = pLex->pDst - yylval_ptr->string;
|
||||
nLen = pLex->pDst - yylval_ptr->string;
|
||||
*pLex->pDst++ = '\0';
|
||||
if( ulLen == 1 )
|
||||
if( nLen == 1 )
|
||||
{
|
||||
if( pLex->ulLen > pLex->ulSrc &&
|
||||
pLex->pString[ pLex->ulSrc ] == '"' )
|
||||
if( pLex->nLen > pLex->nSrc &&
|
||||
pLex->pString[ pLex->nSrc ] == '"' )
|
||||
{
|
||||
switch( yylval_ptr->string[ 0 ] )
|
||||
{
|
||||
case 'E':
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return hb_lexStringExtCopy( yylval_ptr, pMacro, pLex );
|
||||
case 'T':
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return hb_lexTimestampGet( yylval_ptr, pMacro, pLex );
|
||||
case 'D':
|
||||
pLex->ulSrc++;
|
||||
pLex->nSrc++;
|
||||
return hb_lexDateGet( yylval_ptr, pMacro, pLex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( ulLen == 2 )
|
||||
else if( nLen == 2 )
|
||||
{
|
||||
if( yylval_ptr->string[ 0 ] == 'I' &&
|
||||
yylval_ptr->string[ 1 ] == 'F' )
|
||||
{
|
||||
hb_lexSkipBlank( pLex );
|
||||
if( pLex->ulSrc < pLex->ulLen &&
|
||||
pLex->pString[ pLex->ulSrc ] == '(' )
|
||||
if( pLex->nSrc < pLex->nLen &&
|
||||
pLex->pString[ pLex->nSrc ] == '(' )
|
||||
return IIF;
|
||||
}
|
||||
}
|
||||
else if( ulLen == 3 )
|
||||
else if( nLen == 3 )
|
||||
{
|
||||
if( yylval_ptr->string[ 0 ] == 'I' &&
|
||||
yylval_ptr->string[ 1 ] == 'I' &&
|
||||
yylval_ptr->string[ 2 ] == 'F' )
|
||||
{
|
||||
hb_lexSkipBlank( pLex );
|
||||
if( pLex->ulSrc < pLex->ulLen &&
|
||||
pLex->pString[ pLex->ulSrc ] == '(' )
|
||||
if( pLex->nSrc < pLex->nLen &&
|
||||
pLex->pString[ pLex->nSrc ] == '(' )
|
||||
return IIF;
|
||||
}
|
||||
else if( yylval_ptr->string[ 0 ] == 'N' &&
|
||||
@@ -712,50 +712,50 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro )
|
||||
yylval_ptr->string[ 2 ] == 'L' )
|
||||
return NIL;
|
||||
}
|
||||
else /* ulLen >= 4 */
|
||||
else /* nLen >= 4 */
|
||||
{
|
||||
switch( yylval_ptr->string[ 0 ] )
|
||||
{
|
||||
case '_':
|
||||
if( ulLen <= 6 && memcmp( "FIELD", yylval_ptr->string + 1,
|
||||
ulLen - 1 ) == 0 )
|
||||
if( nLen <= 6 && memcmp( "FIELD", yylval_ptr->string + 1,
|
||||
nLen - 1 ) == 0 )
|
||||
{
|
||||
hb_lexSkipBlank( pLex );
|
||||
if( pLex->ulSrc + 1 < pLex->ulLen &&
|
||||
pLex->pString[ pLex->ulSrc ] == '-' &&
|
||||
pLex->pString[ pLex->ulSrc + 1 ] == '>' )
|
||||
if( pLex->nSrc + 1 < pLex->nLen &&
|
||||
pLex->pString[ pLex->nSrc ] == '-' &&
|
||||
pLex->pString[ pLex->nSrc + 1 ] == '>' )
|
||||
return FIELD;
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
if( ulLen <= 5 && memcmp( "IELD", yylval_ptr->string + 1,
|
||||
ulLen - 1 ) == 0 )
|
||||
if( nLen <= 5 && memcmp( "IELD", yylval_ptr->string + 1,
|
||||
nLen - 1 ) == 0 )
|
||||
{
|
||||
hb_lexSkipBlank( pLex );
|
||||
if( pLex->ulSrc + 1 < pLex->ulLen &&
|
||||
pLex->pString[ pLex->ulSrc ] == '-' &&
|
||||
pLex->pString[ pLex->ulSrc + 1 ] == '>' )
|
||||
if( pLex->nSrc + 1 < pLex->nLen &&
|
||||
pLex->pString[ pLex->nSrc ] == '-' &&
|
||||
pLex->pString[ pLex->nSrc + 1 ] == '>' )
|
||||
return FIELD;
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
if( ulLen == 5 && memcmp( "SELF", yylval_ptr->string + 1,
|
||||
4 ) == 0 )
|
||||
if( nLen == 5 && memcmp( "SELF", yylval_ptr->string + 1,
|
||||
4 ) == 0 )
|
||||
{
|
||||
hb_lexSkipBlank( pLex );
|
||||
if( pLex->ulSrc < pLex->ulLen &&
|
||||
pLex->pString[ pLex->ulSrc ] == '(' )
|
||||
if( pLex->nSrc < pLex->nLen &&
|
||||
pLex->pString[ pLex->nSrc ] == '(' )
|
||||
{
|
||||
HB_SIZE ul = pLex->ulSrc;
|
||||
while( ++ul < pLex->ulLen )
|
||||
HB_SIZE n = pLex->nSrc;
|
||||
while( ++n < pLex->nLen )
|
||||
{
|
||||
if( pLex->pString[ ul ] == ')' )
|
||||
if( pLex->pString[ n ] == ')' )
|
||||
{
|
||||
pLex->ulSrc = ul + 1;
|
||||
pLex->nSrc = n + 1;
|
||||
return SELF;
|
||||
}
|
||||
else if( pLex->pString[ ul ] != ' ' &&
|
||||
pLex->pString[ ul ] != '\t' )
|
||||
else if( pLex->pString[ n ] != ' ' &&
|
||||
pLex->pString[ n ] != '\t' )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ typedef struct _HB_MEMINFO
|
||||
{
|
||||
struct _HB_MEMINFO * pPrevBlock;
|
||||
struct _HB_MEMINFO * pNextBlock;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_U32 Signature;
|
||||
} HB_MEMINFO, * PHB_MEMINFO;
|
||||
|
||||
@@ -92,22 +92,22 @@ typedef struct _HB_MEMINFO
|
||||
#endif
|
||||
|
||||
static PHB_MEMINFO s_pMemBlocks = NULL;
|
||||
static long s_ulMemoryBlocks = 0; /* memory blocks used */
|
||||
static long s_ulMemoryMaxBlocks = 0; /* maximum number of used memory blocks */
|
||||
static long s_ulMemoryMaxConsumed = 0; /* memory size consumed */
|
||||
static long s_ulMemoryConsumed = 0; /* memory max size consumed */
|
||||
static HB_ISIZ s_nMemoryBlocks = 0; /* memory blocks used */
|
||||
static HB_ISIZ s_nMemoryMaxBlocks = 0; /* maximum number of used memory blocks */
|
||||
static HB_ISIZ s_nMemoryMaxConsumed = 0; /* memory size consumed */
|
||||
static HB_ISIZ s_nMemoryConsumed = 0; /* memory max size consumed */
|
||||
|
||||
#endif /* HB_FM_STATISTICS */
|
||||
|
||||
void * hb_xgrab( HB_SIZE ulSize ) /* allocates fixed memory, exits on failure */
|
||||
void * hb_xgrab( HB_SIZE nSize ) /* allocates fixed memory, exits on failure */
|
||||
{
|
||||
void * pMem;
|
||||
|
||||
if( ulSize == 0 )
|
||||
if( nSize == 0 )
|
||||
hb_errInternal( HB_EI_XGRABNULLSIZE, "hb_xgrab requested to allocate zero bytes", NULL, NULL );
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
pMem = malloc( ulSize + HB_MEMINFO_SIZE + sizeof( HB_U32 ) );
|
||||
pMem = malloc( nSize + HB_MEMINFO_SIZE + sizeof( HB_U32 ) );
|
||||
if( pMem )
|
||||
{
|
||||
if( s_pMemBlocks )
|
||||
@@ -115,21 +115,21 @@ void * hb_xgrab( HB_SIZE ulSize ) /* allocates fixed memory, exits on fai
|
||||
( ( PHB_MEMINFO ) pMem )->pNextBlock = s_pMemBlocks;
|
||||
( ( PHB_MEMINFO ) pMem )->pPrevBlock = NULL;
|
||||
s_pMemBlocks = ( PHB_MEMINFO ) pMem;
|
||||
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize;
|
||||
( ( PHB_MEMINFO ) pMem )->nSize = nSize;
|
||||
( ( PHB_MEMINFO ) pMem )->Signature = HB_MEMINFO_SIGNATURE;
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + HB_MEMINFO_SIZE + ulSize, HB_MEMINFO_SIGNATURE );
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + HB_MEMINFO_SIZE + nSize, HB_MEMINFO_SIGNATURE );
|
||||
|
||||
s_ulMemoryConsumed += ulSize;
|
||||
if( s_ulMemoryMaxConsumed < s_ulMemoryConsumed )
|
||||
s_ulMemoryMaxConsumed = s_ulMemoryConsumed;
|
||||
s_ulMemoryBlocks++;
|
||||
if( s_ulMemoryMaxBlocks < s_ulMemoryBlocks )
|
||||
s_ulMemoryMaxBlocks = s_ulMemoryBlocks;
|
||||
s_nMemoryConsumed += nSize;
|
||||
if( s_nMemoryMaxConsumed < s_nMemoryConsumed )
|
||||
s_nMemoryMaxConsumed = s_nMemoryConsumed;
|
||||
s_nMemoryBlocks++;
|
||||
if( s_nMemoryMaxBlocks < s_nMemoryBlocks )
|
||||
s_nMemoryMaxBlocks = s_nMemoryBlocks;
|
||||
pMem = ( HB_BYTE * ) pMem + HB_MEMINFO_SIZE;
|
||||
}
|
||||
else
|
||||
#else
|
||||
pMem = malloc( ulSize );
|
||||
pMem = malloc( nSize );
|
||||
if( ! pMem )
|
||||
#endif
|
||||
hb_errInternal( HB_EI_XGRABALLOC, "hb_xgrab can't allocate memory", NULL, NULL );
|
||||
@@ -137,34 +137,34 @@ void * hb_xgrab( HB_SIZE ulSize ) /* allocates fixed memory, exits on fai
|
||||
return pMem;
|
||||
}
|
||||
|
||||
void * hb_xrealloc( void * pMem, HB_SIZE ulSize ) /* reallocates memory */
|
||||
void * hb_xrealloc( void * pMem, HB_SIZE nSize ) /* reallocates memory */
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
PHB_MEMINFO pMemBlock;
|
||||
HB_SIZE ulMemSize;
|
||||
HB_SIZE nMemSize;
|
||||
void * pResult;
|
||||
|
||||
if( ulSize == 0 )
|
||||
if( nSize == 0 )
|
||||
{
|
||||
if( pMem )
|
||||
hb_xfree( pMem );
|
||||
return NULL;
|
||||
}
|
||||
else if( ! pMem )
|
||||
return hb_xgrab( ulSize );
|
||||
return hb_xgrab( nSize );
|
||||
|
||||
pMemBlock = ( PHB_MEMINFO ) ( ( HB_BYTE * ) pMem - HB_MEMINFO_SIZE );
|
||||
ulMemSize = pMemBlock->ulSize;
|
||||
nMemSize = pMemBlock->nSize;
|
||||
|
||||
if( pMemBlock->Signature != HB_MEMINFO_SIGNATURE )
|
||||
hb_errInternal( HB_EI_XREALLOCINV, "hb_xrealloc called with an invalid pointer", NULL, NULL );
|
||||
|
||||
if( HB_GET_LE_UINT32( ( ( HB_BYTE * ) pMem ) + ulMemSize ) != HB_MEMINFO_SIGNATURE )
|
||||
if( HB_GET_LE_UINT32( ( ( HB_BYTE * ) pMem ) + nMemSize ) != HB_MEMINFO_SIGNATURE )
|
||||
hb_errInternal( HB_EI_XMEMOVERFLOW, "Memory buffer overflow", NULL, NULL );
|
||||
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + ulMemSize, 0 );
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + nMemSize, 0 );
|
||||
|
||||
pResult = realloc( pMemBlock, ulSize + HB_MEMINFO_SIZE + sizeof( HB_U32 ) );
|
||||
pResult = realloc( pMemBlock, nSize + HB_MEMINFO_SIZE + sizeof( HB_U32 ) );
|
||||
if( pResult )
|
||||
{
|
||||
if( s_pMemBlocks == pMemBlock )
|
||||
@@ -174,20 +174,20 @@ void * hb_xrealloc( void * pMem, HB_SIZE ulSize ) /* reallocates memory */
|
||||
|
||||
if( ( ( PHB_MEMINFO ) pResult )->pNextBlock )
|
||||
( ( PHB_MEMINFO ) pResult )->pNextBlock->pPrevBlock = ( PHB_MEMINFO ) pResult;
|
||||
s_ulMemoryConsumed += ( ulSize - ulMemSize );
|
||||
s_nMemoryConsumed += ( nSize - nMemSize );
|
||||
|
||||
if( s_ulMemoryMaxConsumed < s_ulMemoryConsumed )
|
||||
s_ulMemoryMaxConsumed = s_ulMemoryConsumed;
|
||||
if( s_nMemoryMaxConsumed < s_nMemoryConsumed )
|
||||
s_nMemoryMaxConsumed = s_nMemoryConsumed;
|
||||
|
||||
( ( PHB_MEMINFO ) pResult )->ulSize = ulSize; /* size of the memory block */
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pResult ) + ulSize + HB_MEMINFO_SIZE, HB_MEMINFO_SIGNATURE );
|
||||
( ( PHB_MEMINFO ) pResult )->nSize = nSize; /* size of the memory block */
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pResult ) + nSize + HB_MEMINFO_SIZE, HB_MEMINFO_SIGNATURE );
|
||||
pResult = ( HB_BYTE * ) pResult + HB_MEMINFO_SIZE;
|
||||
}
|
||||
#else
|
||||
void * pResult = realloc( pMem, ulSize );
|
||||
void * pResult = realloc( pMem, nSize );
|
||||
#endif
|
||||
|
||||
if( ! pResult && ulSize )
|
||||
if( ! pResult && nSize )
|
||||
hb_errInternal( HB_EI_XREALLOC, "hb_xrealloc can't reallocate memory", NULL, NULL );
|
||||
|
||||
return pResult;
|
||||
@@ -203,11 +203,11 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
|
||||
if( pMemBlock->Signature != HB_MEMINFO_SIGNATURE )
|
||||
hb_errInternal( HB_EI_XFREEINV, "hb_xfree called with an invalid pointer", NULL, NULL );
|
||||
|
||||
if( HB_GET_LE_UINT32( ( ( HB_BYTE * ) pMem ) + pMemBlock->ulSize ) != HB_MEMINFO_SIGNATURE )
|
||||
if( HB_GET_LE_UINT32( ( ( HB_BYTE * ) pMem ) + pMemBlock->nSize ) != HB_MEMINFO_SIGNATURE )
|
||||
hb_errInternal( HB_EI_XMEMOVERFLOW, "Memory buffer overflow", NULL, NULL );
|
||||
|
||||
s_ulMemoryConsumed -= pMemBlock->ulSize;
|
||||
s_ulMemoryBlocks--;
|
||||
s_nMemoryConsumed -= pMemBlock->nSize;
|
||||
s_nMemoryBlocks--;
|
||||
if( s_pMemBlocks == pMemBlock )
|
||||
s_pMemBlocks = pMemBlock->pNextBlock;
|
||||
else
|
||||
@@ -217,7 +217,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
|
||||
pMemBlock->pNextBlock->pPrevBlock = pMemBlock->pPrevBlock;
|
||||
|
||||
pMemBlock->Signature = 0;
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + pMemBlock->ulSize, 0 );
|
||||
HB_PUT_LE_UINT32( ( ( HB_BYTE * ) pMem ) + pMemBlock->nSize, 0 );
|
||||
pMem = ( HB_BYTE * ) pMem - HB_MEMINFO_SIZE;
|
||||
#endif
|
||||
free( pMem );
|
||||
@@ -228,36 +228,36 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
|
||||
|
||||
HB_SIZE hb_xquery( int iMode )
|
||||
{
|
||||
HB_SIZE ulResult = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
switch( iMode )
|
||||
{
|
||||
case HB_MEM_USED:
|
||||
ulResult = s_ulMemoryConsumed;
|
||||
nResult = s_nMemoryConsumed;
|
||||
break;
|
||||
|
||||
case HB_MEM_USEDMAX:
|
||||
ulResult = s_ulMemoryMaxConsumed;
|
||||
nResult = s_nMemoryMaxConsumed;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
HB_SYMBOL_UNUSED( iMode );
|
||||
#endif
|
||||
return ulResult;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
static char * hb_memToStr( char * szBuffer, void * pMem, HB_SIZE ulSize )
|
||||
static char * hb_memToStr( char * szBuffer, void * pMem, HB_SIZE nSize )
|
||||
{
|
||||
unsigned char * byMem = ( HB_BYTE * ) pMem;
|
||||
char * pDest = szBuffer;
|
||||
int iSize, i, iPrintable;
|
||||
|
||||
if( ulSize > HB_MEMSTR_BLOCK_MAX )
|
||||
if( nSize > HB_MEMSTR_BLOCK_MAX )
|
||||
iSize = HB_MEMSTR_BLOCK_MAX;
|
||||
else
|
||||
iSize = ( int ) ulSize;
|
||||
iSize = ( int ) nSize;
|
||||
|
||||
iPrintable = 0;
|
||||
for( i = 0; i < iSize; ++i )
|
||||
@@ -293,7 +293,7 @@ static char * hb_memToStr( char * szBuffer, void * pMem, HB_SIZE ulSize )
|
||||
void hb_xexit( void )
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
if( s_ulMemoryBlocks /* || hb_cmdargCheck( "INFO" ) */ )
|
||||
if( s_nMemoryBlocks /* || hb_cmdargCheck( "INFO" ) */ )
|
||||
{
|
||||
char szBuffer[ HB_MAX( 3 * HB_MEMSTR_BLOCK_MAX + 1, 100 ) ];
|
||||
PHB_MEMINFO pMemBlock;
|
||||
@@ -302,23 +302,23 @@ void hb_xexit( void )
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
hb_conOutErr( "----------------------------------------", 0 );
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
hb_snprintf( szBuffer, sizeof( szBuffer ), "Total memory allocated: %lu bytes (%lu blocks)", s_ulMemoryMaxConsumed, s_ulMemoryMaxBlocks );
|
||||
hb_snprintf( szBuffer, sizeof( szBuffer ), "Total memory allocated: %" HB_PFS "u bytes (%" HB_PFS "u blocks)", s_nMemoryMaxConsumed, s_nMemoryMaxBlocks );
|
||||
hb_conOutErr( szBuffer, 0 );
|
||||
|
||||
if( s_ulMemoryBlocks )
|
||||
if( s_nMemoryBlocks )
|
||||
{
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
hb_snprintf( szBuffer, sizeof( szBuffer ), "WARNING! Memory allocated but not released: %lu bytes (%lu blocks)", s_ulMemoryConsumed, s_ulMemoryBlocks );
|
||||
hb_snprintf( szBuffer, sizeof( szBuffer ), "WARNING! Memory allocated but not released: %" HB_PFS "u bytes (%" HB_PFS "u blocks)", s_nMemoryConsumed, s_nMemoryBlocks );
|
||||
hb_conOutErr( szBuffer, 0 );
|
||||
}
|
||||
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
|
||||
for( i = 1, pMemBlock = s_pMemBlocks; pMemBlock; ++i, pMemBlock = pMemBlock->pNextBlock )
|
||||
HB_TRACE( HB_TR_ERROR, ( "Block %i %p (size %lu) \"%s\"", i,
|
||||
( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->ulSize,
|
||||
HB_TRACE( HB_TR_ERROR, ( "Block %i %p (size %" HB_PFS "u) \"%s\"", i,
|
||||
( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize,
|
||||
hb_memToStr( szBuffer, ( char * ) pMemBlock + HB_MEMINFO_SIZE,
|
||||
pMemBlock->ulSize ) ) );
|
||||
pMemBlock->nSize ) ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -349,12 +349,12 @@ void hb_errInternal( HB_ERRCODE errCode, const char * szText, const char * szPar
|
||||
}
|
||||
|
||||
/* console */
|
||||
void hb_conOutErr( const char * pStr, HB_SIZE ulLen )
|
||||
void hb_conOutErr( const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
if( ulLen == 0 )
|
||||
ulLen = strlen( pStr );
|
||||
if( nLen == 0 )
|
||||
nLen = strlen( pStr );
|
||||
|
||||
fprintf( stderr, "%.*s", ( int ) ulLen, pStr );
|
||||
fprintf( stderr, "%.*s", ( int ) nLen, pStr );
|
||||
}
|
||||
|
||||
const char * hb_conNewLine( void )
|
||||
@@ -372,16 +372,16 @@ int hb_charLower( int iChar )
|
||||
return HB_TOLOWER( iChar );
|
||||
}
|
||||
|
||||
const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pulSize )
|
||||
const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pulSize );
|
||||
HB_SYMBOL_UNUSED( pnSize );
|
||||
HB_SYMBOL_UNUSED( pszFree );
|
||||
return szName;
|
||||
}
|
||||
|
||||
const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pulSize )
|
||||
const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pulSize );
|
||||
HB_SYMBOL_UNUSED( pnSize );
|
||||
HB_SYMBOL_UNUSED( pszFree );
|
||||
return szName;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree )
|
||||
s_iFileCase != HB_SET_CASE_MIXED || s_iDirCase != HB_SET_CASE_MIXED )
|
||||
{
|
||||
PHB_FNAME pFileName;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
if( pszFree )
|
||||
{
|
||||
@@ -455,27 +455,27 @@ const char * hb_fsNameConv( const char * szFileName, char ** pszFree )
|
||||
{
|
||||
if( pFileName->szName )
|
||||
{
|
||||
ulLen = strlen( pFileName->szName );
|
||||
while( ulLen && pFileName->szName[ulLen - 1] == ' ' )
|
||||
--ulLen;
|
||||
while( ulLen && pFileName->szName[0] == ' ' )
|
||||
nLen = strlen( pFileName->szName );
|
||||
while( nLen && pFileName->szName[ nLen - 1 ] == ' ' )
|
||||
--nLen;
|
||||
while( nLen && pFileName->szName[ 0 ] == ' ' )
|
||||
{
|
||||
++pFileName->szName;
|
||||
--ulLen;
|
||||
--nLen;
|
||||
}
|
||||
( ( char * ) pFileName->szName )[ulLen] = '\0';
|
||||
( ( char * ) pFileName->szName )[ nLen ] = '\0';
|
||||
}
|
||||
if( pFileName->szExtension )
|
||||
{
|
||||
ulLen = strlen( pFileName->szExtension );
|
||||
while( ulLen && pFileName->szExtension[ulLen - 1] == ' ' )
|
||||
--ulLen;
|
||||
while( ulLen && pFileName->szExtension[0] == ' ' )
|
||||
nLen = strlen( pFileName->szExtension );
|
||||
while( nLen && pFileName->szExtension[ nLen - 1 ] == ' ' )
|
||||
--nLen;
|
||||
while( nLen && pFileName->szExtension[ 0 ] == ' ' )
|
||||
{
|
||||
++pFileName->szExtension;
|
||||
--ulLen;
|
||||
--nLen;
|
||||
}
|
||||
( ( char * ) pFileName->szExtension )[ulLen] = '\0';
|
||||
( ( char * ) pFileName->szExtension )[ nLen ] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1821,7 +1821,7 @@ HB_FUNC( __DBARRANGE )
|
||||
if( pArea )
|
||||
{
|
||||
HB_USHORT uiNewArea, uiCount, uiDest;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
char * szFieldLine, * szPos;
|
||||
PHB_ITEM pStruct, pFields;
|
||||
DBSORTINFO dbSortInfo;
|
||||
@@ -1885,14 +1885,14 @@ HB_FUNC( __DBARRANGE )
|
||||
if( dbSortInfo.uiItemCount > 0 )
|
||||
{
|
||||
dbSortInfo.lpdbsItem = ( LPDBSORTITEM ) hb_xgrab( dbSortInfo.uiItemCount * sizeof( DBSORTITEM ) );
|
||||
ulSize = 0;
|
||||
nSize = 0;
|
||||
for( uiCount = 1; uiCount <= dbSortInfo.uiItemCount; ++uiCount )
|
||||
{
|
||||
HB_SIZE ulLine = hb_arrayGetCLen( pFields, uiCount );
|
||||
if( ulLine > ulSize )
|
||||
ulSize = ulLine;
|
||||
HB_SIZE nLine = hb_arrayGetCLen( pFields, uiCount );
|
||||
if( nLine > nSize )
|
||||
nSize = nLine;
|
||||
}
|
||||
szFieldLine = ( char * ) hb_xgrab( ulSize + 1 );
|
||||
szFieldLine = ( char * ) hb_xgrab( nSize + 1 );
|
||||
for( uiCount = uiDest = 0; uiCount < dbSortInfo.uiItemCount; ++uiCount )
|
||||
{
|
||||
dbSortInfo.lpdbsItem[ uiDest ].uiFlags = 0;
|
||||
|
||||
@@ -207,7 +207,7 @@ static void hb_dbfUpdateStampFields( DBFAREAP pArea )
|
||||
static void hb_dbfSetBlankRecord( DBFAREAP pArea, int iType )
|
||||
{
|
||||
HB_BYTE * pPtr = pArea->pRecord, bFill = ' ', bNext;
|
||||
HB_SIZE ulSize = 1; /* 1 byte ' ' for DELETE flag */
|
||||
HB_SIZE nSize = 1; /* 1 byte ' ' for DELETE flag */
|
||||
HB_USHORT uiCount;
|
||||
LPFIELD pField;
|
||||
|
||||
@@ -285,13 +285,13 @@ static void hb_dbfSetBlankRecord( DBFAREAP pArea, int iType )
|
||||
|
||||
if( bNext == bFill )
|
||||
{
|
||||
ulSize += uiLen;
|
||||
nSize += uiLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( pPtr, bFill, ulSize );
|
||||
pPtr += ulSize;
|
||||
ulSize = 0;
|
||||
memset( pPtr, bFill, nSize );
|
||||
pPtr += nSize;
|
||||
nSize = 0;
|
||||
if( bNext == HB_BLANK_SKIP )
|
||||
{
|
||||
pPtr += uiLen;
|
||||
@@ -333,16 +333,16 @@ static void hb_dbfSetBlankRecord( DBFAREAP pArea, int iType )
|
||||
}
|
||||
else
|
||||
{
|
||||
ulSize = uiLen;
|
||||
nSize = uiLen;
|
||||
bFill = bNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
memset( pPtr, bFill, ulSize );
|
||||
memset( pPtr, bFill, nSize );
|
||||
|
||||
ulSize += pPtr - pArea->pRecord;
|
||||
if( ulSize < ( HB_SIZE ) pArea->uiRecordLen )
|
||||
memset( pArea->pRecord + ulSize, '\0', ( HB_SIZE ) pArea->uiRecordLen - ulSize );
|
||||
nSize += pPtr - pArea->pRecord;
|
||||
if( nSize < ( HB_SIZE ) pArea->uiRecordLen )
|
||||
memset( pArea->pRecord + nSize, '\0', ( HB_SIZE ) pArea->uiRecordLen - nSize );
|
||||
|
||||
/* set varlength and nullable bits in _NullFlags */
|
||||
if( pArea->uiNullCount )
|
||||
@@ -358,8 +358,8 @@ static void hb_dbfAllocNullFlag( DBFAREAP pArea, HB_USHORT uiField, HB_BOOL fLen
|
||||
{
|
||||
if( !pArea->pFieldBits )
|
||||
{
|
||||
HB_SIZE ulSize = sizeof( HB_DBFFIELDBITS ) * pArea->area.uiFieldExtent;
|
||||
pArea->pFieldBits = ( PHB_DBFFIELDBITS ) memset( hb_xgrab( ulSize ), 0, ulSize );
|
||||
HB_SIZE nSize = sizeof( HB_DBFFIELDBITS ) * pArea->area.uiFieldExtent;
|
||||
pArea->pFieldBits = ( PHB_DBFFIELDBITS ) memset( hb_xgrab( nSize ), 0, nSize );
|
||||
}
|
||||
if( fLength )
|
||||
pArea->pFieldBits[ uiField ].uiLengthBit = pArea->uiNullCount++;
|
||||
@@ -526,22 +526,22 @@ static HB_BOOL hb_dbfWriteRecord( DBFAREAP pArea )
|
||||
static HB_BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, HB_BOOL fRaw )
|
||||
{
|
||||
char pKeyBuffer[ 8 ];
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
HB_BOOL fKeySet = HB_FALSE, fSet;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfPasswordSet(%p,%p,%d)", pArea, pPasswd, fRaw));
|
||||
|
||||
ulLen = hb_itemGetCLen( pPasswd );
|
||||
nLen = hb_itemGetCLen( pPasswd );
|
||||
|
||||
fSet = !pArea->fHasMemo && HB_IS_STRING( pPasswd ) && ( !fRaw || ulLen == 8 );
|
||||
fSet = !pArea->fHasMemo && HB_IS_STRING( pPasswd ) && ( !fRaw || nLen == 8 );
|
||||
if( fSet )
|
||||
{
|
||||
if( ulLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
if( ulLen < 8 )
|
||||
if( nLen < 8 )
|
||||
{
|
||||
memcpy( pKeyBuffer, hb_itemGetCPtr( pPasswd ), ulLen );
|
||||
memset( pKeyBuffer + ulLen, '\0', 8 - ulLen );
|
||||
memcpy( pKeyBuffer, hb_itemGetCPtr( pPasswd ), nLen );
|
||||
memset( pKeyBuffer + nLen, '\0', 8 - nLen );
|
||||
}
|
||||
else
|
||||
memcpy( pKeyBuffer, hb_itemGetCPtr( pPasswd ), 8 );
|
||||
@@ -569,7 +569,7 @@ static HB_BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, HB_BOOL fRaw
|
||||
hb_xfree( pArea->pCryptKey );
|
||||
pArea->pCryptKey = NULL;
|
||||
}
|
||||
if( ulLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
/* at this moment only one encryption method is used,
|
||||
I'll add other later, [druzus] */
|
||||
@@ -1138,34 +1138,34 @@ HB_ERRCODE hb_dbfSetMemoData( DBFAREAP pArea, HB_USHORT uiIndex,
|
||||
* so I left it in DBF.
|
||||
*/
|
||||
HB_BOOL hb_dbfLockIdxGetData( HB_BYTE bScheme,
|
||||
HB_FOFFSET *ulPos, HB_FOFFSET *ulPool )
|
||||
HB_FOFFSET * pnPos, HB_FOFFSET * pnPool )
|
||||
{
|
||||
switch( bScheme )
|
||||
{
|
||||
case DB_DBFLOCK_CLIP:
|
||||
*ulPos = IDX_LOCKPOS_CLIP;
|
||||
*ulPool = IDX_LOCKPOOL_CLIP;
|
||||
*pnPos = IDX_LOCKPOS_CLIP;
|
||||
*pnPool = IDX_LOCKPOOL_CLIP;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_CL53:
|
||||
*ulPos = IDX_LOCKPOS_CL53;
|
||||
*ulPool = IDX_LOCKPOOL_CL53;
|
||||
*pnPos = IDX_LOCKPOS_CL53;
|
||||
*pnPool = IDX_LOCKPOOL_CL53;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_CL53EXT:
|
||||
*ulPos = IDX_LOCKPOS_CL53EXT;
|
||||
*ulPool = IDX_LOCKPOOL_CL53EXT;
|
||||
*pnPos = IDX_LOCKPOS_CL53EXT;
|
||||
*pnPool = IDX_LOCKPOOL_CL53EXT;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_VFP:
|
||||
*ulPos = IDX_LOCKPOS_VFP;
|
||||
*ulPool = IDX_LOCKPOOL_VFP;
|
||||
*pnPos = IDX_LOCKPOS_VFP;
|
||||
*pnPool = IDX_LOCKPOOL_VFP;
|
||||
break;
|
||||
|
||||
#ifndef HB_LONG_LONG_OFF
|
||||
case DB_DBFLOCK_HB64:
|
||||
*ulPos = IDX_LOCKPOS_HB64;
|
||||
*ulPool = IDX_LOCKPOOL_HB64;
|
||||
*pnPos = IDX_LOCKPOS_HB64;
|
||||
*pnPool = IDX_LOCKPOOL_HB64;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1181,12 +1181,12 @@ HB_BOOL hb_dbfLockIdxGetData( HB_BYTE bScheme,
|
||||
* so I left it in DBF.
|
||||
*/
|
||||
HB_BOOL hb_dbfLockIdxFile( PHB_FILE pFile, HB_BYTE bScheme, HB_USHORT usMode,
|
||||
HB_FOFFSET *pPoolPos )
|
||||
HB_FOFFSET * pnPoolPos )
|
||||
{
|
||||
HB_FOFFSET ulPos, ulPool, ulSize = 1;
|
||||
HB_FOFFSET nPos, nPool, nSize = 1;
|
||||
HB_BOOL fRet = HB_FALSE;
|
||||
|
||||
if( !hb_dbfLockIdxGetData( bScheme, &ulPos, &ulPool ) )
|
||||
if( !hb_dbfLockIdxGetData( bScheme, &nPos, &nPool ) )
|
||||
{
|
||||
return fRet;
|
||||
}
|
||||
@@ -1196,38 +1196,38 @@ HB_BOOL hb_dbfLockIdxFile( PHB_FILE pFile, HB_BYTE bScheme, HB_USHORT usMode,
|
||||
switch( usMode & FL_MASK )
|
||||
{
|
||||
case FL_LOCK:
|
||||
if( ulPool )
|
||||
if( nPool )
|
||||
{
|
||||
if( ( usMode & FLX_SHARED ) != 0 )
|
||||
*pPoolPos = ( HB_FOFFSET ) ( hb_random_num() * ulPool ) + 1;
|
||||
*pnPoolPos = ( HB_FOFFSET ) ( hb_random_num() * nPool ) + 1;
|
||||
else
|
||||
{
|
||||
*pPoolPos = 0;
|
||||
ulSize = ulPool + 1;
|
||||
*pnPoolPos = 0;
|
||||
nSize = nPool + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pPoolPos = 0;
|
||||
*pnPoolPos = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case FL_UNLOCK:
|
||||
if( ulPool )
|
||||
if( nPool )
|
||||
{
|
||||
if( ! *pPoolPos )
|
||||
ulSize = ulPool + 1;
|
||||
if( ! *pnPoolPos )
|
||||
nSize = nPool + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pPoolPos = 0;
|
||||
*pnPoolPos = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return HB_FALSE;
|
||||
}
|
||||
fRet = hb_fileLock( pFile, ulPos + *pPoolPos, ulSize, usMode );
|
||||
fRet = hb_fileLock( pFile, nPos + *pnPoolPos, nSize, usMode );
|
||||
if( fRet || ( usMode & FLX_WAIT ) == 0 || ( usMode & FL_MASK ) != FL_LOCK )
|
||||
break;
|
||||
/* TODO: call special error handler (LOCKHANDLER) here if fWait */
|
||||
@@ -1241,59 +1241,59 @@ HB_BOOL hb_dbfLockIdxFile( PHB_FILE pFile, HB_BYTE bScheme, HB_USHORT usMode,
|
||||
* Get DBF locking parameters
|
||||
*/
|
||||
static HB_ERRCODE hb_dbfLockData( DBFAREAP pArea,
|
||||
HB_FOFFSET * ulPos, HB_FOFFSET * ulFlSize,
|
||||
HB_FOFFSET * ulRlSize, int * iDir )
|
||||
HB_FOFFSET * pnPos, HB_FOFFSET * pnFlSize,
|
||||
HB_FOFFSET * pnRlSize, int * iDir )
|
||||
{
|
||||
switch( pArea->bLockType )
|
||||
{
|
||||
case DB_DBFLOCK_CLIP:
|
||||
*ulPos = DBF_LOCKPOS_CLIP;
|
||||
*pnPos = DBF_LOCKPOS_CLIP;
|
||||
*iDir = DBF_LOCKDIR_CLIP;
|
||||
*ulFlSize = DBF_FLCKSIZE_CLIP;
|
||||
*ulRlSize = DBF_RLCKSIZE_CLIP;
|
||||
*pnFlSize = DBF_FLCKSIZE_CLIP;
|
||||
*pnRlSize = DBF_RLCKSIZE_CLIP;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_CL53:
|
||||
*ulPos = DBF_LOCKPOS_CL53;
|
||||
*pnPos = DBF_LOCKPOS_CL53;
|
||||
*iDir = DBF_LOCKDIR_CL53;
|
||||
*ulFlSize = DBF_FLCKSIZE_CL53;
|
||||
*ulRlSize = DBF_RLCKSIZE_CL53;
|
||||
*pnFlSize = DBF_FLCKSIZE_CL53;
|
||||
*pnRlSize = DBF_RLCKSIZE_CL53;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_CL53EXT:
|
||||
*ulPos = DBF_LOCKPOS_CL53EXT;
|
||||
*pnPos = DBF_LOCKPOS_CL53EXT;
|
||||
*iDir = DBF_LOCKDIR_CL53EXT;
|
||||
*ulFlSize = DBF_FLCKSIZE_CL53EXT;
|
||||
*ulRlSize = DBF_RLCKSIZE_CL53EXT;
|
||||
*pnFlSize = DBF_FLCKSIZE_CL53EXT;
|
||||
*pnRlSize = DBF_RLCKSIZE_CL53EXT;
|
||||
break;
|
||||
|
||||
case DB_DBFLOCK_VFP:
|
||||
if( pArea->fHasTags )
|
||||
{
|
||||
*ulPos = DBF_LOCKPOS_VFPX;
|
||||
*pnPos = DBF_LOCKPOS_VFPX;
|
||||
*iDir = DBF_LOCKDIR_VFPX;
|
||||
*ulFlSize = DBF_FLCKSIZE_VFPX;
|
||||
*ulRlSize = DBF_RLCKSIZE_VFPX;
|
||||
*pnFlSize = DBF_FLCKSIZE_VFPX;
|
||||
*pnRlSize = DBF_RLCKSIZE_VFPX;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ulPos = DBF_LOCKPOS_VFP;
|
||||
*pnPos = DBF_LOCKPOS_VFP;
|
||||
*iDir = DBF_LOCKDIR_VFP;
|
||||
*ulFlSize = DBF_FLCKSIZE_VFP;
|
||||
*ulRlSize = DBF_RLCKSIZE_VFP;
|
||||
*pnFlSize = DBF_FLCKSIZE_VFP;
|
||||
*pnRlSize = DBF_RLCKSIZE_VFP;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef HB_LONG_LONG_OFF
|
||||
case DB_DBFLOCK_HB64:
|
||||
*ulPos = DBF_LOCKPOS_HB64;
|
||||
*pnPos = DBF_LOCKPOS_HB64;
|
||||
*iDir = DBF_LOCKDIR_HB64;
|
||||
*ulFlSize = DBF_FLCKSIZE_HB64;
|
||||
*ulRlSize = DBF_RLCKSIZE_HB64;
|
||||
*pnFlSize = DBF_FLCKSIZE_HB64;
|
||||
*pnRlSize = DBF_RLCKSIZE_HB64;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
*ulPos = *ulFlSize = *ulRlSize = 0;
|
||||
*pnPos = *pnFlSize = *pnRlSize = 0;
|
||||
*iDir = 0;
|
||||
return HB_FAILURE;
|
||||
}
|
||||
@@ -1793,7 +1793,7 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
PHB_ITEM pError;
|
||||
HB_BOOL fError;
|
||||
char * pszVal;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfGetValue(%p, %hu, %p)", pArea, uiIndex, pItem));
|
||||
|
||||
@@ -1813,36 +1813,36 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
switch( pField->uiType )
|
||||
{
|
||||
case HB_FT_STRING:
|
||||
ulLen = pField->uiLen;
|
||||
nLen = pField->uiLen;
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
&nLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ];
|
||||
hb_itemPutCL( pItem, pszVal, ulLen );
|
||||
hb_itemPutCL( pItem, pszVal, nLen );
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_FT_VARLENGTH:
|
||||
ulLen = pField->uiLen;
|
||||
nLen = pField->uiLen;
|
||||
if( hb_dbfGetNullFlag( pArea, pArea->pFieldBits[ uiIndex ].uiLengthBit ) )
|
||||
{
|
||||
ulLen = ( HB_UCHAR ) pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + ulLen - 1 ];
|
||||
nLen = ( HB_UCHAR ) pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + nLen - 1 ];
|
||||
/* protection against corrupted files */
|
||||
if( ulLen > ( HB_SIZE ) pField->uiLen )
|
||||
ulLen = pField->uiLen;
|
||||
if( nLen > ( HB_SIZE ) pField->uiLen )
|
||||
nLen = pField->uiLen;
|
||||
}
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
&nLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
else
|
||||
pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ];
|
||||
|
||||
hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
break;
|
||||
|
||||
case HB_FT_LOGICAL:
|
||||
@@ -2203,7 +2203,7 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
*/
|
||||
char szBuffer[ 256 ];
|
||||
const char * pszPtr;
|
||||
HB_SIZE ulSize, ulLen;
|
||||
HB_SIZE nSize, nLen;
|
||||
HB_BYTE * ptr;
|
||||
HB_ERRCODE errCode;
|
||||
|
||||
@@ -2245,47 +2245,47 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
if( HB_IS_MEMO( pItem ) || HB_IS_STRING( pItem ) )
|
||||
{
|
||||
pszPtr = hb_itemGetCPtr( pItem );
|
||||
ulSize = hb_itemGetCLen( pItem );
|
||||
ulLen = pField->uiLen;
|
||||
nSize = hb_itemGetCLen( pItem );
|
||||
nLen = pField->uiLen;
|
||||
|
||||
if( pField->uiType == HB_FT_STRING )
|
||||
{
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
hb_cdpnDup2( pszPtr, ulSize,
|
||||
hb_cdpnDup2( pszPtr, nSize,
|
||||
( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulLen, hb_vmCDP(), pArea->area.cdPage );
|
||||
&nLen, hb_vmCDP(), pArea->area.cdPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ulLen > ulSize )
|
||||
ulLen = ulSize;
|
||||
if( nLen > nSize )
|
||||
nLen = nSize;
|
||||
memcpy( pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
hb_itemGetCPtr( pItem ), ulLen );
|
||||
hb_itemGetCPtr( pItem ), nLen );
|
||||
}
|
||||
if( ulLen < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + ulLen,
|
||||
' ', pField->uiLen - ulLen );
|
||||
if( nLen < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + nLen,
|
||||
' ', pField->uiLen - nLen );
|
||||
}
|
||||
else if( pField->uiType == HB_FT_VARLENGTH )
|
||||
{
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
if( ulLen > ( HB_SIZE ) sizeof( szBuffer ) )
|
||||
ulLen = sizeof( szBuffer );
|
||||
pszPtr = hb_cdpnDup2( pszPtr, ulSize, szBuffer, &ulLen,
|
||||
if( nLen > ( HB_SIZE ) sizeof( szBuffer ) )
|
||||
nLen = sizeof( szBuffer );
|
||||
pszPtr = hb_cdpnDup2( pszPtr, nSize, szBuffer, &nLen,
|
||||
hb_vmCDP(), pArea->area.cdPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ulLen > ulSize )
|
||||
ulLen = ulSize;
|
||||
if( nLen > nSize )
|
||||
nLen = nSize;
|
||||
}
|
||||
memcpy( pArea->pRecord + pArea->pFieldOffset[ uiIndex ], pszPtr, ulLen );
|
||||
memcpy( pArea->pRecord + pArea->pFieldOffset[ uiIndex ], pszPtr, nLen );
|
||||
|
||||
if( ulLen < ( HB_SIZE ) pField->uiLen )
|
||||
if( nLen < ( HB_SIZE ) pField->uiLen )
|
||||
{
|
||||
pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + pField->uiLen - 1 ] = ( HB_BYTE ) ulLen;
|
||||
pArea->pRecord[ pArea->pFieldOffset[ uiIndex ] + pField->uiLen - 1 ] = ( HB_BYTE ) nLen;
|
||||
hb_dbfSetNullFlag( pArea->pRecord, pArea->uiNullOffset, pArea->pFieldBits[ uiIndex ].uiLengthBit );
|
||||
}
|
||||
else
|
||||
@@ -2729,7 +2729,7 @@ static HB_ERRCODE hb_dbfClose( DBFAREAP pArea )
|
||||
static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
{
|
||||
HB_ERRCODE errCode = HB_SUCCESS;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_USHORT uiCount;
|
||||
HB_BOOL fError, fRawBlob;
|
||||
DBFFIELD * pThisField;
|
||||
@@ -2846,10 +2846,10 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
|
||||
pArea->szDataFileName = hb_strdup( szFileName );
|
||||
|
||||
ulSize = ( HB_SIZE ) pArea->area.uiFieldCount * sizeof( DBFFIELD ) +
|
||||
( pArea->bTableType == DB_DBF_VFP ? 1 : 2 );
|
||||
pBuffer = ( HB_BYTE * ) hb_xgrab( ulSize + sizeof( DBFFIELD ) + 1 );
|
||||
memset( pBuffer, 0, ulSize + sizeof( DBFFIELD ) + 1 );
|
||||
nSize = ( HB_SIZE ) pArea->area.uiFieldCount * sizeof( DBFFIELD ) +
|
||||
( pArea->bTableType == DB_DBF_VFP ? 1 : 2 );
|
||||
pBuffer = ( HB_BYTE * ) hb_xgrab( nSize + sizeof( DBFFIELD ) + 1 );
|
||||
memset( pBuffer, 0, nSize + sizeof( DBFFIELD ) + 1 );
|
||||
pThisField = ( DBFFIELD * ) pBuffer;
|
||||
|
||||
pArea->fHasMemo = fError = HB_FALSE;
|
||||
@@ -3075,13 +3075,13 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
pThisField->bDec = ( HB_BYTE ) ( uiCount >> 8 );
|
||||
pArea->uiNullOffset = pArea->uiRecordLen;
|
||||
pArea->uiRecordLen += uiCount;
|
||||
ulSize += sizeof( DBFFIELD );
|
||||
nSize += sizeof( DBFFIELD );
|
||||
}
|
||||
|
||||
pArea->fShared = HB_FALSE; /* pCreateInfo->fShared */
|
||||
pArea->fReadonly = HB_FALSE; /* pCreateInfo->fReadonly */
|
||||
pArea->ulRecCount = 0;
|
||||
pArea->uiHeaderLen = ( HB_USHORT ) ( sizeof( DBFHEADER ) + ulSize );
|
||||
pArea->uiHeaderLen = ( HB_USHORT ) ( sizeof( DBFHEADER ) + nSize );
|
||||
if( fRawBlob )
|
||||
{
|
||||
pArea->fHasMemo = HB_TRUE;
|
||||
@@ -3136,15 +3136,15 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
|
||||
/* Write fields and eof mark */
|
||||
if( pArea->bTableType == DB_DBF_VFP )
|
||||
pBuffer[ ulSize - 1 ] = '\r';
|
||||
pBuffer[ nSize - 1 ] = '\r';
|
||||
else
|
||||
{
|
||||
pBuffer[ ulSize - 2 ] = '\r';
|
||||
pBuffer[ ulSize - 1 ] = '\0';
|
||||
pBuffer[ nSize - 2 ] = '\r';
|
||||
pBuffer[ nSize - 1 ] = '\0';
|
||||
}
|
||||
pBuffer[ ulSize ] = '\032';
|
||||
if( hb_fileWriteAt( pArea->pDataFile, pBuffer, ulSize + 1,
|
||||
sizeof( DBFHEADER ) ) != ulSize + 1 )
|
||||
pBuffer[ nSize ] = '\032';
|
||||
if( hb_fileWriteAt( pArea->pDataFile, pBuffer, nSize + 1,
|
||||
sizeof( DBFHEADER ) ) != nSize + 1 )
|
||||
{
|
||||
hb_xfree( pBuffer );
|
||||
hb_dbfErrorRT( pArea, EG_WRITE, EDBF_WRITE, pArea->szDataFileName,
|
||||
@@ -3309,11 +3309,11 @@ static HB_ERRCODE hb_dbfInfo( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem
|
||||
|
||||
case DBI_LOCKOFFSET:
|
||||
{
|
||||
HB_FOFFSET ulPos, ulFlSize, ulRlSize;
|
||||
HB_FOFFSET nPos, nFlSize, nRlSize;
|
||||
int iDir;
|
||||
|
||||
hb_dbfLockData( pArea, &ulPos, &ulFlSize, &ulRlSize, &iDir );
|
||||
hb_itemPutNInt( pItem, ulPos );
|
||||
hb_dbfLockData( pArea, &nPos, &nFlSize, &nRlSize, &iDir );
|
||||
hb_itemPutNInt( pItem, nPos );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3523,18 +3523,18 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn
|
||||
{
|
||||
HB_USHORT uiFields;
|
||||
HB_BYTE * pResult;
|
||||
HB_SIZE ulLength, ulLen;
|
||||
HB_SIZE nLength, nLen;
|
||||
|
||||
if( !pArea->fValidBuffer && !hb_dbfReadRecord( pArea ) )
|
||||
{
|
||||
errResult = HB_FAILURE;
|
||||
break;
|
||||
}
|
||||
ulLength = uiInfoType == DBRI_RAWDATA ? pArea->uiRecordLen : 0;
|
||||
pResult = ( HB_BYTE * ) hb_xgrab( ulLength + 1 );
|
||||
if( ulLength )
|
||||
nLength = uiInfoType == DBRI_RAWDATA ? pArea->uiRecordLen : 0;
|
||||
pResult = ( HB_BYTE * ) hb_xgrab( nLength + 1 );
|
||||
if( nLength )
|
||||
{
|
||||
memcpy( pResult, pArea->pRecord, ulLength );
|
||||
memcpy( pResult, pArea->pRecord, nLength );
|
||||
}
|
||||
|
||||
if( pArea->fHasMemo )
|
||||
@@ -3549,17 +3549,17 @@ static HB_ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, HB_USHORT uiIn
|
||||
errResult = SELF_GETVALUE( ( AREAP ) pArea, uiFields + 1, pInfo );
|
||||
if( errResult != HB_SUCCESS )
|
||||
break;
|
||||
ulLen = hb_itemGetCLen( pInfo );
|
||||
if( ulLen > 0 )
|
||||
nLen = hb_itemGetCLen( pInfo );
|
||||
if( nLen > 0 )
|
||||
{
|
||||
pResult = ( HB_BYTE * ) hb_xrealloc( pResult, ulLength + ulLen + 1 );
|
||||
memcpy( pResult + ulLength, hb_itemGetCPtr( pInfo ), ulLen );
|
||||
ulLength += ulLen;
|
||||
pResult = ( HB_BYTE * ) hb_xrealloc( pResult, nLength + nLen + 1 );
|
||||
memcpy( pResult + nLength, hb_itemGetCPtr( pInfo ), nLen );
|
||||
nLength += nLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hb_itemPutCLPtr( pInfo, ( char * ) pResult, ulLength );
|
||||
hb_itemPutCLPtr( pInfo, ( char * ) pResult, nLength );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3609,7 +3609,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
{
|
||||
HB_ERRCODE errCode, errOsCode;
|
||||
HB_USHORT uiFlags, uiFields, uiCount, uiSkip;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_BOOL fRawBlob;
|
||||
PHB_ITEM pError, pItem;
|
||||
PHB_FNAME pFileName;
|
||||
@@ -3776,14 +3776,14 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
/* Add fields */
|
||||
uiSkip = 0;
|
||||
uiFields = ( pArea->uiHeaderLen - sizeof( DBFHEADER ) ) / sizeof( DBFFIELD );
|
||||
ulSize = ( HB_SIZE ) uiFields * sizeof( DBFFIELD );
|
||||
pBuffer = uiFields ? ( HB_BYTE * ) hb_xgrab( ulSize ) : NULL;
|
||||
nSize = ( HB_SIZE ) uiFields * sizeof( DBFFIELD );
|
||||
pBuffer = uiFields ? ( HB_BYTE * ) hb_xgrab( nSize ) : NULL;
|
||||
|
||||
/* Read fields and exit if error */
|
||||
do
|
||||
{
|
||||
if( hb_fileReadAt( pArea->pDataFile, pBuffer, ulSize,
|
||||
sizeof( DBFHEADER ) ) == ulSize )
|
||||
if( hb_fileReadAt( pArea->pDataFile, pBuffer, nSize,
|
||||
sizeof( DBFHEADER ) ) == nSize )
|
||||
{
|
||||
errCode = HB_SUCCESS;
|
||||
break;
|
||||
@@ -4295,7 +4295,7 @@ static HB_ERRCODE hb_dbfPack( DBFAREAP pArea )
|
||||
void hb_dbfTranslateRec( DBFAREAP pArea, HB_BYTE * pBuffer, PHB_CODEPAGE cdp_src, PHB_CODEPAGE cdp_dest )
|
||||
{
|
||||
char * pTmpBuf = NULL;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
LPFIELD pField;
|
||||
HB_USHORT uiIndex;
|
||||
|
||||
@@ -4306,21 +4306,21 @@ void hb_dbfTranslateRec( DBFAREAP pArea, HB_BYTE * pBuffer, PHB_CODEPAGE cdp_src
|
||||
{
|
||||
if( pTmpBuf == NULL )
|
||||
pTmpBuf = ( char * ) hb_xgrab( pArea->uiRecordLen );
|
||||
ulLen = pField->uiLen;
|
||||
hb_cdpnDup2( ( char * ) pBuffer + pArea->pFieldOffset[ uiIndex ], ulLen,
|
||||
pTmpBuf, &ulLen, cdp_src, cdp_dest );
|
||||
memcpy( pBuffer + pArea->pFieldOffset[ uiIndex ], pTmpBuf, ulLen );
|
||||
nLen = pField->uiLen;
|
||||
hb_cdpnDup2( ( char * ) pBuffer + pArea->pFieldOffset[ uiIndex ], nLen,
|
||||
pTmpBuf, &nLen, cdp_src, cdp_dest );
|
||||
memcpy( pBuffer + pArea->pFieldOffset[ uiIndex ], pTmpBuf, nLen );
|
||||
if( pField->uiType == HB_FT_STRING )
|
||||
{
|
||||
if( ulLen < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pBuffer + pArea->pFieldOffset[ uiIndex ] + ulLen,
|
||||
' ', pField->uiLen - ulLen );
|
||||
if( nLen < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pBuffer + pArea->pFieldOffset[ uiIndex ] + nLen,
|
||||
' ', pField->uiLen - nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ulLen < ( HB_SIZE ) pField->uiLen )
|
||||
if( nLen < ( HB_SIZE ) pField->uiLen )
|
||||
{
|
||||
pBuffer[ pArea->pFieldOffset[ uiIndex ] + pField->uiLen - 1 ] = ( HB_BYTE ) ulLen;
|
||||
pBuffer[ pArea->pFieldOffset[ uiIndex ] + pField->uiLen - 1 ] = ( HB_BYTE ) nLen;
|
||||
hb_dbfSetNullFlag( pBuffer, pArea->uiNullOffset, pArea->pFieldBits[ uiIndex ].uiLengthBit );
|
||||
}
|
||||
else
|
||||
@@ -4688,7 +4688,7 @@ static HB_ERRCODE hb_dbfSetFilter( DBFAREAP pArea, LPDBFILTERINFO pFilterInfo )
|
||||
static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ulRecNo )
|
||||
{
|
||||
HB_ERRCODE errCode = HB_SUCCESS;
|
||||
HB_FOFFSET ulPos, ulFlSize, ulRlSize;
|
||||
HB_FOFFSET nPos, nFlSize, nRlSize;
|
||||
int iDir;
|
||||
HB_BOOL fLck;
|
||||
|
||||
@@ -4696,7 +4696,7 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
|
||||
if( pArea->fShared )
|
||||
{
|
||||
if( hb_dbfLockData( pArea, &ulPos, &ulFlSize, &ulRlSize, &iDir ) == HB_FAILURE )
|
||||
if( hb_dbfLockData( pArea, &nPos, &nFlSize, &nRlSize, &iDir ) == HB_FAILURE )
|
||||
return HB_FAILURE;
|
||||
|
||||
switch( uiAction )
|
||||
@@ -4705,9 +4705,9 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
if( !pArea->fFLocked )
|
||||
{
|
||||
if( iDir < 0 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos - ulFlSize, ulFlSize, FL_LOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos - nFlSize, nFlSize, FL_LOCK );
|
||||
else
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + 1, ulFlSize, FL_LOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + 1, nFlSize, FL_LOCK );
|
||||
|
||||
if( !fLck )
|
||||
errCode = HB_FAILURE;
|
||||
@@ -4720,9 +4720,9 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
if( pArea->fFLocked )
|
||||
{
|
||||
if( iDir < 0 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos - ulFlSize, ulFlSize, FL_UNLOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos - nFlSize, nFlSize, FL_UNLOCK );
|
||||
else
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + 1, ulFlSize, FL_UNLOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + 1, nFlSize, FL_UNLOCK );
|
||||
|
||||
if( !fLck )
|
||||
errCode = HB_FAILURE;
|
||||
@@ -4734,11 +4734,11 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
if( !pArea->fFLocked )
|
||||
{
|
||||
if( iDir < 0 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos - ulRecNo, ulRlSize, FL_LOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos - ulRecNo, nRlSize, FL_LOCK );
|
||||
else if( iDir == 2 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + ( ulRecNo - 1 ) * pArea->uiRecordLen + pArea->uiHeaderLen, ulRlSize, FL_LOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + ( ulRecNo - 1 ) * pArea->uiRecordLen + pArea->uiHeaderLen, nRlSize, FL_LOCK );
|
||||
else
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + ulRecNo, ulRlSize, FL_LOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + ulRecNo, nRlSize, FL_LOCK );
|
||||
|
||||
if( !fLck )
|
||||
errCode = HB_FAILURE;
|
||||
@@ -4749,11 +4749,11 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
if( !pArea->fFLocked )
|
||||
{
|
||||
if( iDir < 0 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos - ulRecNo, ulRlSize, FL_UNLOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos - ulRecNo, nRlSize, FL_UNLOCK );
|
||||
else if( iDir == 2 )
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + ( ulRecNo - 1 ) * pArea->uiRecordLen + pArea->uiHeaderLen, ulRlSize, FL_UNLOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + ( ulRecNo - 1 ) * pArea->uiRecordLen + pArea->uiHeaderLen, nRlSize, FL_UNLOCK );
|
||||
else
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos + ulRecNo, ulRlSize, FL_UNLOCK );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos + ulRecNo, nRlSize, FL_UNLOCK );
|
||||
if( !fLck )
|
||||
errCode = HB_FAILURE;
|
||||
}
|
||||
@@ -4765,7 +4765,7 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
fLck = hb_fileLock( pArea->pDataFile, ulPos, 1, FL_LOCK | FLX_WAIT );
|
||||
fLck = hb_fileLock( pArea->pDataFile, nPos, 1, FL_LOCK | FLX_WAIT );
|
||||
/* TODO: call special error handler (LOCKHANDLER) hiere if !fLck */
|
||||
if( fLck )
|
||||
break;
|
||||
@@ -4782,7 +4782,7 @@ static HB_ERRCODE hb_dbfRawLock( DBFAREAP pArea, HB_USHORT uiAction, HB_ULONG ul
|
||||
case HEADER_UNLOCK:
|
||||
if( pArea->fHeaderLocked )
|
||||
{
|
||||
if( !hb_fileLock( pArea->pDataFile, ulPos, 1, FL_UNLOCK ) )
|
||||
if( !hb_fileLock( pArea->pDataFile, nPos, 1, FL_UNLOCK ) )
|
||||
errCode = HB_FAILURE;
|
||||
pArea->fHeaderLocked = HB_FALSE;
|
||||
}
|
||||
@@ -5188,11 +5188,11 @@ static HB_ERRCODE hb_dbfWriteDBHeader( DBFAREAP pArea )
|
||||
{
|
||||
/* Exclusive mode */
|
||||
/* write eof mark */
|
||||
HB_FOFFSET llOffset = ( HB_FOFFSET ) pArea->uiHeaderLen +
|
||||
( HB_FOFFSET ) pArea->uiRecordLen *
|
||||
( HB_FOFFSET ) pArea->ulRecCount;
|
||||
hb_fileWriteAt( pArea->pDataFile, "\032", 1, llOffset );
|
||||
hb_fileTruncAt( pArea->pDataFile, llOffset + 1 );
|
||||
HB_FOFFSET nOffset = ( HB_FOFFSET ) pArea->uiHeaderLen +
|
||||
( HB_FOFFSET ) pArea->uiRecordLen *
|
||||
( HB_FOFFSET ) pArea->ulRecCount;
|
||||
hb_fileWriteAt( pArea->pDataFile, "\032", 1, nOffset );
|
||||
hb_fileTruncAt( pArea->pDataFile, nOffset + 1 );
|
||||
}
|
||||
|
||||
HB_PUT_LE_UINT32( pArea->dbfHeader.ulRecCount, pArea->ulRecCount );
|
||||
|
||||
@@ -355,7 +355,7 @@ static LPCDXKEY hb_cdxKeyPut( LPCDXKEY pKey, HB_BYTE * pbVal, HB_USHORT uiLen, H
|
||||
/*
|
||||
* store string0 value in index key
|
||||
*/
|
||||
static LPCDXKEY hb_cdxKeyPutC( LPCDXKEY pKey, const char * szText, HB_USHORT uiRealLen, HB_ULONG ulRec )
|
||||
static LPCDXKEY hb_cdxKeyPutC( LPCDXKEY pKey, const char * szText, HB_USHORT uiRealLen, HB_ULONG ulRec )
|
||||
{
|
||||
HB_USHORT uiLen;
|
||||
|
||||
@@ -498,7 +498,7 @@ static HB_BYTE hb_cdxItemTypeCmp( HB_BYTE bType )
|
||||
static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, LPCDXTAG pTag, HB_BOOL fTrans, int iMode )
|
||||
{
|
||||
HB_BYTE buf[ CDX_MAXKEY ], *ptr;
|
||||
HB_SIZE ulLen = 0;
|
||||
HB_SIZE nLen = 0;
|
||||
double d;
|
||||
|
||||
ptr = &buf[ 0 ];
|
||||
@@ -508,7 +508,7 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec,
|
||||
case 'C':
|
||||
if( fTrans && hb_vmCDP() != pTag->pIndex->pArea->dbfarea.area.cdPage )
|
||||
{
|
||||
ulLen = pTag->uiLen;
|
||||
nLen = pTag->uiLen;
|
||||
if( pTag->IgnoreCase )
|
||||
{
|
||||
char tmp[ CDX_MAXKEY ];
|
||||
@@ -517,35 +517,35 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec,
|
||||
ul = ( HB_SIZE ) sizeof( tmp );
|
||||
memcpy( tmp, hb_itemGetCPtr( pItem ), ul );
|
||||
hb_strUpper( tmp, ul );
|
||||
hb_cdpnDup2( tmp, ul, ( char * ) ptr, &ulLen,
|
||||
hb_cdpnDup2( tmp, ul, ( char * ) ptr, &nLen,
|
||||
hb_vmCDP(), pTag->pIndex->pArea->dbfarea.area.cdPage );
|
||||
}
|
||||
else
|
||||
hb_cdpnDup2( hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ),
|
||||
( char * ) ptr, &ulLen,
|
||||
( char * ) ptr, &nLen,
|
||||
hb_vmCDP(), pTag->pIndex->pArea->dbfarea.area.cdPage );
|
||||
if( iMode == CDX_CMP_EXACT && ulLen < ( HB_SIZE ) pTag->uiLen )
|
||||
if( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen )
|
||||
{
|
||||
memset( ptr + ulLen, pTag->bTrail, pTag->uiLen - ulLen );
|
||||
ulLen = pTag->uiLen;
|
||||
memset( ptr + nLen, pTag->bTrail, pTag->uiLen - nLen );
|
||||
nLen = pTag->uiLen;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ulLen = hb_itemGetCLen( pItem );
|
||||
if( ulLen > ( HB_SIZE ) pTag->uiLen )
|
||||
ulLen = pTag->uiLen;
|
||||
nLen = hb_itemGetCLen( pItem );
|
||||
if( nLen > ( HB_SIZE ) pTag->uiLen )
|
||||
nLen = pTag->uiLen;
|
||||
|
||||
if( pTag->IgnoreCase ||
|
||||
( iMode == CDX_CMP_EXACT && ulLen < ( HB_SIZE ) pTag->uiLen ) )
|
||||
( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen ) )
|
||||
{
|
||||
memcpy( ptr, hb_itemGetCPtr( pItem ), ulLen );
|
||||
memcpy( ptr, hb_itemGetCPtr( pItem ), nLen );
|
||||
if( pTag->IgnoreCase )
|
||||
hb_strUpper( ( char * ) ptr, ulLen );
|
||||
if( iMode == CDX_CMP_EXACT && ulLen < ( HB_SIZE ) pTag->uiLen )
|
||||
hb_strUpper( ( char * ) ptr, nLen );
|
||||
if( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen )
|
||||
{
|
||||
memset( ptr + ulLen, pTag->bTrail, pTag->uiLen - ulLen );
|
||||
ulLen = pTag->uiLen;
|
||||
memset( ptr + nLen, pTag->bTrail, pTag->uiLen - nLen );
|
||||
nLen = pTag->uiLen;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -557,19 +557,19 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec,
|
||||
{
|
||||
HB_U32 uiVal = ( HB_U32 ) hb_itemGetNI( pItem ) + 0x80000000;
|
||||
HB_PUT_BE_UINT32( ptr, uiVal );
|
||||
ulLen = 4;
|
||||
nLen = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = hb_itemGetND( pItem );
|
||||
HB_DBL2ORD( &d, ptr );
|
||||
ulLen = 8;
|
||||
nLen = 8;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
d = ( double ) hb_itemGetDL( pItem );
|
||||
HB_DBL2ORD( &d, ptr );
|
||||
ulLen = 8;
|
||||
nLen = 8;
|
||||
if( iMode == CDX_CMP_PREFIX && pTag->uiType == 'T' )
|
||||
iMode = CDX_CMP_DATE;
|
||||
break;
|
||||
@@ -579,11 +579,11 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec,
|
||||
else
|
||||
d = hb_itemGetTD( pItem );
|
||||
HB_DBL2ORD( &d, ptr );
|
||||
ulLen = 8;
|
||||
nLen = 8;
|
||||
break;
|
||||
case 'L':
|
||||
*ptr = ( HB_BYTE ) ( hb_itemGetL( pItem ) ? 'T' : 'F' );
|
||||
ulLen = 1;
|
||||
nLen = 1;
|
||||
break;
|
||||
default:
|
||||
ptr = NULL;
|
||||
@@ -594,7 +594,7 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec,
|
||||
break;
|
||||
}
|
||||
|
||||
pKey = hb_cdxKeyPut( pKey, ptr, ( HB_USHORT ) ulLen, ulRec );
|
||||
pKey = hb_cdxKeyPut( pKey, ptr, ( HB_USHORT ) nLen, ulRec );
|
||||
pKey->mode = ( HB_USHORT ) iMode;
|
||||
|
||||
return pKey;
|
||||
@@ -614,10 +614,10 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag,
|
||||
case 'C':
|
||||
if( fTrans )
|
||||
{
|
||||
HB_SIZE ulLen = pKey->len;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pKey->val, &ulLen,
|
||||
HB_SIZE nLen = pKey->len;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pKey->val, &nLen,
|
||||
pTag->pIndex->pArea->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5590,19 +5590,19 @@ static HB_BOOL hb_cdxDBOISkipWild( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa
|
||||
static HB_BOOL hb_cdxRegexMatch( CDXAREAP pArea, PHB_REGEX pRegEx, LPCDXKEY pKey )
|
||||
{
|
||||
char * szKey = ( char * ) pKey->val;
|
||||
HB_SIZE ulLen = pKey->len;
|
||||
HB_SIZE nLen = pKey->len;
|
||||
char szBuff[ CDX_MAXKEY + 1 ];
|
||||
|
||||
if( pArea->dbfarea.area.cdPage != hb_vmCDP() )
|
||||
{
|
||||
ulLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pKey->len, szBuff, &ulLen,
|
||||
nLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pKey->len, szBuff, &nLen,
|
||||
pArea->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
szBuff[ ulLen ] = '\0';
|
||||
szBuff[ nLen ] = '\0';
|
||||
szKey = szBuff;
|
||||
}
|
||||
|
||||
return hb_regexMatch( pRegEx, szKey, ulLen, HB_FALSE );
|
||||
return hb_regexMatch( pRegEx, szKey, nLen, HB_FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8800,13 +8800,13 @@ static HB_BOOL hb_cdxQSort( LPCDXSORTINFO pSort, HB_BYTE * pSrc, HB_BYTE * pBuf,
|
||||
|
||||
static void hb_cdxSortSortPage( LPCDXSORTINFO pSort )
|
||||
{
|
||||
HB_ULONG ulSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
HB_SIZE nSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
#ifdef HB_CDX_DBGTIME
|
||||
cdxTimeIdxBld -= hb_cdxGetTime();
|
||||
#endif
|
||||
if( !hb_cdxQSort( pSort, pSort->pKeyPool, &pSort->pKeyPool[ ulSize ], pSort->ulKeys ) )
|
||||
if( !hb_cdxQSort( pSort, pSort->pKeyPool, &pSort->pKeyPool[ nSize ], pSort->ulKeys ) )
|
||||
{
|
||||
memcpy( pSort->pKeyPool, &pSort->pKeyPool[ ulSize ], ulSize );
|
||||
memcpy( pSort->pKeyPool, &pSort->pKeyPool[ nSize ], nSize );
|
||||
}
|
||||
#ifdef HB_CDX_DBGTIME
|
||||
cdxTimeIdxBld += hb_cdxGetTime();
|
||||
@@ -8927,7 +8927,7 @@ static void hb_cdxSortAddNodeKey( LPCDXSORTINFO pSort, int iLevel, HB_BYTE *pKey
|
||||
|
||||
static void hb_cdxSortWritePage( LPCDXSORTINFO pSort )
|
||||
{
|
||||
HB_SIZE ulSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
HB_SIZE nSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
|
||||
hb_cdxSortSortPage( pSort );
|
||||
|
||||
@@ -8943,7 +8943,7 @@ static void hb_cdxSortWritePage( LPCDXSORTINFO pSort )
|
||||
}
|
||||
pSort->pSwapPage[ pSort->ulCurPage ].ulKeys = pSort->ulKeys;
|
||||
pSort->pSwapPage[ pSort->ulCurPage ].nOffset = hb_fsSeekLarge( pSort->hTempFile, 0, FS_END );
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pKeyPool, ulSize ) != ulSize )
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pKeyPool, nSize ) != nSize )
|
||||
{
|
||||
hb_errInternal( 9302, "hb_cdxSortWritePage: Write error in temporary file.", NULL, NULL );
|
||||
}
|
||||
@@ -8959,14 +8959,14 @@ static void hb_cdxSortGetPageKey( LPCDXSORTINFO pSort, HB_ULONG ulPage,
|
||||
if( pSort->pSwapPage[ ulPage ].ulKeyBuf == 0 )
|
||||
{
|
||||
HB_ULONG ulKeys = HB_MIN( pSort->ulPgKeys, pSort->pSwapPage[ ulPage ].ulKeys );
|
||||
HB_SIZE ulSize = ulKeys * ( iLen + 4 );
|
||||
HB_SIZE nSize = ulKeys * ( iLen + 4 );
|
||||
|
||||
if( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, FS_SET ) != pSort->pSwapPage[ ulPage ].nOffset ||
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, ulSize ) != ulSize )
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, nSize ) != nSize )
|
||||
{
|
||||
hb_errInternal( 9303, "hb_cdxSortGetPageKey: Read error from temporary file.", NULL, NULL );
|
||||
}
|
||||
pSort->pSwapPage[ ulPage ].nOffset += ulSize;
|
||||
pSort->pSwapPage[ ulPage ].nOffset += nSize;
|
||||
pSort->pSwapPage[ ulPage ].ulKeyBuf = ulKeys;
|
||||
pSort->pSwapPage[ ulPage ].ulCurKey = 0;
|
||||
}
|
||||
|
||||
@@ -724,10 +724,10 @@ static PHB_ITEM hb_nsxKeyGetItem( PHB_ITEM pItem, LPKEYINFO pKey,
|
||||
case 'C':
|
||||
if( fTrans )
|
||||
{
|
||||
HB_SIZE ulLen = pTag->KeyLength;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pKey->val, &ulLen,
|
||||
HB_SIZE nLen = pTag->KeyLength;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pKey->val, &nLen,
|
||||
pTag->pIndex->pArea->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4720,18 +4720,18 @@ static HB_BOOL hb_nsxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi
|
||||
|
||||
static HB_BOOL hb_nsxRegexMatch( LPTAGINFO pTag, PHB_REGEX pRegEx, const char * szKey )
|
||||
{
|
||||
HB_SIZE ulLen = pTag->KeyLength;
|
||||
HB_SIZE nLen = pTag->KeyLength;
|
||||
char szBuff[ NSX_MAXKEYLEN + 1 ];
|
||||
|
||||
if( pTag->pIndex->pArea->dbfarea.area.cdPage != hb_vmCDP() )
|
||||
{
|
||||
ulLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pTag->KeyLength, szBuff, &ulLen,
|
||||
nLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pTag->KeyLength, szBuff, &nLen,
|
||||
pTag->pIndex->pArea->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
szBuff[ ulLen ] = '\0';
|
||||
szBuff[ nLen ] = '\0';
|
||||
szKey = szBuff;
|
||||
}
|
||||
return hb_regexMatch( pRegEx, szKey, ulLen, HB_FALSE );
|
||||
return hb_regexMatch( pRegEx, szKey, nLen, HB_FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5216,7 +5216,7 @@ static void hb_nsxSortAddNodeKey( LPNSXSORTINFO pSort, HB_UCHAR *pKeyVal, HB_ULO
|
||||
|
||||
static void hb_nsxSortWritePage( LPNSXSORTINFO pSort )
|
||||
{
|
||||
HB_SIZE ulSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
HB_SIZE nSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
|
||||
hb_nsxSortSortPage( pSort );
|
||||
|
||||
@@ -5235,7 +5235,7 @@ static void hb_nsxSortWritePage( LPNSXSORTINFO pSort )
|
||||
if( pSort->hTempFile != FS_ERROR )
|
||||
{
|
||||
pSort->pSwapPage[ pSort->ulCurPage ].nOffset = hb_fsSeekLarge( pSort->hTempFile, 0, FS_END );
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pStartKey, ulSize ) != ulSize )
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pStartKey, nSize ) != nSize )
|
||||
hb_nsxErrorRT( pSort->pTag->pIndex->pArea, EG_WRITE, EDBF_WRITE_TEMP,
|
||||
pSort->szTempFileName, hb_fsError(), 0, NULL );
|
||||
}
|
||||
@@ -5253,16 +5253,16 @@ static void hb_nsxSortGetPageKey( LPNSXSORTINFO pSort, HB_ULONG ulPage,
|
||||
if( pSort->pSwapPage[ ulPage ].ulKeyBuf == 0 )
|
||||
{
|
||||
HB_ULONG ulKeys = HB_MIN( pSort->ulPgKeys, pSort->pSwapPage[ ulPage ].ulKeys );
|
||||
HB_SIZE ulSize = ulKeys * ( iLen + 4 );
|
||||
HB_SIZE nSize = ulKeys * ( iLen + 4 );
|
||||
|
||||
if( pSort->hTempFile != FS_ERROR &&
|
||||
( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, FS_SET ) != pSort->pSwapPage[ ulPage ].nOffset ||
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, ulSize ) != ulSize ) )
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, nSize ) != nSize ) )
|
||||
{
|
||||
hb_nsxErrorRT( pSort->pTag->pIndex->pArea, EG_READ, EDBF_READ_TEMP,
|
||||
pSort->szTempFileName, hb_fsError(), 0, NULL );
|
||||
}
|
||||
pSort->pSwapPage[ ulPage ].nOffset += ulSize;
|
||||
pSort->pSwapPage[ ulPage ].nOffset += nSize;
|
||||
pSort->pSwapPage[ ulPage ].ulKeyBuf = ulKeys;
|
||||
pSort->pSwapPage[ ulPage ].ulCurKey = 0;
|
||||
}
|
||||
|
||||
@@ -516,10 +516,10 @@ static PHB_ITEM hb_ntxKeyGetItem( PHB_ITEM pItem, LPKEYINFO pKey,
|
||||
case 'C':
|
||||
if( fTrans )
|
||||
{
|
||||
HB_SIZE ulLen = pTag->KeyLength;
|
||||
char * pszVal = hb_cdpnDup( pKey->key, &ulLen,
|
||||
HB_SIZE nLen = pTag->KeyLength;
|
||||
char * pszVal = hb_cdpnDup( pKey->key, &nLen,
|
||||
pTag->Owner->Owner->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
pItem = hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4337,19 +4337,19 @@ static HB_BOOL hb_ntxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi
|
||||
|
||||
static HB_BOOL hb_ntxRegexMatch( LPTAGINFO pTag, PHB_REGEX pRegEx, char * szKey )
|
||||
{
|
||||
HB_SIZE ulLen = pTag->KeyLength;
|
||||
HB_SIZE nLen = pTag->KeyLength;
|
||||
char szBuff[ NTX_MAX_KEY + 1 ];
|
||||
|
||||
if( pTag->Owner->Owner->dbfarea.area.cdPage != hb_vmCDP() )
|
||||
{
|
||||
ulLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pTag->KeyLength, szBuff, &ulLen,
|
||||
nLen = sizeof( szBuff ) - 1;
|
||||
hb_cdpnDup2( szKey, pTag->KeyLength, szBuff, &nLen,
|
||||
pTag->Owner->Owner->dbfarea.area.cdPage, hb_vmCDP() );
|
||||
szBuff[ ulLen ] = '\0';
|
||||
szBuff[ nLen ] = '\0';
|
||||
szKey = szBuff;
|
||||
}
|
||||
|
||||
return hb_regexMatch( pRegEx, szKey, ulLen, HB_FALSE );
|
||||
return hb_regexMatch( pRegEx, szKey, nLen, HB_FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4702,13 +4702,13 @@ static void hb_ntxSortSortPage( LPNTXSORTINFO pSort )
|
||||
|
||||
static void hb_ntxSortBufferFlush( LPNTXSORTINFO pSort )
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
if( pSort->ulPagesIO )
|
||||
{
|
||||
LPNTXINDEX pIndex = pSort->pTag->Owner;
|
||||
ulSize = pSort->ulPagesIO * NTXBLOCKSIZE;
|
||||
if( hb_fileWriteAt( pIndex->DiskFile, pSort->pBuffIO, ulSize,
|
||||
hb_ntxFileOffset( pIndex, pSort->ulFirstIO ) ) != ulSize )
|
||||
nSize = pSort->ulPagesIO * NTXBLOCKSIZE;
|
||||
if( hb_fileWriteAt( pIndex->DiskFile, pSort->pBuffIO, nSize,
|
||||
hb_ntxFileOffset( pIndex, pSort->ulFirstIO ) ) != nSize )
|
||||
{
|
||||
hb_ntxErrorRT( pIndex->Owner, EG_WRITE, EDBF_WRITE,
|
||||
pIndex->IndexName, hb_fsError(), 0, NULL );
|
||||
@@ -4783,7 +4783,7 @@ static void hb_ntxSortAddNodeKey( LPNTXSORTINFO pSort, HB_BYTE *pKeyVal, HB_ULON
|
||||
|
||||
static void hb_ntxSortWritePage( LPNTXSORTINFO pSort )
|
||||
{
|
||||
HB_SIZE ulSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
HB_SIZE nSize = pSort->ulKeys * ( pSort->keyLen + 4 );
|
||||
|
||||
hb_ntxSortSortPage( pSort );
|
||||
|
||||
@@ -4802,7 +4802,7 @@ static void hb_ntxSortWritePage( LPNTXSORTINFO pSort )
|
||||
if( pSort->hTempFile != FS_ERROR )
|
||||
{
|
||||
pSort->pSwapPage[ pSort->ulCurPage ].nOffset = hb_fsSeekLarge( pSort->hTempFile, 0, FS_END );
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pStartKey, ulSize ) != ulSize )
|
||||
if( hb_fsWriteLarge( pSort->hTempFile, pSort->pStartKey, nSize ) != nSize )
|
||||
hb_ntxErrorRT( pSort->pTag->Owner->Owner, EG_WRITE, EDBF_WRITE_TEMP,
|
||||
pSort->szTempFileName, hb_fsError(), 0, NULL );
|
||||
}
|
||||
@@ -4820,16 +4820,16 @@ static void hb_ntxSortGetPageKey( LPNTXSORTINFO pSort, HB_ULONG ulPage,
|
||||
if( pSort->pSwapPage[ ulPage ].ulKeyBuf == 0 )
|
||||
{
|
||||
HB_ULONG ulKeys = HB_MIN( pSort->ulPgKeys, pSort->pSwapPage[ ulPage ].ulKeys );
|
||||
HB_SIZE ulSize = ulKeys * ( iLen + 4 );
|
||||
HB_SIZE nSize = ulKeys * ( iLen + 4 );
|
||||
|
||||
if( pSort->hTempFile != FS_ERROR &&
|
||||
( hb_fsSeekLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].nOffset, FS_SET ) != pSort->pSwapPage[ ulPage ].nOffset ||
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, ulSize ) != ulSize ) )
|
||||
hb_fsReadLarge( pSort->hTempFile, pSort->pSwapPage[ ulPage ].pKeyPool, nSize ) != nSize ) )
|
||||
{
|
||||
hb_ntxErrorRT( pSort->pTag->Owner->Owner, EG_READ, EDBF_READ_TEMP,
|
||||
pSort->szTempFileName, hb_fsError(), 0, NULL );
|
||||
}
|
||||
pSort->pSwapPage[ ulPage ].nOffset += ulSize;
|
||||
pSort->pSwapPage[ ulPage ].nOffset += nSize;
|
||||
pSort->pSwapPage[ ulPage ].ulKeyBuf = ulKeys;
|
||||
pSort->pSwapPage[ ulPage ].ulCurKey = 0;
|
||||
}
|
||||
|
||||
@@ -68,35 +68,35 @@ typedef struct _HB_FILEBUF
|
||||
{
|
||||
HB_FHANDLE hFile;
|
||||
HB_BYTE * pBuf;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE nSize;
|
||||
HB_SIZE nPos;
|
||||
} HB_FILEBUF;
|
||||
typedef HB_FILEBUF * PHB_FILEBUF;
|
||||
|
||||
static void hb_flushFBuffer( PHB_FILEBUF pFileBuf )
|
||||
{
|
||||
if( pFileBuf->ulPos > 0 )
|
||||
if( pFileBuf->nPos > 0 )
|
||||
{
|
||||
hb_fsWriteLarge( pFileBuf->hFile, pFileBuf->pBuf, pFileBuf->ulPos );
|
||||
pFileBuf->ulPos = 0;
|
||||
hb_fsWriteLarge( pFileBuf->hFile, pFileBuf->pBuf, pFileBuf->nPos );
|
||||
pFileBuf->nPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_addToFBuffer( PHB_FILEBUF pFileBuf, char ch )
|
||||
{
|
||||
if( pFileBuf->ulPos == pFileBuf->ulSize )
|
||||
if( pFileBuf->nPos == pFileBuf->nSize )
|
||||
hb_flushFBuffer( pFileBuf );
|
||||
pFileBuf->pBuf[ pFileBuf->ulPos++ ] = ( HB_BYTE ) ch;
|
||||
pFileBuf->pBuf[ pFileBuf->nPos++ ] = ( HB_BYTE ) ch;
|
||||
}
|
||||
|
||||
static void hb_addStrnToFBuffer( PHB_FILEBUF pFileBuf, const char * str, HB_SIZE ulSize )
|
||||
static void hb_addStrnToFBuffer( PHB_FILEBUF pFileBuf, const char * str, HB_SIZE nSize )
|
||||
{
|
||||
HB_SIZE ulPos = 0;
|
||||
while( ulPos < ulSize )
|
||||
HB_SIZE nPos = 0;
|
||||
while( nPos < nSize )
|
||||
{
|
||||
if( pFileBuf->ulPos == pFileBuf->ulSize )
|
||||
if( pFileBuf->nPos == pFileBuf->nSize )
|
||||
hb_flushFBuffer( pFileBuf );
|
||||
pFileBuf->pBuf[ pFileBuf->ulPos++ ] = ( HB_BYTE ) str[ ulPos++ ];
|
||||
pFileBuf->pBuf[ pFileBuf->nPos++ ] = ( HB_BYTE ) str[ nPos++ ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ static void hb_addStrToFBuffer( PHB_FILEBUF pFileBuf, const char * szStr )
|
||||
{
|
||||
while( *szStr )
|
||||
{
|
||||
if( pFileBuf->ulPos == pFileBuf->ulSize )
|
||||
if( pFileBuf->nPos == pFileBuf->nSize )
|
||||
hb_flushFBuffer( pFileBuf );
|
||||
pFileBuf->pBuf[ pFileBuf->ulPos++ ] = ( HB_BYTE ) *szStr++;
|
||||
pFileBuf->pBuf[ pFileBuf->nPos++ ] = ( HB_BYTE ) *szStr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,14 +118,14 @@ static void hb_destroyFBuffer( PHB_FILEBUF pFileBuf )
|
||||
hb_xfree( pFileBuf );
|
||||
}
|
||||
|
||||
static PHB_FILEBUF hb_createFBuffer( HB_FHANDLE hFile, HB_SIZE ulSize )
|
||||
static PHB_FILEBUF hb_createFBuffer( HB_FHANDLE hFile, HB_SIZE nSize )
|
||||
{
|
||||
PHB_FILEBUF pFileBuf = ( PHB_FILEBUF ) hb_xgrab( sizeof( HB_FILEBUF ) );
|
||||
|
||||
pFileBuf->hFile = hFile;
|
||||
pFileBuf->pBuf = ( HB_BYTE * ) hb_xgrab( ulSize );
|
||||
pFileBuf->ulSize = ulSize;
|
||||
pFileBuf->ulPos = 0;
|
||||
pFileBuf->pBuf = ( HB_BYTE * ) hb_xgrab( nSize );
|
||||
pFileBuf->nSize = nSize;
|
||||
pFileBuf->nPos = 0;
|
||||
return pFileBuf;
|
||||
}
|
||||
|
||||
@@ -138,15 +138,15 @@ static HB_BOOL hb_exportBufSqlVar( PHB_FILEBUF pFileBuf, PHB_ITEM pValue,
|
||||
{
|
||||
case HB_IT_STRING:
|
||||
{
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pValue );
|
||||
HB_SIZE ulCnt = 0;
|
||||
HB_SIZE nLen = hb_itemGetCLen( pValue );
|
||||
HB_SIZE nCnt = 0;
|
||||
const char *szVal = hb_itemGetCPtr( pValue );
|
||||
|
||||
hb_addStrToFBuffer( pFileBuf, szDelim );
|
||||
while( ulLen && HB_ISSPACE( szVal[ ulLen - 1 ] ) )
|
||||
ulLen--;
|
||||
while( nLen && HB_ISSPACE( szVal[ nLen - 1 ] ) )
|
||||
nLen--;
|
||||
|
||||
while( *szVal && ulCnt++ < ulLen )
|
||||
while( *szVal && nCnt++ < nLen )
|
||||
{
|
||||
if( *szVal == *szDelim || *szVal == *szEsc )
|
||||
hb_addToFBuffer( pFileBuf, *szEsc );
|
||||
|
||||
@@ -103,7 +103,7 @@ static void hb_delimClearRecordBuffer( DELIMAREAP pArea )
|
||||
|
||||
static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea )
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_USHORT uiField, uiLen;
|
||||
LPFIELD pField;
|
||||
HB_BYTE * pBuffer, * pFieldBuf;
|
||||
@@ -114,13 +114,13 @@ static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea )
|
||||
pArea->ulBufferRead = pArea->ulBufferIndex = 0;
|
||||
|
||||
pBuffer = pArea->pBuffer;
|
||||
ulSize = 0;
|
||||
nSize = 0;
|
||||
for( uiField = 0; uiField < pArea->area.uiFieldCount; ++uiField )
|
||||
{
|
||||
pField = pArea->area.lpFields + uiField;
|
||||
pFieldBuf = pArea->pRecord + pArea->pFieldOffset[ uiField ];
|
||||
if( ulSize )
|
||||
pBuffer[ ulSize++ ] = pArea->cSeparator;
|
||||
if( nSize )
|
||||
pBuffer[ nSize++ ] = pArea->cSeparator;
|
||||
|
||||
switch( pField->uiType )
|
||||
{
|
||||
@@ -130,21 +130,21 @@ static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea )
|
||||
--uiLen;
|
||||
if( pArea->cDelim )
|
||||
{
|
||||
pBuffer[ ulSize++ ] = pArea->cDelim;
|
||||
memcpy( pBuffer + ulSize, pFieldBuf, uiLen );
|
||||
ulSize += uiLen;
|
||||
pBuffer[ ulSize++ ] = pArea->cDelim;
|
||||
pBuffer[ nSize++ ] = pArea->cDelim;
|
||||
memcpy( pBuffer + nSize, pFieldBuf, uiLen );
|
||||
nSize += uiLen;
|
||||
pBuffer[ nSize++ ] = pArea->cDelim;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( pBuffer + ulSize, pFieldBuf, uiLen );
|
||||
ulSize += uiLen;
|
||||
memcpy( pBuffer + nSize, pFieldBuf, uiLen );
|
||||
nSize += uiLen;
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_FT_LOGICAL:
|
||||
pBuffer[ ulSize++ ] = ( *pFieldBuf == 'T' || *pFieldBuf == 't' ||
|
||||
*pFieldBuf == 'Y' || *pFieldBuf == 'y' ) ?
|
||||
pBuffer[ nSize++ ] = ( *pFieldBuf == 'T' || *pFieldBuf == 't' ||
|
||||
*pFieldBuf == 'Y' || *pFieldBuf == 'y' ) ?
|
||||
'T' : 'F';
|
||||
break;
|
||||
|
||||
@@ -154,8 +154,8 @@ static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea )
|
||||
++uiLen;
|
||||
if( uiLen < 8 )
|
||||
{
|
||||
memcpy( pBuffer + ulSize, pFieldBuf, 8 );
|
||||
ulSize += 8;
|
||||
memcpy( pBuffer + nSize, pFieldBuf, 8 );
|
||||
nSize += 8;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -165,32 +165,32 @@ static HB_SIZE hb_delimEncodeBuffer( DELIMAREAP pArea )
|
||||
++uiLen;
|
||||
if( uiLen < pField->uiLen )
|
||||
{
|
||||
memcpy( pBuffer + ulSize, pFieldBuf + uiLen, pField->uiLen - uiLen );
|
||||
ulSize += pField->uiLen - uiLen;
|
||||
memcpy( pBuffer + nSize, pFieldBuf + uiLen, pField->uiLen - uiLen );
|
||||
nSize += pField->uiLen - uiLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBuffer[ ulSize++ ] = '0';
|
||||
pBuffer[ nSize++ ] = '0';
|
||||
if( pField->uiDec )
|
||||
{
|
||||
pBuffer[ ulSize++ ] = '.';
|
||||
memset( pBuffer + ulSize, '0', pField->uiDec );
|
||||
ulSize += pField->uiDec;
|
||||
pBuffer[ nSize++ ] = '.';
|
||||
memset( pBuffer + nSize, '0', pField->uiDec );
|
||||
nSize += pField->uiDec;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_FT_MEMO:
|
||||
default:
|
||||
if( ulSize )
|
||||
--ulSize;
|
||||
if( nSize )
|
||||
--nSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
memcpy( pBuffer + ulSize, pArea->szEol, pArea->uiEolLen );
|
||||
ulSize += pArea->uiEolLen;
|
||||
memcpy( pBuffer + nSize, pArea->szEol, pArea->uiEolLen );
|
||||
nSize += pArea->uiEolLen;
|
||||
|
||||
return ulSize;
|
||||
return nSize;
|
||||
}
|
||||
|
||||
static int hb_delimNextChar( DELIMAREAP pArea )
|
||||
@@ -199,21 +199,21 @@ static int hb_delimNextChar( DELIMAREAP pArea )
|
||||
( pArea->ulBufferRead == 0 ||
|
||||
pArea->ulBufferRead >= pArea->ulBufferSize - 1 ) )
|
||||
{
|
||||
HB_SIZE ulLeft = pArea->ulBufferRead - pArea->ulBufferIndex;
|
||||
HB_SIZE nLeft = pArea->ulBufferRead - pArea->ulBufferIndex;
|
||||
|
||||
if( ulLeft )
|
||||
if( nLeft )
|
||||
memcpy( pArea->pBuffer,
|
||||
pArea->pBuffer + pArea->ulBufferIndex, ulLeft );
|
||||
pArea->pBuffer + pArea->ulBufferIndex, nLeft );
|
||||
pArea->ulBufferStart += pArea->ulBufferIndex;
|
||||
pArea->ulBufferIndex = 0;
|
||||
pArea->ulBufferRead = hb_fileReadAt( pArea->pFile,
|
||||
pArea->pBuffer + ulLeft,
|
||||
pArea->ulBufferSize - ulLeft,
|
||||
pArea->ulBufferStart + ulLeft );
|
||||
pArea->pBuffer + nLeft,
|
||||
pArea->ulBufferSize - nLeft,
|
||||
pArea->ulBufferStart + nLeft );
|
||||
if( pArea->ulBufferRead > 0 &&
|
||||
pArea->pBuffer[ pArea->ulBufferRead + ulLeft - 1 ] == '\032' )
|
||||
pArea->pBuffer[ pArea->ulBufferRead + nLeft - 1 ] == '\032' )
|
||||
pArea->ulBufferRead--;
|
||||
pArea->ulBufferRead += ulLeft;
|
||||
pArea->ulBufferRead += nLeft;
|
||||
}
|
||||
|
||||
if( pArea->ulBufferIndex + pArea->uiEolLen <= pArea->ulBufferRead &&
|
||||
@@ -557,10 +557,10 @@ static HB_ERRCODE hb_delimGetValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE
|
||||
case HB_FT_STRING:
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
HB_SIZE ulLen = pField->uiLen;
|
||||
HB_SIZE nLen = pField->uiLen;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
&nLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -641,7 +641,7 @@ static HB_ERRCODE hb_delimPutValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE
|
||||
char szBuffer[ 256 ];
|
||||
HB_ERRCODE errCode;
|
||||
LPFIELD pField;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_delimPutValue(%p,%hu,%p)", pArea, uiIndex, pItem));
|
||||
|
||||
@@ -662,22 +662,22 @@ static HB_ERRCODE hb_delimPutValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE
|
||||
{
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
ulSize = pField->uiLen;
|
||||
nSize = pField->uiLen;
|
||||
hb_cdpnDup2( hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ),
|
||||
( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulSize, hb_vmCDP(), pArea->area.cdPage );
|
||||
&nSize, hb_vmCDP(), pArea->area.cdPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulSize = hb_itemGetCLen( pItem );
|
||||
if( ulSize > ( HB_SIZE ) pField->uiLen )
|
||||
ulSize = pField->uiLen;
|
||||
nSize = hb_itemGetCLen( pItem );
|
||||
if( nSize > ( HB_SIZE ) pField->uiLen )
|
||||
nSize = pField->uiLen;
|
||||
memcpy( pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
hb_itemGetCPtr( pItem ), ulSize );
|
||||
hb_itemGetCPtr( pItem ), nSize );
|
||||
}
|
||||
if( ulSize < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + ulSize,
|
||||
' ', pField->uiLen - ulSize );
|
||||
if( nSize < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + nSize,
|
||||
' ', pField->uiLen - nSize );
|
||||
}
|
||||
else
|
||||
errCode = EDBF_DATATYPE;
|
||||
@@ -822,10 +822,10 @@ static HB_ERRCODE hb_delimGoCold( DELIMAREAP pArea )
|
||||
|
||||
if( pArea->fRecordChanged )
|
||||
{
|
||||
HB_SIZE ulSize = hb_delimEncodeBuffer( pArea );
|
||||
HB_SIZE nSize = hb_delimEncodeBuffer( pArea );
|
||||
|
||||
if( hb_fileWriteAt( pArea->pFile, pArea->pBuffer, ulSize,
|
||||
pArea->ulRecordOffset ) != ulSize )
|
||||
if( hb_fileWriteAt( pArea->pFile, pArea->pBuffer, nSize,
|
||||
pArea->ulRecordOffset ) != nSize )
|
||||
{
|
||||
PHB_ITEM pError = hb_errNew();
|
||||
|
||||
@@ -838,7 +838,7 @@ static HB_ERRCODE hb_delimGoCold( DELIMAREAP pArea )
|
||||
hb_itemRelease( pError );
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pArea->ulFileSize += ulSize;
|
||||
pArea->ulFileSize += nSize;
|
||||
pArea->ulNextOffset = pArea->ulFileSize;
|
||||
pArea->fRecordChanged = HB_FALSE;
|
||||
pArea->fFlush = HB_TRUE;
|
||||
|
||||
@@ -211,25 +211,25 @@ static void hb_LZSSxExit( PHB_LZSSX_COMPR pCompr )
|
||||
}
|
||||
|
||||
static PHB_LZSSX_COMPR hb_LZSSxInit(
|
||||
HB_FHANDLE hInput, HB_BYTE * pSrcBuf, HB_SIZE ulSrcBuf,
|
||||
HB_FHANDLE hOutput, HB_BYTE * pDstBuf, HB_SIZE ulDstBuf )
|
||||
HB_FHANDLE hInput, HB_BYTE * pSrcBuf, HB_SIZE nSrcBuf,
|
||||
HB_FHANDLE hOutput, HB_BYTE * pDstBuf, HB_SIZE nDstBuf )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr = ( PHB_LZSSX_COMPR ) hb_xgrab( sizeof( HB_LZSSX_COMPR ) );
|
||||
|
||||
if( hInput != FS_ERROR && ulSrcBuf == 0 )
|
||||
ulSrcBuf = LZSS_IOBUFLEN;
|
||||
if( hOutput != FS_ERROR && ulDstBuf == 0 )
|
||||
ulDstBuf = LZSS_IOBUFLEN;
|
||||
if( hInput != FS_ERROR && nSrcBuf == 0 )
|
||||
nSrcBuf = LZSS_IOBUFLEN;
|
||||
if( hOutput != FS_ERROR && nDstBuf == 0 )
|
||||
nDstBuf = LZSS_IOBUFLEN;
|
||||
|
||||
pCompr->hInput = hInput;
|
||||
pCompr->inBuffer = pSrcBuf;
|
||||
pCompr->inBuffSize = ulSrcBuf;
|
||||
pCompr->inBuffSize = nSrcBuf;
|
||||
pCompr->inBuffPos = 0;
|
||||
pCompr->inBuffRead = ( hInput == FS_ERROR ) ? ulSrcBuf : 0;
|
||||
pCompr->inBuffRead = ( hInput == FS_ERROR ) ? nSrcBuf : 0;
|
||||
pCompr->fInFree = ( hInput != FS_ERROR && pSrcBuf == NULL );
|
||||
pCompr->hOutput = hOutput;
|
||||
pCompr->outBuffer = pDstBuf;
|
||||
pCompr->outBuffSize = ulDstBuf;
|
||||
pCompr->outBuffSize = nDstBuf;
|
||||
pCompr->outBuffPos = 0;
|
||||
pCompr->fOutFree = ( hOutput != FS_ERROR && pDstBuf == NULL );
|
||||
|
||||
@@ -239,9 +239,9 @@ static PHB_LZSSX_COMPR hb_LZSSxInit(
|
||||
pCompr->fContinue = HB_FALSE;
|
||||
|
||||
if( pCompr->fInFree )
|
||||
pCompr->inBuffer = ( HB_BYTE * ) hb_xgrab( ulDstBuf );
|
||||
pCompr->inBuffer = ( HB_BYTE * ) hb_xgrab( nDstBuf );
|
||||
if( pCompr->fOutFree )
|
||||
pCompr->outBuffer = ( HB_BYTE * ) hb_xgrab( ulDstBuf );
|
||||
pCompr->outBuffer = ( HB_BYTE * ) hb_xgrab( nDstBuf );
|
||||
|
||||
/* initialize the ring buffer with spaces, because SIX uses
|
||||
dynamic ring buffer then we do not have to fill last MAXLENGTH
|
||||
@@ -466,7 +466,7 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
HB_UCHAR itemSet[ ITEMSETSIZE ];
|
||||
HB_UCHAR itemMask;
|
||||
HB_SIZE ulSize = 0;
|
||||
HB_SIZE nSize = 0;
|
||||
int iItem;
|
||||
short int i, c, len, r, s, last_match_length;
|
||||
|
||||
@@ -487,7 +487,7 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
|
||||
pCompr->ring_buffer[ r + len ] = ( HB_UCHAR ) c;
|
||||
}
|
||||
if( len == 0 )
|
||||
return ulSize;
|
||||
return nSize;
|
||||
|
||||
for( i = 1; i <= MAXLENGTH; i++ )
|
||||
hb_LZSSxNodeInsert( pCompr, r - i );
|
||||
@@ -517,7 +517,7 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
|
||||
if( !hb_LZSSxWrite( pCompr, itemSet[ i ] ) )
|
||||
return ( HB_SIZE ) -1;
|
||||
}
|
||||
ulSize += iItem;
|
||||
nSize += iItem;
|
||||
itemSet[ 0 ] = 0;
|
||||
iItem = itemMask = 1;
|
||||
}
|
||||
@@ -550,56 +550,56 @@ static HB_SIZE hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
|
||||
if( !hb_LZSSxWrite( pCompr, itemSet[ i ] ) )
|
||||
return ( HB_SIZE ) -1;
|
||||
}
|
||||
ulSize += iItem;
|
||||
nSize += iItem;
|
||||
}
|
||||
|
||||
if( !hb_LZSSxFlush( pCompr ) )
|
||||
return ( HB_SIZE ) -1;
|
||||
|
||||
return ulSize;
|
||||
return nSize;
|
||||
}
|
||||
|
||||
|
||||
HB_BOOL hb_LZSSxCompressMem( const char * pSrcBuf, HB_SIZE ulSrcLen,
|
||||
char * pDstBuf, HB_SIZE ulDstLen,
|
||||
HB_SIZE * pulSize )
|
||||
HB_BOOL hb_LZSSxCompressMem( const char * pSrcBuf, HB_SIZE nSrcLen,
|
||||
char * pDstBuf, HB_SIZE nDstLen,
|
||||
HB_SIZE * pnSize )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, ( HB_BYTE * ) pSrcBuf, ulSrcLen,
|
||||
FS_ERROR, ( HB_BYTE * ) pDstBuf, ulDstLen );
|
||||
ulSize = hb_LZSSxEncode( pCompr );
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, ( HB_BYTE * ) pSrcBuf, nSrcLen,
|
||||
FS_ERROR, ( HB_BYTE * ) pDstBuf, nDstLen );
|
||||
nSize = hb_LZSSxEncode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
if( pulSize )
|
||||
*pulSize = ulSize;
|
||||
return ( ulSize <= ulDstLen );
|
||||
if( pnSize )
|
||||
*pnSize = nSize;
|
||||
return ( nSize <= nDstLen );
|
||||
}
|
||||
|
||||
HB_BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, HB_SIZE ulSrcLen,
|
||||
char * pDstBuf, HB_SIZE ulDstLen )
|
||||
HB_BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, HB_SIZE nSrcLen,
|
||||
char * pDstBuf, HB_SIZE nDstLen )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
HB_BOOL fResult;
|
||||
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, ( HB_BYTE * ) pSrcBuf, ulSrcLen,
|
||||
FS_ERROR, ( HB_BYTE * ) pDstBuf, ulDstLen );
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, ( HB_BYTE * ) pSrcBuf, nSrcLen,
|
||||
FS_ERROR, ( HB_BYTE * ) pDstBuf, nDstLen );
|
||||
fResult = hb_LZSSxDecode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
return fResult;
|
||||
}
|
||||
|
||||
HB_BOOL hb_LZSSxCompressFile( HB_FHANDLE hInput, HB_FHANDLE hOutput, HB_SIZE * pulSize )
|
||||
HB_BOOL hb_LZSSxCompressFile( HB_FHANDLE hInput, HB_FHANDLE hOutput, HB_SIZE * pnSize )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
pCompr = hb_LZSSxInit( hInput, NULL, 0, hOutput, NULL, 0 );
|
||||
ulSize = hb_LZSSxEncode( pCompr );
|
||||
nSize = hb_LZSSxEncode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
if( pulSize )
|
||||
*pulSize = ulSize;
|
||||
return ulSize != ( HB_SIZE ) -1;
|
||||
if( pnSize )
|
||||
*pnSize = nSize;
|
||||
return nSize != ( HB_SIZE ) -1;
|
||||
}
|
||||
|
||||
HB_BOOL hb_LZSSxDecompressFile( HB_FHANDLE hInput, HB_FHANDLE hOutput )
|
||||
@@ -619,7 +619,7 @@ HB_FUNC( SX_FCOMPRESS )
|
||||
HB_FHANDLE hInput, hOutput;
|
||||
const char * szSource = hb_parc( 1 ), * szDestin = hb_parc( 2 );
|
||||
HB_BYTE buf[ 4 ];
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
if( szSource && *szSource && szDestin && *szDestin )
|
||||
{
|
||||
@@ -635,10 +635,10 @@ HB_FUNC( SX_FCOMPRESS )
|
||||
/* store uncompressed file size in first 4 bytes of destination
|
||||
* file in little endian order - for SIX3 compatibility
|
||||
*/
|
||||
ulSize = hb_fsSeek( hInput, 0, FS_END );
|
||||
nSize = hb_fsSeek( hInput, 0, FS_END );
|
||||
if( hb_fsSeek( hInput, 0, FS_SET ) == 0 )
|
||||
{
|
||||
HB_PUT_LE_UINT32( buf, ulSize );
|
||||
HB_PUT_LE_UINT32( buf, nSize );
|
||||
if( hb_fsWrite( hOutput, buf, 4 ) == 4 )
|
||||
fRet = hb_LZSSxCompressFile( hInput, hOutput, NULL );
|
||||
}
|
||||
@@ -685,20 +685,20 @@ HB_FUNC( _SX_STRCOMPRESS )
|
||||
|
||||
if( pStr )
|
||||
{
|
||||
HB_SIZE ulLen = hb_parclen( 1 ), ulBuf, ulDst;
|
||||
HB_SIZE nLen = hb_parclen( 1 ), nBuf, nDst;
|
||||
|
||||
/* this is for strict SIX compatibility - in general very bad idea */
|
||||
ulBuf = ulLen + 257;
|
||||
pBuf = ( char * ) hb_xgrab( ulBuf );
|
||||
HB_PUT_LE_UINT32( pBuf, ulLen );
|
||||
if( ! hb_LZSSxCompressMem( pStr, ulLen, pBuf + 4, ulBuf - 4, &ulDst ) )
|
||||
nBuf = nLen + 257;
|
||||
pBuf = ( char * ) hb_xgrab( nBuf );
|
||||
HB_PUT_LE_UINT32( pBuf, nLen );
|
||||
if( ! hb_LZSSxCompressMem( pStr, nLen, pBuf + 4, nBuf - 4, &nDst ) )
|
||||
{
|
||||
/* It's not six compatible - it's a workaround for wrongly defined SIX behavior */
|
||||
HB_PUT_LE_UINT32( pBuf, HB_SX_UNCOMPRESED );
|
||||
memcpy( pBuf + 4, pStr, ulLen );
|
||||
ulDst = ulLen;
|
||||
memcpy( pBuf + 4, pStr, nLen );
|
||||
nDst = nLen;
|
||||
}
|
||||
hb_retclen( pBuf, ulDst + 4 );
|
||||
hb_retclen( pBuf, nDst + 4 );
|
||||
hb_xfree( pBuf );
|
||||
}
|
||||
else
|
||||
@@ -713,24 +713,24 @@ HB_FUNC( _SX_STRDECOMPRESS )
|
||||
|
||||
if( pStr )
|
||||
{
|
||||
HB_SIZE ulLen = hb_parclen( 1 ), ulBuf;
|
||||
HB_SIZE nLen = hb_parclen( 1 ), nBuf;
|
||||
|
||||
if( ulLen >= 4 )
|
||||
if( nLen >= 4 )
|
||||
{
|
||||
ulBuf = HB_GET_LE_UINT32( pStr );
|
||||
if( ulBuf == HB_SX_UNCOMPRESED )
|
||||
nBuf = HB_GET_LE_UINT32( pStr );
|
||||
if( nBuf == HB_SX_UNCOMPRESED )
|
||||
{
|
||||
hb_retclen( pStr + 4, ulLen - 4 );
|
||||
hb_retclen( pStr + 4, nLen - 4 );
|
||||
fOK = HB_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBuf = ( char * ) hb_xalloc( ulBuf + 1 );
|
||||
pBuf = ( char * ) hb_xalloc( nBuf + 1 );
|
||||
if( pBuf )
|
||||
{
|
||||
fOK = hb_LZSSxDecompressMem( pStr + 4, ulLen - 4, pBuf, ulBuf );
|
||||
fOK = hb_LZSSxDecompressMem( pStr + 4, nLen - 4, pBuf, nBuf );
|
||||
if( fOK )
|
||||
hb_retclen_buffer( pBuf, ulBuf );
|
||||
hb_retclen_buffer( pBuf, nBuf );
|
||||
else
|
||||
hb_xfree( pBuf );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ static HB_U32 hb_sxNextSeed( HB_U32 ulSeed, const char * pKeyVal, HB_U16 * puiKe
|
||||
return ulSeed;
|
||||
}
|
||||
|
||||
void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE ulLen )
|
||||
void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE nLen )
|
||||
{
|
||||
HB_U32 ulSeed;
|
||||
HB_U16 uiKey;
|
||||
@@ -101,7 +101,7 @@ void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE
|
||||
int i;
|
||||
|
||||
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
|
||||
for( ul = 0, i = 0; ul < ulLen; ul++ )
|
||||
for( ul = 0, i = 0; ul < nLen; ul++ )
|
||||
{
|
||||
ucChar = ( HB_UCHAR ) pSrc[ul];
|
||||
ucShft = ( HB_UCHAR ) ( uiKey & 0x07 );
|
||||
@@ -113,7 +113,7 @@ void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE
|
||||
}
|
||||
}
|
||||
|
||||
void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE ulLen )
|
||||
void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE nLen )
|
||||
{
|
||||
HB_U32 ulSeed;
|
||||
HB_U16 uiKey;
|
||||
@@ -122,7 +122,7 @@ void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, HB_SIZE
|
||||
int i;
|
||||
|
||||
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
|
||||
for( ul = 0, i = 0; ul < ulLen; ul++ )
|
||||
for( ul = 0, i = 0; ul < nLen; ul++ )
|
||||
{
|
||||
ucChar = ( HB_UCHAR ) pSrc[ul] - ( uiKey & 0xFF );
|
||||
ucShft = ( HB_UCHAR ) ( uiKey & 0x07 );
|
||||
@@ -137,7 +137,7 @@ static HB_BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, char * pKeyVal )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
PHB_ITEM pItem = NULL;
|
||||
HB_SIZE ulKey;
|
||||
HB_SIZE nKey;
|
||||
|
||||
if( ! ( hb_itemType( pKeyItem ) & HB_IT_STRING ) )
|
||||
{
|
||||
@@ -152,11 +152,11 @@ static HB_BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, char * pKeyVal )
|
||||
}
|
||||
if( hb_itemType( pKeyItem ) & HB_IT_STRING )
|
||||
{
|
||||
ulKey = hb_itemGetCLen( pKeyItem );
|
||||
if( ulKey )
|
||||
memcpy( pKeyVal, hb_itemGetCPtr( pKeyItem ), HB_MIN( ulKey, 8 ) );
|
||||
if( ulKey < 8 )
|
||||
memset( pKeyVal + ulKey, 0, 8 - ulKey );
|
||||
nKey = hb_itemGetCLen( pKeyItem );
|
||||
if( nKey )
|
||||
memcpy( pKeyVal, hb_itemGetCPtr( pKeyItem ), HB_MIN( nKey, 8 ) );
|
||||
if( nKey < 8 )
|
||||
memset( pKeyVal + nKey, 0, 8 - nKey );
|
||||
fResult = HB_TRUE;
|
||||
}
|
||||
if( pItem )
|
||||
@@ -169,19 +169,17 @@ HB_FUNC( SX_ENCRYPT )
|
||||
if( hb_pcount() > 0 )
|
||||
{
|
||||
char keyBuf[ 8 ];
|
||||
HB_SIZE ulLen = hb_parclen( 1 );
|
||||
HB_SIZE nLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
if( nLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
{
|
||||
char * pDst = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
hb_sxEnCrypt( hb_parc( 1 ), pDst, keyBuf, ulLen );
|
||||
pDst[ ulLen ] = 0;
|
||||
hb_retclen_buffer( pDst, ulLen );
|
||||
char * pDst = ( char * ) hb_xgrab( nLen + 1 );
|
||||
hb_sxEnCrypt( hb_parc( 1 ), pDst, keyBuf, nLen );
|
||||
pDst[ nLen ] = 0;
|
||||
hb_retclen_buffer( pDst, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,18 +188,16 @@ HB_FUNC( SX_DECRYPT )
|
||||
if( hb_pcount() > 0 )
|
||||
{
|
||||
char keyBuf[ 8 ];
|
||||
HB_SIZE ulLen = hb_parclen( 1 );
|
||||
HB_SIZE nLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
if( nLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
{
|
||||
char * pDst = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
hb_sxDeCrypt( hb_parc( 1 ), pDst, keyBuf, ulLen );
|
||||
pDst[ ulLen ] = 0;
|
||||
hb_retclen_buffer( pDst, ulLen );
|
||||
char * pDst = ( char * ) hb_xgrab( nLen + 1 );
|
||||
hb_sxDeCrypt( hb_parc( 1 ), pDst, keyBuf, nLen );
|
||||
pDst[ nLen ] = 0;
|
||||
hb_retclen_buffer( pDst, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ HB_FUNC( SX_FNAMEPARSER )
|
||||
{
|
||||
char szPathBuf[ HB_PATH_MAX ];
|
||||
PHB_FNAME pFileName;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
char * pszFree;
|
||||
|
||||
szFileName = hb_fsNameConv( szFileName, &pszFree );
|
||||
@@ -80,17 +80,17 @@ HB_FUNC( SX_FNAMEPARSER )
|
||||
{
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,9 +236,9 @@ HB_FUNC( SX_RLOCK )
|
||||
pRecords = hb_param( 1, HB_IT_ARRAY );
|
||||
if( pRecords )
|
||||
{
|
||||
HB_SIZE ul, ulLen = hb_arrayLen( pRecords );
|
||||
pResult = hb_itemArrayNew( ulLen );
|
||||
for( ul = 1; ul <= ulLen; ++ul )
|
||||
HB_SIZE ul, nLen = hb_arrayLen( pRecords );
|
||||
pResult = hb_itemArrayNew( nLen );
|
||||
for( ul = 1; ul <= nLen; ++ul )
|
||||
{
|
||||
dbLockInfo.itmRecID = hb_arrayGetItemPtr( pRecords, ul );
|
||||
SELF_LOCK( pArea, &dbLockInfo );
|
||||
@@ -268,8 +268,8 @@ HB_FUNC( SX_UNLOCK )
|
||||
PHB_ITEM pRecords = hb_param( 1, HB_IT_ARRAY );
|
||||
if( pRecords )
|
||||
{
|
||||
HB_SIZE ul, ulLen = hb_arrayLen( pRecords );
|
||||
for( ul = 1; ul <= ulLen; ++ul )
|
||||
HB_SIZE ul, nLen = hb_arrayLen( pRecords );
|
||||
for( ul = 1; ul <= nLen; ++ul )
|
||||
{
|
||||
SELF_UNLOCK( pArea, hb_arrayGetItemPtr( pRecords, ul ) );
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ HB_FUNC( SX_SLIMFAST )
|
||||
if( szExp && *szExp )
|
||||
{
|
||||
char * szDst, cQuote = 0, c;
|
||||
HB_SIZE ulDst;
|
||||
HB_SIZE nDst;
|
||||
|
||||
szDst = ( char * ) hb_xgrab( hb_parclen( 1 ) + 1 );
|
||||
ulDst = 0;
|
||||
nDst = 0;
|
||||
|
||||
while( ( c = *szExp++ ) != 0 )
|
||||
{
|
||||
@@ -76,14 +76,14 @@ HB_FUNC( SX_SLIMFAST )
|
||||
cQuote = c;
|
||||
else if( !cQuote )
|
||||
{
|
||||
if( c == ' ' && ulDst && szDst[ulDst - 1] == ' ' )
|
||||
if( c == ' ' && nDst && szDst[nDst - 1] == ' ' )
|
||||
continue;
|
||||
c = ( char ) hb_charUpper( ( HB_UCHAR ) c );
|
||||
}
|
||||
szDst[ulDst++] = c;
|
||||
szDst[nDst++] = c;
|
||||
}
|
||||
|
||||
hb_retclen_buffer( szDst, ulDst );
|
||||
hb_retclen_buffer( szDst, nDst );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
|
||||
@@ -332,7 +332,7 @@ typedef struct _HSXINFO
|
||||
HB_BOOL fWrLocked; /* the index is locked for writing */
|
||||
|
||||
char * pSearchVal; /* current search value for HS_NEXT */
|
||||
HB_SIZE ulSearch; /* the length of search value */
|
||||
HB_SIZE nSearch; /* the length of search value */
|
||||
HB_BYTE * pSearchKey; /* current search key val for HS_NEXT */
|
||||
HB_ULONG ulCurrRec; /* current record for HS_NEXT */
|
||||
|
||||
@@ -465,7 +465,7 @@ static int hb_hsxHashVal( int c1, int c2, int iKeyBits,
|
||||
return iBitNum;
|
||||
}
|
||||
|
||||
static void hb_hsxHashStr( const char * pStr, HB_SIZE ulLen, HB_BYTE * pKey, int iKeySize,
|
||||
static void hb_hsxHashStr( const char * pStr, HB_SIZE nLen, HB_BYTE * pKey, int iKeySize,
|
||||
HB_BOOL fNoCase, int iFilter, HB_BOOL fUseHash )
|
||||
{
|
||||
int c1, c2, iBitNum, iKeyBits = iKeySize << 3;
|
||||
@@ -474,16 +474,16 @@ static void hb_hsxHashStr( const char * pStr, HB_SIZE ulLen, HB_BYTE * pKey, int
|
||||
#if 0
|
||||
/* This code keeps the strict CFTS behavior which stops string
|
||||
manipulating at first chr(0) character */
|
||||
if( pStr && ulLen-- && ( c1 = ( HB_UCHAR ) *pStr++ ) != 0 )
|
||||
if( pStr && nLen-- && ( c1 = ( HB_UCHAR ) *pStr++ ) != 0 )
|
||||
{
|
||||
while( ulLen-- && ( c2 = ( HB_UCHAR ) *pStr++ ) != 0 )
|
||||
while( nLen-- && ( c2 = ( HB_UCHAR ) *pStr++ ) != 0 )
|
||||
{
|
||||
#else
|
||||
/* This version can work well with embedded 0 characters */
|
||||
if( pStr && ulLen-- )
|
||||
if( pStr && nLen-- )
|
||||
{
|
||||
c1 = ( HB_UCHAR ) *pStr++;
|
||||
while( ulLen-- )
|
||||
while( nLen-- )
|
||||
{
|
||||
c2 = ( HB_UCHAR ) *pStr++;
|
||||
#endif
|
||||
@@ -497,20 +497,20 @@ static void hb_hsxHashStr( const char * pStr, HB_SIZE ulLen, HB_BYTE * pKey, int
|
||||
}
|
||||
}
|
||||
|
||||
static int hb_hsxStrCmp( const char * pSub, HB_SIZE ulSub, const char * pStr, HB_SIZE ulLen,
|
||||
static int hb_hsxStrCmp( const char * pSub, HB_SIZE nSub, const char * pStr, HB_SIZE nLen,
|
||||
HB_BOOL fNoCase, int iFilter )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
HB_UCHAR c1, c2;
|
||||
HB_SIZE ul;
|
||||
|
||||
if( ulSub == 0 )
|
||||
if( nSub == 0 )
|
||||
return HSX_SUCCESSFALSE;
|
||||
|
||||
while( !fResult && ulLen >= ulSub )
|
||||
while( !fResult && nLen >= nSub )
|
||||
{
|
||||
fResult = HB_TRUE;
|
||||
for( ul = 0; fResult && ul < ulSub; ul++ )
|
||||
for( ul = 0; fResult && ul < nSub; ul++ )
|
||||
{
|
||||
c1 = ( HB_UCHAR ) pSub[ ul ];
|
||||
c2 = ( HB_UCHAR ) pStr[ ul ];
|
||||
@@ -543,7 +543,7 @@ static int hb_hsxStrCmp( const char * pSub, HB_SIZE ulSub, const char * pStr, HB
|
||||
#endif
|
||||
fResult = ( c1 == c2 );
|
||||
}
|
||||
--ulLen;
|
||||
--nLen;
|
||||
++pStr;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, HB_BYTE *pKey, HB_BOOL *fDel
|
||||
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
|
||||
int iResult = HSX_SUCCESS;
|
||||
const char * pStr;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
if( ! pHSX )
|
||||
return HSX_BADHANDLE;
|
||||
@@ -606,7 +606,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, HB_BYTE *pKey, HB_BOOL *fDel
|
||||
if( hb_itemType( pExpr ) & HB_IT_STRING )
|
||||
{
|
||||
pStr = hb_itemGetCPtr( pExpr );
|
||||
ulLen = hb_itemGetCLen( pExpr );
|
||||
nLen = hb_itemGetCLen( pExpr );
|
||||
if( fDeleted )
|
||||
*fDeleted = HB_FALSE;
|
||||
}
|
||||
@@ -625,7 +625,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, HB_BYTE *pKey, HB_BOOL *fDel
|
||||
}
|
||||
pItem = hb_vmEvalBlockOrMacro( pExpr );
|
||||
pStr = hb_itemGetCPtr( pItem );
|
||||
ulLen = hb_itemGetCLen( pItem );
|
||||
nLen = hb_itemGetCLen( pItem );
|
||||
if( fDeleted )
|
||||
{
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
@@ -641,7 +641,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, HB_BYTE *pKey, HB_BOOL *fDel
|
||||
}
|
||||
|
||||
if( iResult == HSX_SUCCESS )
|
||||
hb_hsxHashStr( pStr, ulLen, pKey, pHSX->uiRecordSize, pHSX->fIgnoreCase,
|
||||
hb_hsxHashStr( pStr, nLen, pKey, pHSX->uiRecordSize, pHSX->fIgnoreCase,
|
||||
pHSX->iFilterType, pHSX->fUseHash );
|
||||
|
||||
return iResult;
|
||||
@@ -698,14 +698,14 @@ static int hb_hsxFlush( int iHandle )
|
||||
if( pHSX->fChanged )
|
||||
{
|
||||
HB_FOFFSET fOffset;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
fOffset = ( HB_FOFFSET ) HSXHEADER_LEN +
|
||||
( HB_FOFFSET ) ( pHSX->ulFirstRec - 1 ) *
|
||||
( HB_FOFFSET ) pHSX->uiRecordSize;
|
||||
ulSize = pHSX->ulBufRec * pHSX->uiRecordSize;
|
||||
nSize = pHSX->ulBufRec * pHSX->uiRecordSize;
|
||||
|
||||
if( hb_fileWriteAt( pHSX->pFile, pHSX->pBuffer, ulSize, fOffset ) != ulSize )
|
||||
if( hb_fileWriteAt( pHSX->pFile, pHSX->pBuffer, nSize, fOffset ) != nSize )
|
||||
return HSX_BADWRITE;
|
||||
|
||||
pHSX->fChanged = HB_FALSE;
|
||||
@@ -777,7 +777,7 @@ static int hb_hsxRead( int iHandle, HB_ULONG ulRecord, HB_BYTE ** pRecPtr )
|
||||
ulRecord >= pHSX->ulFirstRec + pHSX->ulBufRec )
|
||||
{
|
||||
HB_FOFFSET fOffset;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_ULONG ulFirst;
|
||||
int iRetVal;
|
||||
|
||||
@@ -799,9 +799,9 @@ static int hb_hsxRead( int iHandle, HB_ULONG ulRecord, HB_BYTE ** pRecPtr )
|
||||
fOffset = ( HB_FOFFSET ) HSXHEADER_LEN +
|
||||
( HB_FOFFSET ) ( ulFirst - 1 ) *
|
||||
( HB_FOFFSET ) pHSX->uiRecordSize;
|
||||
ulSize = pHSX->ulBufRec * pHSX->uiRecordSize;
|
||||
nSize = pHSX->ulBufRec * pHSX->uiRecordSize;
|
||||
|
||||
if( hb_fileReadAt( pHSX->pFile, pHSX->pBuffer, ulSize, fOffset ) != ulSize )
|
||||
if( hb_fileReadAt( pHSX->pFile, pHSX->pBuffer, nSize, fOffset ) != nSize )
|
||||
{
|
||||
pHSX->ulFirstRec = pHSX->ulBufRec = 0;
|
||||
return HSX_BADREAD;
|
||||
@@ -1140,7 +1140,7 @@ static int hb_hsxAdd( int iHandle, HB_ULONG *pulRecNo, PHB_ITEM pExpr, HB_BOOL f
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
static int hb_hsxSeekSet( int iHandle, const char * pStr, HB_SIZE ulLen )
|
||||
static int hb_hsxSeekSet( int iHandle, const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
|
||||
int iRetVal;
|
||||
@@ -1157,13 +1157,13 @@ static int hb_hsxSeekSet( int iHandle, const char * pStr, HB_SIZE ulLen )
|
||||
{
|
||||
if( pHSX->pSearchVal )
|
||||
hb_xfree( pHSX->pSearchVal );
|
||||
pHSX->pSearchVal = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
memcpy( pHSX->pSearchVal, pStr, ulLen );
|
||||
pHSX->pSearchVal[ ulLen ] = '\0';
|
||||
pHSX->ulSearch = ulLen;
|
||||
pHSX->pSearchVal = ( char * ) hb_xgrab( nLen + 1 );
|
||||
memcpy( pHSX->pSearchVal, pStr, nLen );
|
||||
pHSX->pSearchVal[ nLen ] = '\0';
|
||||
pHSX->nSearch = nLen;
|
||||
if( ! pHSX->pSearchKey )
|
||||
pHSX->pSearchKey = ( HB_BYTE * ) hb_xgrab( pHSX->uiRecordSize );
|
||||
hb_hsxHashStr( pStr, ulLen, pHSX->pSearchKey,
|
||||
hb_hsxHashStr( pStr, nLen, pHSX->pSearchKey,
|
||||
pHSX->uiRecordSize, pHSX->fIgnoreCase,
|
||||
pHSX->iFilterType, pHSX->fUseHash );
|
||||
pHSX->ulCurrRec = 0;
|
||||
@@ -1264,8 +1264,8 @@ static void hb_hsxExpDestroy( PHB_ITEM pItem )
|
||||
hb_itemRelease( pItem );
|
||||
}
|
||||
|
||||
static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE ulLen,
|
||||
const char * szSub, HB_SIZE ulSub, int iType )
|
||||
static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE nLen,
|
||||
const char * szSub, HB_SIZE nSub, int iType )
|
||||
{
|
||||
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
|
||||
int iResult;
|
||||
@@ -1273,14 +1273,14 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE ulLen,
|
||||
if( !szSub && pHSX )
|
||||
{
|
||||
szSub = pHSX->pSearchVal;
|
||||
ulSub = pHSX->ulSearch;
|
||||
nSub = pHSX->nSearch;
|
||||
}
|
||||
if( !pHSX )
|
||||
iResult = HSX_BADHANDLE;
|
||||
else if( !szText || !szSub )
|
||||
iResult = HSX_BADPARMS;
|
||||
else if( ulSub > ulLen || ulSub == 0 )
|
||||
/* !ulSub -> do not accept empty substrings as $ operator at runtime */
|
||||
else if( nSub > nLen || nSub == 0 )
|
||||
/* !nSub -> do not accept empty substrings as $ operator at runtime */
|
||||
iResult = HSX_SUCCESSFALSE;
|
||||
else
|
||||
{
|
||||
@@ -1289,23 +1289,23 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE ulLen,
|
||||
switch( iType )
|
||||
{
|
||||
case HSX_VERIFY_BEGIN:
|
||||
iResult = hb_hsxStrCmp( szSub, ulSub, szText, ulSub,
|
||||
iResult = hb_hsxStrCmp( szSub, nSub, szText, nSub,
|
||||
pHSX->fIgnoreCase, pHSX->iFilterType );
|
||||
break;
|
||||
case HSX_VERIFY_END:
|
||||
iResult = hb_hsxStrCmp( szSub, ulSub, szText + ulLen - ulSub, ulSub,
|
||||
iResult = hb_hsxStrCmp( szSub, nSub, szText + nLen - nSub, nSub,
|
||||
pHSX->fIgnoreCase, pHSX->iFilterType );
|
||||
break;
|
||||
case HSX_VERIFY_AND:
|
||||
iResult = HSX_SUCCESS;
|
||||
for( ul = 0; ul < ulSub && iResult == HSX_SUCCESS; ul++ )
|
||||
for( ul = 0; ul < nSub && iResult == HSX_SUCCESS; ul++ )
|
||||
{
|
||||
while( szSub[ ul ] == ' ' && ul < ulSub )
|
||||
while( szSub[ ul ] == ' ' && ul < nSub )
|
||||
++ul;
|
||||
ull = ul;
|
||||
while( szSub[ ull ] != ' ' && ull < ulSub )
|
||||
while( szSub[ ull ] != ' ' && ull < nSub )
|
||||
++ull;
|
||||
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, ulLen,
|
||||
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, nLen,
|
||||
pHSX->fIgnoreCase, pHSX->iFilterType );
|
||||
ul = ull;
|
||||
}
|
||||
@@ -1313,14 +1313,14 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE ulLen,
|
||||
/*
|
||||
case HSX_VERIFY_OR:
|
||||
iResult = HSX_SUCCESSFALSE;
|
||||
for( ul = 0; ul < ulSub && iResult == HSX_SUCCESSFALSE; ul++ )
|
||||
for( ul = 0; ul < nSub && iResult == HSX_SUCCESSFALSE; ul++ )
|
||||
{
|
||||
while( szSub[ ul ] == ' ' && ul < ulSub )
|
||||
while( szSub[ ul ] == ' ' && ul < nSub )
|
||||
++ul;
|
||||
ull = ul;
|
||||
while( szSub[ ull ] != ' ' && ull < ulSub )
|
||||
while( szSub[ ull ] != ' ' && ull < nSub )
|
||||
++ull;
|
||||
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, ulLen,
|
||||
iResult = hb_hsxStrCmp( &szSub[ ul ], ull - ul, szText, nLen,
|
||||
pHSX->fIgnoreCase, pHSX->iFilterType );
|
||||
ul = ull;
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE ulLen,
|
||||
*/
|
||||
case HSX_VERIFY_PHRASE:
|
||||
default:
|
||||
iResult = hb_hsxStrCmp( szSub, ulSub, szText, ulLen,
|
||||
iResult = hb_hsxStrCmp( szSub, nSub, szText, nLen,
|
||||
pHSX->fIgnoreCase, pHSX->iFilterType );
|
||||
}
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ static int hb_hsxIndex( const char * szFile, PHB_ITEM pExpr, int iKeySize,
|
||||
return hb_hsxOpen( szFile, iBufSize, iMode );
|
||||
}
|
||||
|
||||
static int hb_hsxFilter( int iHandle, const char * pSeek, HB_SIZE ulSeek,
|
||||
static int hb_hsxFilter( int iHandle, const char * pSeek, HB_SIZE nSeek,
|
||||
PHB_ITEM pVerify, int iVerifyType )
|
||||
{
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
@@ -1640,7 +1640,7 @@ static int hb_hsxFilter( int iHandle, const char * pSeek, HB_SIZE ulSeek,
|
||||
|
||||
errCode = SELF_RECNO( pArea, &ulRecNo );
|
||||
if( errCode != HB_FAILURE )
|
||||
iResult = hb_hsxSeekSet( iHandle, pSeek, ulSeek );
|
||||
iResult = hb_hsxSeekSet( iHandle, pSeek, nSeek );
|
||||
|
||||
fValid = HB_TRUE;
|
||||
pItem = hb_itemNew( NULL );
|
||||
@@ -1660,7 +1660,7 @@ static int hb_hsxFilter( int iHandle, const char * pSeek, HB_SIZE ulSeek,
|
||||
fValid = hb_hsxVerify( iHandle,
|
||||
hb_itemGetCPtr( pArea->valResult ),
|
||||
hb_itemGetCLen( pArea->valResult ),
|
||||
pSeek, ulSeek, iVerifyType ) == HSX_SUCCESS;
|
||||
pSeek, nSeek, iVerifyType ) == HSX_SUCCESS;
|
||||
}
|
||||
if( fValid )
|
||||
{
|
||||
@@ -1835,14 +1835,14 @@ HB_FUNC( HS_FILTER )
|
||||
{
|
||||
const char * szText = hb_parc( 2 );
|
||||
char * pBuff = NULL;
|
||||
HB_SIZE ulLen = hb_parclen( 2 ), ull, ul;
|
||||
HB_SIZE nLen = hb_parclen( 2 ), ull, ul;
|
||||
HB_ULONG ulRecords = 0;
|
||||
int iHandle = -1, iResult = HSX_BADPARMS;
|
||||
HB_BOOL fNew = HB_FALSE, fToken = HB_TRUE;
|
||||
|
||||
if( hb_parclen( 1 ) > 0 )
|
||||
{
|
||||
if( ulLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
iHandle = hb_hsxOpen( hb_parc( 1 ), hb_parni( 4 ),
|
||||
hb_param( 5, HB_IT_NUMERIC ) ? hb_parni( 5 ) : HSXDEFOPENMODE );
|
||||
@@ -1863,19 +1863,19 @@ HB_FUNC( HS_FILTER )
|
||||
iHandle = pHSX->iHandle;
|
||||
if( !szText )
|
||||
{
|
||||
ulLen = pHSX->ulSearch;
|
||||
if( ulLen && pHSX->pSearchVal )
|
||||
nLen = pHSX->nSearch;
|
||||
if( nLen && pHSX->pSearchVal )
|
||||
{
|
||||
pBuff = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
memcpy( pBuff, pHSX->pSearchVal, ulLen );
|
||||
pBuff[ ulLen ] = '\0';
|
||||
pBuff = ( char * ) hb_xgrab( nLen + 1 );
|
||||
memcpy( pBuff, pHSX->pSearchVal, nLen );
|
||||
pBuff[ nLen ] = '\0';
|
||||
szText = pBuff;
|
||||
fToken = HB_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( iHandle >= 0 && ulLen > 0 )
|
||||
if( iHandle >= 0 && nLen > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_itemNew( NULL );
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
@@ -1894,12 +1894,12 @@ HB_FUNC( HS_FILTER )
|
||||
if( fToken )
|
||||
{
|
||||
iResult = HSX_SUCCESS;
|
||||
for( ul = 0; ul < ulLen && iResult == HSX_SUCCESS; ul++ )
|
||||
for( ul = 0; ul < nLen && iResult == HSX_SUCCESS; ul++ )
|
||||
{
|
||||
while( szText[ ul ] == ' ' && ul < ulLen )
|
||||
while( szText[ ul ] == ' ' && ul < nLen )
|
||||
++ul;
|
||||
ull = ul;
|
||||
while( szText[ ull ] != ' ' && ull < ulLen )
|
||||
while( szText[ ull ] != ' ' && ull < nLen )
|
||||
++ull;
|
||||
iResult = hb_hsxFilter( iHandle, &szText[ ul ], ull - ul,
|
||||
hb_param( 3, HB_IT_ANY ), HSX_VERIFY_PHRASE );
|
||||
@@ -1908,7 +1908,7 @@ HB_FUNC( HS_FILTER )
|
||||
}
|
||||
else
|
||||
{
|
||||
iResult = hb_hsxFilter( iHandle, szText, ulLen,
|
||||
iResult = hb_hsxFilter( iHandle, szText, nLen,
|
||||
hb_param( 3, HB_IT_ANY ),
|
||||
HSX_VERIFY_PHRASE );
|
||||
}
|
||||
@@ -1962,7 +1962,7 @@ HB_FUNC( HS_VERIFY )
|
||||
int iHandle = hb_parni( 1 );
|
||||
PHB_ITEM pExpr = hb_param( 2, HB_IT_BLOCK );
|
||||
const char * szText = NULL;
|
||||
HB_SIZE ulLen = 0;
|
||||
HB_SIZE nLen = 0;
|
||||
LPHSXINFO pHSX;
|
||||
|
||||
pHSX = hb_hsxGetPointer( iHandle );
|
||||
@@ -1982,10 +1982,10 @@ HB_FUNC( HS_VERIFY )
|
||||
if( pExpr )
|
||||
{
|
||||
szText = hb_itemGetCPtr( pExpr );
|
||||
ulLen = hb_itemGetCLen( pExpr );
|
||||
nLen = hb_itemGetCLen( pExpr );
|
||||
}
|
||||
|
||||
hb_retni( hb_hsxVerify( hb_parni( 1 ), szText, ulLen,
|
||||
hb_retni( hb_hsxVerify( hb_parni( 1 ), szText, nLen,
|
||||
hb_parc( 3 ), hb_parclen( 3 ),
|
||||
hb_parni( 4 ) ) );
|
||||
}
|
||||
@@ -1993,21 +1993,21 @@ HB_FUNC( HS_VERIFY )
|
||||
{
|
||||
PHB_ITEM pExpr = hb_param( 1, HB_IT_BLOCK );
|
||||
const char * szSub = hb_parc( 2 ), * szText = NULL;
|
||||
HB_SIZE ulSub = hb_parclen( 2 ), ulLen = 0;
|
||||
HB_SIZE nSub = hb_parclen( 2 ), nLen = 0;
|
||||
HB_BOOL fIgnoreCase = hb_parl( 3 );
|
||||
|
||||
if( ulSub )
|
||||
if( nSub )
|
||||
{
|
||||
pExpr = pExpr ? hb_vmEvalBlockOrMacro( pExpr ) : hb_param( 2, HB_IT_STRING );
|
||||
|
||||
if( pExpr )
|
||||
{
|
||||
szText = hb_itemGetCPtr( pExpr );
|
||||
ulLen = hb_itemGetCLen( pExpr );
|
||||
nLen = hb_itemGetCLen( pExpr );
|
||||
}
|
||||
}
|
||||
hb_retl( ulLen && ulSub && hb_hsxStrCmp( szSub, ulSub, szText, ulLen,
|
||||
fIgnoreCase, 3 ) );
|
||||
hb_retl( nLen && nSub && hb_hsxStrCmp( szSub, nSub, szText, nLen,
|
||||
fIgnoreCase, 3 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -380,10 +380,10 @@ static HB_ERRCODE hb_sdfGetValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
case HB_FT_STRING:
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
HB_SIZE ulLen = pField->uiLen;
|
||||
HB_SIZE nLen = pField->uiLen;
|
||||
char * pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, ulLen );
|
||||
&nLen, pArea->area.cdPage, hb_vmCDP() );
|
||||
hb_itemPutCLPtr( pItem, pszVal, nLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -470,7 +470,7 @@ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
char szBuffer[ 256 ];
|
||||
HB_ERRCODE errCode;
|
||||
LPFIELD pField;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_sdfPutValue(%p,%hu,%p)", pArea, uiIndex, pItem));
|
||||
|
||||
@@ -491,22 +491,22 @@ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI
|
||||
{
|
||||
if( ( pField->uiFlags & HB_FF_BINARY ) == 0 )
|
||||
{
|
||||
ulSize = pField->uiLen;
|
||||
nSize = pField->uiLen;
|
||||
hb_cdpnDup2( hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ),
|
||||
( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
&ulSize, hb_vmCDP(), pArea->area.cdPage );
|
||||
&nSize, hb_vmCDP(), pArea->area.cdPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulSize = hb_itemGetCLen( pItem );
|
||||
if( ulSize > ( HB_SIZE ) pField->uiLen )
|
||||
ulSize = pField->uiLen;
|
||||
nSize = hb_itemGetCLen( pItem );
|
||||
if( nSize > ( HB_SIZE ) pField->uiLen )
|
||||
nSize = pField->uiLen;
|
||||
memcpy( pArea->pRecord + pArea->pFieldOffset[ uiIndex ],
|
||||
hb_itemGetCPtr( pItem ), ulSize );
|
||||
hb_itemGetCPtr( pItem ), nSize );
|
||||
}
|
||||
if( ulSize < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + ulSize,
|
||||
' ', pField->uiLen - ulSize );
|
||||
if( nSize < ( HB_SIZE ) pField->uiLen )
|
||||
memset( pArea->pRecord + pArea->pFieldOffset[ uiIndex ] + nSize,
|
||||
' ', pField->uiLen - nSize );
|
||||
}
|
||||
else
|
||||
errCode = EDBF_DATATYPE;
|
||||
@@ -651,10 +651,10 @@ static HB_ERRCODE hb_sdfGoCold( SDFAREAP pArea )
|
||||
|
||||
if( pArea->fRecordChanged )
|
||||
{
|
||||
HB_SIZE ulWrite = pArea->uiRecordLen + pArea->uiEolLen;
|
||||
HB_SIZE nWrite = pArea->uiRecordLen + pArea->uiEolLen;
|
||||
|
||||
if( hb_fileWriteAt( pArea->pFile, pArea->pRecord, ulWrite,
|
||||
pArea->ulRecordOffset ) != ulWrite )
|
||||
if( hb_fileWriteAt( pArea->pFile, pArea->pRecord, nWrite,
|
||||
pArea->ulRecordOffset ) != nWrite )
|
||||
{
|
||||
PHB_ITEM pError = hb_errNew();
|
||||
|
||||
@@ -667,7 +667,7 @@ static HB_ERRCODE hb_sdfGoCold( SDFAREAP pArea )
|
||||
hb_itemRelease( pError );
|
||||
return HB_FAILURE;
|
||||
}
|
||||
pArea->ulFileSize += ulWrite;
|
||||
pArea->ulFileSize += nWrite;
|
||||
pArea->ulNextOffset = pArea->ulFileSize;
|
||||
pArea->fRecordChanged = HB_FALSE;
|
||||
pArea->fFlush = HB_TRUE;
|
||||
|
||||
@@ -170,9 +170,9 @@ static AREAP hb_usrGetAreaPointer( int iArea )
|
||||
* RDD structures conversions
|
||||
*/
|
||||
|
||||
static PHB_ITEM hb_usrArrayGet( PHB_ITEM pArray, HB_SIZE ulPos, HB_TYPE uiType )
|
||||
static PHB_ITEM hb_usrArrayGet( PHB_ITEM pArray, HB_SIZE nPos, HB_TYPE uiType )
|
||||
{
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, ulPos );
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, nPos );
|
||||
|
||||
if( pItem && ( hb_itemType( pItem ) & uiType ) != 0 )
|
||||
return pItem;
|
||||
@@ -180,9 +180,9 @@ static PHB_ITEM hb_usrArrayGet( PHB_ITEM pArray, HB_SIZE ulPos, HB_TYPE uiType )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char * hb_usrArrayGetC( PHB_ITEM pArray, HB_SIZE ulPos )
|
||||
static const char * hb_usrArrayGetC( PHB_ITEM pArray, HB_SIZE nPos )
|
||||
{
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, ulPos );
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, nPos );
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
return hb_itemGetCPtr( pItem );
|
||||
@@ -797,11 +797,11 @@ static HB_ERRCODE hb_usrInit( LPRDDNODE pRDD )
|
||||
|
||||
if( pRDD->rddID >= s_uiUsrNodes )
|
||||
{
|
||||
HB_SIZE ulSize = ( pRDD->rddID + 1 ) * sizeof( LPUSRRDDNODE );
|
||||
HB_SIZE nSize = ( pRDD->rddID + 1 ) * sizeof( LPUSRRDDNODE );
|
||||
if( s_uiUsrNodes )
|
||||
s_pUsrRddNodes = ( LPUSRRDDNODE * ) hb_xrealloc( s_pUsrRddNodes, ulSize );
|
||||
s_pUsrRddNodes = ( LPUSRRDDNODE * ) hb_xrealloc( s_pUsrRddNodes, nSize );
|
||||
else
|
||||
s_pUsrRddNodes = ( LPUSRRDDNODE * ) hb_xgrab( ulSize );
|
||||
s_pUsrRddNodes = ( LPUSRRDDNODE * ) hb_xgrab( nSize );
|
||||
do
|
||||
{
|
||||
s_pUsrRddNodes[ s_uiUsrNodes ] = NULL;
|
||||
|
||||
@@ -514,7 +514,7 @@ HB_ERRCODE hb_rddDetachArea( AREAP pArea, PHB_ITEM pCargo )
|
||||
{
|
||||
AREAP * pHolder;
|
||||
PHB_ITEM pDetachedArea;
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE nPos;
|
||||
int iArea;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_rddDetachArea(%p,%p)", pArea, pCargo));
|
||||
@@ -551,14 +551,14 @@ HB_ERRCODE hb_rddDetachArea( AREAP pArea, PHB_ITEM pCargo )
|
||||
if( ! s_pDetachedAreas )
|
||||
{
|
||||
s_pDetachedAreas = hb_itemArrayNew( 1 );
|
||||
ulPos = 1;
|
||||
nPos = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulPos = hb_arrayLen( s_pDetachedAreas ) + 1;
|
||||
hb_arraySize( s_pDetachedAreas, ulPos );
|
||||
nPos = hb_arrayLen( s_pDetachedAreas ) + 1;
|
||||
hb_arraySize( s_pDetachedAreas, nPos );
|
||||
}
|
||||
pDetachedArea = hb_arrayGetItemPtr( s_pDetachedAreas, ulPos );
|
||||
pDetachedArea = hb_arrayGetItemPtr( s_pDetachedAreas, nPos );
|
||||
hb_arrayNew( pDetachedArea, 2 );
|
||||
if( pCargo )
|
||||
hb_arraySet( pDetachedArea, 2, pCargo );
|
||||
@@ -617,21 +617,21 @@ AREAP hb_rddRequestArea( const char * szAlias, PHB_ITEM pCargo,
|
||||
{
|
||||
if( s_pDetachedAreas )
|
||||
{
|
||||
HB_SIZE ulLen = hb_arrayLen( s_pDetachedAreas ), ulPos = 1;
|
||||
HB_SIZE nLen = hb_arrayLen( s_pDetachedAreas ), nPos = 1;
|
||||
if( pSymAlias )
|
||||
{
|
||||
for( ulPos = 1; ulPos <= ulLen; ++ulPos )
|
||||
for( nPos = 1; nPos <= nLen; ++nPos )
|
||||
{
|
||||
AREAP * pDetachedArea = ( AREAP * )
|
||||
hb_arrayGetPtrGC( hb_arrayGetItemPtr( s_pDetachedAreas, ulPos ),
|
||||
hb_arrayGetPtrGC( hb_arrayGetItemPtr( s_pDetachedAreas, nPos ),
|
||||
1, &s_gcWAFuncs );
|
||||
if( pSymAlias == ( PHB_DYNS ) ( *pDetachedArea )->atomAlias )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ulPos <= ulLen )
|
||||
if( nPos <= nLen )
|
||||
{
|
||||
PHB_ITEM pArray = hb_arrayGetItemPtr( s_pDetachedAreas, ulPos );
|
||||
PHB_ITEM pArray = hb_arrayGetItemPtr( s_pDetachedAreas, nPos );
|
||||
AREAP * pDetachedArea = ( AREAP * )
|
||||
hb_arrayGetPtrGC( pArray, 1, &s_gcWAFuncs );
|
||||
|
||||
@@ -639,8 +639,8 @@ AREAP hb_rddRequestArea( const char * szAlias, PHB_ITEM pCargo,
|
||||
*pDetachedArea = NULL;
|
||||
if( pCargo )
|
||||
hb_arrayGet( pArray, 2, pCargo );
|
||||
hb_arrayDel( s_pDetachedAreas, ulPos );
|
||||
hb_arraySize( s_pDetachedAreas, ulLen - 1 );
|
||||
hb_arrayDel( s_pDetachedAreas, nPos );
|
||||
hb_arraySize( s_pDetachedAreas, nLen - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,20 +92,20 @@ typedef struct _HB_GTCGI
|
||||
int iLineBufSize;
|
||||
char * sLineBuf;
|
||||
char * szCrLf;
|
||||
HB_SIZE ulCrLf;
|
||||
HB_SIZE nCrLf;
|
||||
HB_BOOL fDispTrans;
|
||||
PHB_CODEPAGE cdpTerm;
|
||||
PHB_CODEPAGE cdpHost;
|
||||
} HB_GTCGI, * PHB_GTCGI;
|
||||
|
||||
static void hb_gt_cgi_termOut( PHB_GTCGI pGTCGI, const char * szStr, HB_SIZE ulLen )
|
||||
static void hb_gt_cgi_termOut( PHB_GTCGI pGTCGI, const char * szStr, HB_SIZE nLen )
|
||||
{
|
||||
hb_fsWriteLarge( pGTCGI->hStdout, szStr, ulLen );
|
||||
hb_fsWriteLarge( pGTCGI->hStdout, szStr, nLen );
|
||||
}
|
||||
|
||||
static void hb_gt_cgi_newLine( PHB_GTCGI pGTCGI )
|
||||
{
|
||||
hb_gt_cgi_termOut( pGTCGI, pGTCGI->szCrLf, pGTCGI->ulCrLf );
|
||||
hb_gt_cgi_termOut( pGTCGI, pGTCGI->szCrLf, pGTCGI->nCrLf );
|
||||
}
|
||||
|
||||
static void hb_gt_cgi_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr )
|
||||
@@ -121,7 +121,7 @@ static void hb_gt_cgi_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
|
||||
pGTCGI->hStdout = hFilenoStdout;
|
||||
|
||||
pGTCGI->szCrLf = hb_strdup( hb_conNewLine() );
|
||||
pGTCGI->ulCrLf = strlen( pGTCGI->szCrLf );
|
||||
pGTCGI->nCrLf = strlen( pGTCGI->szCrLf );
|
||||
|
||||
hb_fsSetDevMode( pGTCGI->hStdout, FD_BINARY );
|
||||
|
||||
@@ -250,22 +250,22 @@ static HB_BOOL hb_gt_cgi_SetDispCP( PHB_GT pGT, const char *pszTermCDP, const ch
|
||||
}
|
||||
|
||||
#ifdef HB_GT_CGI_RAWOUTPUT
|
||||
static void hb_gt_cgi_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLength )
|
||||
static void hb_gt_cgi_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE nLength )
|
||||
{
|
||||
PHB_GTCGI pGTCGI = HB_GTCGI_GET( pGT );
|
||||
|
||||
if( pGTCGI->fDispTrans )
|
||||
{
|
||||
HB_SIZE ulLen = ulLength;
|
||||
char * buffer = hb_cdpnDup( szText, &ulLen,
|
||||
HB_SIZE nLen = nLength;
|
||||
char * buffer = hb_cdpnDup( szText, &nLen,
|
||||
pGTCGI->cdpHost, pGTCGI->cdpTerm );
|
||||
hb_gt_cgi_termOut( pGTCGI, buffer, ulLen );
|
||||
hb_gt_cgi_termOut( pGTCGI, buffer, nLen );
|
||||
hb_xfree( buffer );
|
||||
}
|
||||
else
|
||||
hb_gt_cgi_termOut( pGTCGI, szText, ulLength );
|
||||
hb_gt_cgi_termOut( pGTCGI, szText, nLength );
|
||||
|
||||
while( ulLength-- )
|
||||
while( nLength-- )
|
||||
{
|
||||
switch( *szText++ )
|
||||
{
|
||||
@@ -292,7 +292,7 @@ static void hb_gt_cgi_WriteCon( PHB_GT pGT, const char * szText, HB_SIZE ulLengt
|
||||
HB_GTSUPER_SETPOS( pGT, pGTCGI->iRow, pGTCGI->iCol );
|
||||
}
|
||||
|
||||
static void hb_gt_cgi_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * szText, HB_SIZE ulLength )
|
||||
static void hb_gt_cgi_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * szText, HB_SIZE nLength )
|
||||
{
|
||||
int iLineFeed = 0, iSpace = 0;
|
||||
PHB_GTCGI pGTCGI = HB_GTCGI_GET( pGT );
|
||||
@@ -323,7 +323,7 @@ static void hb_gt_cgi_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * szTe
|
||||
pGTCGI->iRow = iRow;
|
||||
pGTCGI->iCol = iCol;
|
||||
|
||||
hb_gt_cgi_WriteCon( pGT, szText, ulLength );
|
||||
hb_gt_cgi_WriteCon( pGT, szText, nLength );
|
||||
}
|
||||
|
||||
#else /* HB_GT_CGI_RAWOUTPUT */
|
||||
@@ -385,10 +385,10 @@ static void hb_gt_cgi_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
|
||||
{
|
||||
if( pGTCGI->fDispTrans )
|
||||
{
|
||||
HB_SIZE ulLen = iLen;
|
||||
char * buffer = hb_cdpnDup( pGTCGI->sLineBuf, &ulLen,
|
||||
HB_SIZE nLen = iLen;
|
||||
char * buffer = hb_cdpnDup( pGTCGI->sLineBuf, &nLen,
|
||||
pGTCGI->cdpHost, pGTCGI->cdpTerm );
|
||||
hb_gt_cgi_termOut( pGTCGI, buffer, ulLen );
|
||||
hb_gt_cgi_termOut( pGTCGI, buffer, nLen );
|
||||
hb_xfree( buffer );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -103,10 +103,10 @@ static int s_iRow;
|
||||
static int s_iCol;
|
||||
static int s_iLineBufSize = 0;
|
||||
static char * s_sLineBuf;
|
||||
static HB_SIZE s_ulTransBufSize = 0;
|
||||
static HB_SIZE s_nTransBufSize = 0;
|
||||
static char * s_sTransBuf;
|
||||
static const char * s_szCrLf;
|
||||
static HB_SIZE s_ulCrLf;
|
||||
static HB_SIZE s_nCrLf;
|
||||
static int s_iCurrentSGR, s_iFgColor, s_iBgColor, s_iBold, s_iBlink, s_iAM;
|
||||
static int s_iCursorStyle;
|
||||
static HB_BOOL s_bStdinConsole;
|
||||
@@ -477,7 +477,7 @@ static void hb_gt_pca_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
|
||||
hb_gt_pca_setKeyTrans( NULL, NULL );
|
||||
|
||||
s_szCrLf = hb_conNewLine();
|
||||
s_ulCrLf = strlen( s_szCrLf );
|
||||
s_nCrLf = strlen( s_szCrLf );
|
||||
|
||||
hb_fsSetDevMode( s_hFilenoStdout, FD_BINARY );
|
||||
|
||||
@@ -575,10 +575,10 @@ static void hb_gt_pca_Exit( PHB_GT pGT )
|
||||
hb_xfree( s_sLineBuf );
|
||||
s_iLineBufSize = 0;
|
||||
}
|
||||
if( s_ulTransBufSize > 0 )
|
||||
if( s_nTransBufSize > 0 )
|
||||
{
|
||||
hb_xfree( s_sTransBuf );
|
||||
s_ulTransBufSize = 0;
|
||||
s_nTransBufSize = 0;
|
||||
}
|
||||
if( s_iOutBufSize > 0 )
|
||||
{
|
||||
@@ -830,12 +830,12 @@ static void hb_gt_pca_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
|
||||
{
|
||||
if( s_fDispTrans )
|
||||
{
|
||||
HB_SIZE ulLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( s_sLineBuf, ulLen,
|
||||
s_sTransBuf, &ulLen,
|
||||
&s_sTransBuf, &s_ulTransBufSize,
|
||||
HB_SIZE nLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( s_sLineBuf, nLen,
|
||||
s_sTransBuf, &nLen,
|
||||
&s_sTransBuf, &s_nTransBufSize,
|
||||
s_cdpHost, s_cdpTerm );
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, buffer, ( int ) ulLen );
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, buffer, ( int ) nLen );
|
||||
}
|
||||
else
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, s_sLineBuf, iLen );
|
||||
@@ -852,12 +852,12 @@ static void hb_gt_pca_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
|
||||
{
|
||||
if( s_fDispTrans )
|
||||
{
|
||||
HB_SIZE ulLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( s_sLineBuf, ulLen,
|
||||
s_sTransBuf, &ulLen,
|
||||
&s_sTransBuf, &s_ulTransBufSize,
|
||||
HB_SIZE nLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( s_sLineBuf, nLen,
|
||||
s_sTransBuf, &nLen,
|
||||
&s_sTransBuf, &s_nTransBufSize,
|
||||
s_cdpHost, s_cdpTerm );
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, buffer, ( int ) ulLen );
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, buffer, ( int ) nLen );
|
||||
}
|
||||
else
|
||||
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor2, s_sLineBuf, iLen );
|
||||
|
||||
@@ -104,11 +104,11 @@ typedef struct _HB_GTSTD
|
||||
|
||||
int iLineBufSize;
|
||||
char * sLineBuf;
|
||||
HB_SIZE ulTransBufSize;
|
||||
HB_SIZE nTransBufSize;
|
||||
char * sTransBuf;
|
||||
HB_BOOL fFullRedraw;
|
||||
char * szCrLf;
|
||||
HB_SIZE ulCrLf;
|
||||
HB_SIZE nCrLf;
|
||||
|
||||
HB_BOOL fDispTrans;
|
||||
PHB_CODEPAGE cdpTerm;
|
||||
@@ -185,14 +185,14 @@ static void hb_gt_std_setKeyTrans( PHB_GTSTD pGTSTD, PHB_CODEPAGE cdpTerm, PHB_C
|
||||
hb_cdpTranslateChar( i, HB_FALSE, cdpTerm, cdpHost );
|
||||
}
|
||||
|
||||
static void hb_gt_std_termOut( PHB_GTSTD pGTSTD, const char * szStr, HB_SIZE ulLen )
|
||||
static void hb_gt_std_termOut( PHB_GTSTD pGTSTD, const char * szStr, HB_SIZE nLen )
|
||||
{
|
||||
hb_fsWriteLarge( pGTSTD->hStdout, szStr, ulLen );
|
||||
hb_fsWriteLarge( pGTSTD->hStdout, szStr, nLen );
|
||||
}
|
||||
|
||||
static void hb_gt_std_newLine( PHB_GTSTD pGTSTD )
|
||||
{
|
||||
hb_gt_std_termOut( pGTSTD, pGTSTD->szCrLf, pGTSTD->ulCrLf );
|
||||
hb_gt_std_termOut( pGTSTD, pGTSTD->szCrLf, pGTSTD->nCrLf );
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ static void hb_gt_std_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
|
||||
hb_gt_std_setKeyTrans( pGTSTD, NULL, NULL );
|
||||
|
||||
pGTSTD->szCrLf = hb_strdup( hb_conNewLine() );
|
||||
pGTSTD->ulCrLf = strlen( pGTSTD->szCrLf );
|
||||
pGTSTD->nCrLf = strlen( pGTSTD->szCrLf );
|
||||
|
||||
hb_fsSetDevMode( pGTSTD->hStdout, FD_BINARY );
|
||||
HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
|
||||
@@ -317,7 +317,7 @@ static void hb_gt_std_Exit( PHB_GT pGT )
|
||||
#endif
|
||||
if( pGTSTD->iLineBufSize > 0 )
|
||||
hb_xfree( pGTSTD->sLineBuf );
|
||||
if( pGTSTD->ulTransBufSize > 0 )
|
||||
if( pGTSTD->nTransBufSize > 0 )
|
||||
hb_xfree( pGTSTD->sTransBuf );
|
||||
if( pGTSTD->szCrLf )
|
||||
hb_xfree( pGTSTD->szCrLf );
|
||||
@@ -587,12 +587,12 @@ static void hb_gt_std_DispLine( PHB_GT pGT, int iRow )
|
||||
hb_gt_std_newLine( pGTSTD );
|
||||
if( iMin > 0 )
|
||||
{
|
||||
HB_SIZE ulLen = iMin;
|
||||
const char * buffer = hb_cdpnDup3( pGTSTD->sLineBuf, ulLen,
|
||||
pGTSTD->sTransBuf, &ulLen,
|
||||
&pGTSTD->sTransBuf, &pGTSTD->ulTransBufSize,
|
||||
HB_SIZE nLen = iMin;
|
||||
const char * buffer = hb_cdpnDup3( pGTSTD->sLineBuf, nLen,
|
||||
pGTSTD->sTransBuf, &nLen,
|
||||
&pGTSTD->sTransBuf, &pGTSTD->nTransBufSize,
|
||||
pGTSTD->cdpHost, pGTSTD->cdpTerm );
|
||||
hb_gt_std_termOut( pGTSTD, buffer, ulLen );
|
||||
hb_gt_std_termOut( pGTSTD, buffer, nLen );
|
||||
}
|
||||
pGTSTD->iLastCol = pGTSTD->iCol = iMin;
|
||||
pGTSTD->iRow = iRow;
|
||||
@@ -695,12 +695,12 @@ static void hb_gt_std_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
|
||||
{
|
||||
if( pGTSTD->fDispTrans )
|
||||
{
|
||||
HB_SIZE ulLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( pGTSTD->sLineBuf, ulLen,
|
||||
pGTSTD->sTransBuf, &ulLen,
|
||||
&pGTSTD->sTransBuf, &pGTSTD->ulTransBufSize,
|
||||
HB_SIZE nLen = iLen;
|
||||
const char * buffer = hb_cdpnDup3( pGTSTD->sLineBuf, nLen,
|
||||
pGTSTD->sTransBuf, &nLen,
|
||||
&pGTSTD->sTransBuf, &pGTSTD->nTransBufSize,
|
||||
pGTSTD->cdpHost, pGTSTD->cdpTerm );
|
||||
hb_gt_std_termOut( pGTSTD, buffer, ulLen );
|
||||
hb_gt_std_termOut( pGTSTD, buffer, nLen );
|
||||
}
|
||||
else
|
||||
hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, iLen );
|
||||
|
||||
@@ -157,7 +157,7 @@ static int s_iUpdtBottom;
|
||||
static int s_iUpdtLeft;
|
||||
static int s_iUpdtRight;
|
||||
static CHAR_INFO * s_pCharInfoScreen = NULL;
|
||||
static HB_SIZE s_ulScreenBuffSize = 0;
|
||||
static HB_SIZE s_nScreenBuffSize = 0;
|
||||
|
||||
static HB_FHANDLE s_hStdIn, s_hStdOut, s_hStdErr;
|
||||
|
||||
@@ -631,17 +631,17 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT )
|
||||
{
|
||||
COORD coDest;
|
||||
SMALL_RECT srWin;
|
||||
HB_SIZE ulSize = ( HB_SIZE ) _GetScreenWidth() * _GetScreenHeight() *
|
||||
sizeof( CHAR_INFO );
|
||||
HB_SIZE nSize = ( HB_SIZE ) _GetScreenWidth() * _GetScreenHeight() *
|
||||
sizeof( CHAR_INFO );
|
||||
|
||||
HB_GTSELF_RESIZE( pGT, _GetScreenHeight(), _GetScreenWidth() );
|
||||
|
||||
if( s_pCharInfoScreen == NULL || ulSize != s_ulScreenBuffSize )
|
||||
if( s_pCharInfoScreen == NULL || nSize != s_nScreenBuffSize )
|
||||
{
|
||||
if( s_pCharInfoScreen )
|
||||
hb_xfree( s_pCharInfoScreen );
|
||||
s_ulScreenBuffSize = ulSize;
|
||||
s_pCharInfoScreen = ( CHAR_INFO * ) hb_xgrab( s_ulScreenBuffSize );
|
||||
s_nScreenBuffSize = nSize;
|
||||
s_pCharInfoScreen = ( CHAR_INFO * ) hb_xgrab( s_nScreenBuffSize );
|
||||
}
|
||||
|
||||
s_iCurRow = s_csbi.dwCursorPosition.Y;
|
||||
@@ -685,7 +685,7 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT )
|
||||
else if( s_pCharInfoScreen )
|
||||
{
|
||||
hb_xfree( s_pCharInfoScreen );
|
||||
s_ulScreenBuffSize = 0;
|
||||
s_nScreenBuffSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1009,7 +1009,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L
|
||||
RedrawWindow( pWVT->hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW );
|
||||
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
int irow, icol, j, top, left, bottom, right;
|
||||
char * sBuffer;
|
||||
RECT rect = { 0, 0, 0, 0 };
|
||||
@@ -1027,8 +1027,8 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L
|
||||
right = colrowRC.right;
|
||||
bottom = colrowRC.bottom;
|
||||
|
||||
ulSize = ( ( bottom - top + 1 ) * ( right - left + 1 + 2 ) );
|
||||
sBuffer = ( char * ) hb_xgrab( ulSize + 1 );
|
||||
nSize = ( ( bottom - top + 1 ) * ( right - left + 1 + 2 ) );
|
||||
sBuffer = ( char * ) hb_xgrab( nSize + 1 );
|
||||
|
||||
for( j = 0, irow = top; irow <= bottom; irow++ )
|
||||
{
|
||||
|
||||
@@ -1162,14 +1162,14 @@ void hb_xexit( void ) /* Deinitialize fixed memory subsystem */
|
||||
|
||||
for( ui = 1, pMemBlock = s_pFirstBlock; pMemBlock; pMemBlock = pMemBlock->pNextBlock, ++ui )
|
||||
{
|
||||
HB_TRACE( HB_TR_ERROR, ( "Block %i (size %lu) %s(%i), \"%s\"", ui,
|
||||
HB_TRACE( HB_TR_ERROR, ( "Block %i (size %" HB_PFS "u) %s(%i), \"%s\"", ui,
|
||||
pMemBlock->nSize, pMemBlock->szProcName, pMemBlock->uiProcLine,
|
||||
hb_mem2str( membuffer, ( char * ) HB_MEM_PTR( pMemBlock ),
|
||||
HB_MIN( pMemBlock->nSize, HB_MAX_MEM2STR_BLOCK ) ) ) );
|
||||
|
||||
if( hLog )
|
||||
{
|
||||
fprintf( hLog, HB_I_("Block %i %p (size %lu) %s(%i), \"%s\"\n"), ui,
|
||||
fprintf( hLog, HB_I_("Block %i %p (size %" HB_PFS "u) %s(%i), \"%s\"\n"), ui,
|
||||
( char * ) HB_MEM_PTR( pMemBlock ),
|
||||
pMemBlock->nSize, pMemBlock->szProcName, pMemBlock->uiProcLine,
|
||||
hb_mem2str( membuffer, ( char * ) HB_MEM_PTR( pMemBlock ),
|
||||
|
||||
Reference in New Issue
Block a user