2012-10-18 00:18 UTC+0200 Viktor Szakats (harbour syenar.net)

* src/compiler/complex.c
    ! added missing HB_SIZE case

  * src/rdd/dbffpt/dbffpt1.c
  * src/rdd/dbfnsx/dbfnsx1.c
  * src/rdd/dbfntx/dbfntx1.c
    * suppressed remaining MSVC 32 and 64 bit warnings
      (a very long time TODO). I used casts named after
      the type it casts to, so they are easy to identify:
      HB_ULONGCAST, HB_[U]SHORTCAST, HB_INTCAST
      So they can be searched for or converted to proper
      types in the future.
      This is the complete list of MSVC warnings that remain
      after this:
      ---
         harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data
         harbour.y(1371) : warning C4309: 'argument' : truncation of constant value
         harbour.y(1374) : warning C4309: 'argument' : truncation of constant value
         harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
         harboury.c(7737) : warning C4702: unreachable code
         harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used
         macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels
         macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
         macroy.c(3254) : warning C4702: unreachable code
         macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used
         ../../../dbffpt1.c(521) : warning C4310: cast truncates constant value
         ../../../dbffpt1.c(904) : warning C4310: cast truncates constant value
         hbzebra\datamtrx.c(149) : warning C4310: cast truncates constant value
      ---
This commit is contained in:
Viktor Szakats
2012-10-17 22:19:26 +00:00
parent 44c6d42f30
commit 7ccebe3915
5 changed files with 126 additions and 85 deletions

View File

@@ -16,6 +16,37 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-18 00:18 UTC+0200 Viktor Szakats (harbour syenar.net)
* src/compiler/complex.c
! added missing HB_SIZE case
* src/rdd/dbffpt/dbffpt1.c
* src/rdd/dbfnsx/dbfnsx1.c
* src/rdd/dbfntx/dbfntx1.c
* suppressed remaining MSVC 32 and 64 bit warnings
(a very long time TODO). I used casts named after
the type it casts to, so they are easy to identify:
HB_ULONGCAST, HB_[U]SHORTCAST, HB_INTCAST
So they can be searched for or converted to proper
types in the future.
This is the complete list of MSVC warnings that remain
after this:
---
harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data
harbour.y(1371) : warning C4309: 'argument' : truncation of constant value
harbour.y(1374) : warning C4309: 'argument' : truncation of constant value
harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
harboury.c(7737) : warning C4702: unreachable code
harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used
macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels
macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
macroy.c(3254) : warning C4702: unreachable code
macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used
../../../dbffpt1.c(521) : warning C4310: cast truncates constant value
../../../dbffpt1.c(904) : warning C4310: cast truncates constant value
hbzebra\datamtrx.c(149) : warning C4310: cast truncates constant value
---
2012-10-17 22:04 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/hbnf.hbp
* contrib/hbnf/readme.txt

View File

@@ -273,7 +273,7 @@ static const char * hb_comp_tokenIdentifer( HB_COMP_DECL, PHB_PP_TOKEN pToken )
static const char * hb_comp_tokenString( YYSTYPE *yylval_ptr, HB_COMP_DECL, PHB_PP_TOKEN pToken )
{
yylval_ptr->valChar.length = pToken->len;
yylval_ptr->valChar.length = ( HB_SIZE ) pToken->len;
yylval_ptr->valChar.string = ( char * ) pToken->value;
yylval_ptr->valChar.dealloc = HB_FALSE;
if( HB_PP_TOKEN_ALLOC( pToken->type ) )

View File

@@ -90,6 +90,9 @@
#define FPT_BLOCK_OFFSET( b ) ( ( HB_FOFFSET ) ( b ) * \
( HB_FOFFSET ) pArea->ulMemoBlockSize )
/* temporary cast to suppress 32/64-bit Windows warnings */
#define HB_ULONGCAST HB_ULONG
static HB_USHORT s_uiRddIdBLOB = ( HB_USHORT ) -1;
static HB_USHORT s_uiRddIdFPT = ( HB_USHORT ) -1;
@@ -1010,7 +1013,7 @@ static HB_ULONG hb_fptGetMemoLen( FPTAREAP pArea, HB_USHORT uiIndex )
u = 0;
while( u < ulLen && pBlock[ u ] != 0x1A )
u++;
ulSize += u;
ulSize += ( HB_ULONGCAST ) u;
} while( u == DBT_DEFBLOCKSIZE );
}
else if( hb_fileReadAt( pArea->pMemoFile, &fptBlock,
@@ -1141,7 +1144,7 @@ static HB_ULONG hb_fptCountSMTItemLength( FPTAREAP pArea, PHB_ITEM pItem,
case HB_IT_ARRAY: /* HB_IT_OBJECT == HB_IT_ARRAY */
(*pulArrayCount)++;
ulSize = 3;
ulLen = hb_arrayLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_arrayLen( pItem );
if( ulLen > 0xFFFF )
ulLen = 0xFFFF;
for( u = 1; u <= ulLen; u++ )
@@ -1151,17 +1154,17 @@ static HB_ULONG hb_fptCountSMTItemLength( FPTAREAP pArea, PHB_ITEM pItem,
break;
case HB_IT_MEMO:
case HB_IT_STRING:
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF ) * sizeof( HB_WCHAR );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF ) * sizeof( HB_WCHAR );
}
else
{
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( iTrans == FPT_TRANS_CP && ulLen > 0 )
{
ulLen = hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, 0xFFFF,
hb_vmCDP(), pArea->area.cdPage );
ulLen = ( HB_ULONGCAST ) hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, 0xFFFF,
hb_vmCDP(), pArea->area.cdPage );
}
else
{
@@ -1271,7 +1274,7 @@ static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufP
{
case HB_IT_ARRAY:
*(*bBufPtr)++ = SMT_IT_ARRAY;
ulLen = hb_arrayLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_arrayLen( pItem );
if( ulLen > 0xFFFF )
ulLen = 0xFFFF;
HB_PUT_LE_UINT16( *bBufPtr, ulLen );
@@ -1286,16 +1289,16 @@ static void hb_fptStoreSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBufP
case HB_IT_STRING:
case HB_IT_MEMO:
*(*bBufPtr)++ = SMT_IT_CHAR;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF );
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + 2, ulLen );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + 2, ulLen );
ulLen *= sizeof( HB_WCHAR );
}
else
{
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( ulLen > 0 )
{
u = 0xFFFF;
@@ -1405,7 +1408,7 @@ static HB_ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem, HB_FOFFS
return EDBF_READ;
}
*pfOffset += ulLen;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
hb_itemPutStrLenU16( pItem, HB_CDP_ENDIAN_LITTLE,
( const HB_WCHAR * ) pBuffer, ulLen >> 1 );
@@ -1612,7 +1615,7 @@ static HB_ULONG hb_fptCountSixItemLength( FPTAREAP pArea, PHB_ITEM pItem,
case HB_IT_ARRAY: /* HB_IT_OBJECT == HB_IT_ARRAY */
(*pulArrayCount)++;
ulSize = SIX_ITEM_BUFSIZE;
ulLen = hb_arrayLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_arrayLen( pItem );
if( pArea->uiMemoVersion == DB_MEMOVER_SIX )
{
/* only 2 bytes (HB_SHORT) for SIX compatibility */
@@ -1628,17 +1631,17 @@ static HB_ULONG hb_fptCountSixItemLength( FPTAREAP pArea, PHB_ITEM pItem,
ulSize = SIX_ITEM_BUFSIZE;
/* only 2 bytes (HB_SHORT) for SIX compatibility */
u = pArea->uiMemoVersion == DB_MEMOVER_SIX ? 0xFFFF : ULONG_MAX;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u ) * sizeof( HB_WCHAR );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u ) * sizeof( HB_WCHAR );
}
else
{
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( iTrans == FPT_TRANS_CP && ulLen > 0 )
{
ulLen = hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, u,
hb_vmCDP(), pArea->area.cdPage );
ulLen = ( HB_ULONGCAST ) hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, u,
hb_vmCDP(), pArea->area.cdPage );
}
else
{
@@ -1677,7 +1680,7 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b
{
case HB_IT_ARRAY: /* HB_IT_OBJECT == HB_IT_ARRAY */
HB_PUT_LE_UINT16( &(*bBufPtr)[0], FPTIT_SIX_ARRAY );
ulLen = hb_arrayLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_arrayLen( pItem );
if( pArea->uiMemoVersion == DB_MEMOVER_SIX )
{
/* only 2 bytes (HB_SHORT) for SIX compatibility */
@@ -1742,16 +1745,16 @@ static HB_ULONG hb_fptStoreSixItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** b
HB_PUT_LE_UINT16( &(*bBufPtr)[0], FPTIT_SIX_CHAR );
/* only 2 bytes (HB_SHORT) for SIX compatibility */
u = pArea->uiMemoVersion == DB_MEMOVER_SIX ? 0xFFFF : ULONG_MAX;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u );
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + SIX_ITEM_BUFSIZE, ulLen );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + SIX_ITEM_BUFSIZE, ulLen );
ulLen *= sizeof( HB_WCHAR );
}
else
{
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( ulLen > 0 )
{
if( iTrans == FPT_TRANS_CP )
@@ -1825,7 +1828,7 @@ static HB_ERRCODE hb_fptReadSixItem( FPTAREAP pArea, HB_BYTE ** pbMemoBuf, HB_BY
{
char * pszStr = ( char * ) ( *pbMemoBuf );
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
hb_itemPutStrLenU16( pItem, HB_CDP_ENDIAN_LITTLE,
( const HB_WCHAR * ) pszStr, ulLen >> 1 );
@@ -1913,17 +1916,17 @@ static HB_ULONG hb_fptCountFlexItemLength( FPTAREAP pArea, PHB_ITEM pItem,
break;
case HB_IT_MEMO:
case HB_IT_STRING:
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF ) * sizeof( HB_WCHAR );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0xFFFF ) * sizeof( HB_WCHAR );
}
else
{
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( iTrans == FPT_TRANS_CP && ulLen > 0 )
{
ulLen = hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, 0xFFFF,
hb_vmCDP(), pArea->area.cdPage );
ulLen = ( HB_ULONGCAST ) hb_cdpnDup2Len( hb_itemGetCPtr( pItem ), ulLen, 0xFFFF,
hb_vmCDP(), pArea->area.cdPage );
}
else
{
@@ -1977,7 +1980,7 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBuf
break;
case HB_IT_MEMO:
case HB_IT_STRING:
ulLen = hb_itemGetCLen( pItem );
ulLen = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
if( ulLen == 0 )
{
*(*bBufPtr)++ = FPTIT_FLEXAR_NUL;
@@ -1986,11 +1989,11 @@ static void hb_fptStoreFlexItem( FPTAREAP pArea, PHB_ITEM pItem, HB_BYTE ** bBuf
{
*(*bBufPtr)++ = FPTIT_FLEXAR_STR;
u = 0xFFFF;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u );
ulLen = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + 2, ulLen );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, u );
ulLen = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE,
( HB_WCHAR * ) *bBufPtr + 2, ulLen );
ulLen *= sizeof( HB_WCHAR );
}
else if( iTrans == FPT_TRANS_CP )
@@ -2488,7 +2491,7 @@ static HB_ERRCODE hb_fptCopyToRawFile( PHB_FILE pSrc, HB_FOFFSET from,
do
{
ulRead = hb_fileReadAt( pSrc, pBuffer, ( HB_ULONG )
ulRead = ( HB_ULONGCAST ) hb_fileReadAt( pSrc, pBuffer, ( HB_ULONG )
HB_MIN( ( HB_FOFFSET ) ulBufSize, size - written ),
from + written );
if( ulRead == 0 )
@@ -2522,7 +2525,7 @@ static HB_ERRCODE hb_fptCopyToFile( PHB_FILE pSrc, HB_FOFFSET from,
do
{
ulRead = hb_fileReadAt( pSrc, pBuffer, ( HB_ULONG )
ulRead = ( HB_ULONGCAST ) hb_fileReadAt( pSrc, pBuffer, ( HB_ULONG )
HB_MIN( ( HB_FOFFSET ) ulBufSize, size - written ),
from + written );
if( ulRead == 0 )
@@ -2917,7 +2920,7 @@ static HB_ERRCODE hb_fptGetMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
* Write memo data.
*/
static HB_ERRCODE hb_fptWriteMemo( FPTAREAP pArea, HB_ULONG ulBlock, HB_ULONG ulSize,
const HB_BYTE *bBufPtr, HB_FHANDLE hFile,
const HB_BYTE * bBufPtr, HB_FHANDLE hFile,
HB_ULONG ulType, HB_ULONG ulLen, HB_ULONG * pulStoredBlock )
{
MEMOGCTABLE fptGCtable;
@@ -2991,8 +2994,8 @@ static HB_ERRCODE hb_fptWriteMemo( FPTAREAP pArea, HB_ULONG ulBlock, HB_ULONG ul
do
{
ulRead = hb_fsReadLarge( hFile, bBuffer,
HB_MIN( ulBufSize, ulLen - ulWritten ) );
ulRead = ( HB_ULONGCAST ) hb_fsReadLarge( hFile, bBuffer,
HB_MIN( ulBufSize, ulLen - ulWritten ) );
if( ulRead == 0 )
errCode = EDBF_READ;
else if( hb_fileWriteAt( pArea->pMemoFile, bBuffer,
@@ -3069,9 +3072,9 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
if( HB_IS_STRING( pItem ) )
{
ulType = FPTIT_TEXT;
if( iTrans == FPT_TRANS_UNICODE )
if( iTrans == FPT_TRANS_UNICODE )
{
ulSize = hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0 ) * sizeof( HB_WCHAR );
ulSize = ( HB_ULONGCAST ) hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, NULL, 0 ) * sizeof( HB_WCHAR );
if( ulSize > 0 )
{
bBufPtr = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize );
@@ -3081,7 +3084,7 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt
}
else
{
ulSize = hb_itemGetCLen( pItem );
ulSize = ( HB_ULONGCAST ) hb_itemGetCLen( pItem );
bBufPtr = ( const HB_BYTE * ) hb_itemGetCPtr( pItem );
if( iTrans == FPT_TRANS_CP && ulSize > 0 )
{

View File

@@ -75,6 +75,9 @@
static RDDFUNCS nsxSuper;
static HB_USHORT s_uiRddId;
/* temporary casts to suppress 32/64-bit Windows warnings */
#define HB_USHORTCAST HB_USHORT
#define HB_INTCAST int
#define hb_nsxKeyFree(K) hb_xfree(K)
#define hb_nsxFileOffset(I,B) ( (B) << ( (I)->LargeFile ? NSX_PAGELEN_BITS : 0 ) )
@@ -2641,7 +2644,7 @@ static HB_BOOL hb_nsxTagNextKey( LPTAGINFO pTag )
break;
}
}
pTag->stackLevel = iLevel + 1;
pTag->stackLevel = ( HB_USHORTCAST ) iLevel + 1;
}
fFound = hb_nsxTagGetCurKey( pTag, pPage,
pTag->stack[ pTag->stackLevel - 1 ].ikey );
@@ -2701,7 +2704,7 @@ static HB_BOOL hb_nsxTagPrevKey( LPTAGINFO pTag )
if( pTag->stack[ iLevel ].ikey )
break;
}
pTag->stackLevel = iLevel + 1;
pTag->stackLevel = ( HB_USHORTCAST ) iLevel + 1;
}
fFound = hb_nsxTagGetCurKey( pTag, pPage,
@@ -2846,7 +2849,7 @@ static HB_BOOL hb_nsxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, HB_USHORT uiLen
iKey = hb_nsxPageKeyFind( pTag, pPage, pKey->val, uiLen, pKey->mode,
fLast, ulRecNo, &fStop );
hb_nsxTagSetPageStack( pTag, pPage, iKey );
hb_nsxTagSetPageStack( pTag, pPage, ( HB_USHORTCAST ) iKey );
if( ( fStop && ulRecNo ) || hb_nsxIsLeaf( pPage ) )
break;
@@ -2855,7 +2858,7 @@ static HB_BOOL hb_nsxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, HB_USHORT uiLen
hb_nsxPageRelease( pTag, pPage );
}
fOut = !hb_nsxTagGetCurKey( pTag, pPage, iKey );
fOut = !hb_nsxTagGetCurKey( pTag, pPage, ( HB_USHORTCAST ) iKey );
hb_nsxPageRelease( pTag, pPage );
if( fOut )
return HB_FALSE;
@@ -3146,13 +3149,13 @@ static HB_BOOL hb_nsxTagInsertKey( LPTAGINFO pTag, LPPAGEINFO pPage,
iKey = pTag->stack[ iLevel ].ikey;
if( pPage->uiKeys < pTag->MaxKeys )
{
hb_nsxPageKeyAdd( pTag, pPage, iKey, pNewKey );
hb_nsxPageKeyAdd( pTag, pPage, ( HB_USHORTCAST ) iKey, pNewKey );
hb_nsxKeyFree( pNewKey );
pNewKey = NULL;
}
else
{
pNewKey = hb_nsxPageSplit( pTag, pPage, pNewKey, iKey );
pNewKey = hb_nsxPageSplit( pTag, pPage, pNewKey, ( HB_USHORTCAST ) iKey );
}
}
@@ -3333,7 +3336,7 @@ static HB_BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey )
}
iLevel = pTag->stackLevel - 1;
iKey = pTag->stack[ iLevel ].ikey; /* iKey = 0 */
if( !hb_nsxPageGetLeafKey( pTag, pPage, iKey,
if( !hb_nsxPageGetLeafKey( pTag, pPage, ( HB_USHORTCAST ) iKey,
hb_nsxGetKeyVal( pBasePage, pTag->KeyLength, iBaseKey ),
&ulRecNo ) )
{
@@ -3357,7 +3360,7 @@ static HB_BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey )
if( pPage->uiKeys > 1 )
{
hb_nsxPageLeafKeyDel( pTag, pPage, iKey );
hb_nsxPageLeafKeyDel( pTag, pPage, ( HB_USHORTCAST ) iKey );
#ifdef HB_NSX_DEBUG
hb_nsxPageCheckKeys( pPage, pTag, iKey, 62 );
#endif
@@ -3410,8 +3413,8 @@ static HB_BOOL hb_nsxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey )
( pPage->uiKeys - iKey ) );
}
pPage->Changed = HB_TRUE;
pTag->stackLevel = iLevel;
hb_nsxTagSetPageStack( pTag, pPage, iKey );
pTag->stackLevel = ( HB_USHORTCAST ) iLevel;
hb_nsxTagSetPageStack( pTag, pPage, ( HB_USHORTCAST ) iKey );
hb_nsxPageRelease( pTag, pPage );
if( pKeyPrev )
{
@@ -3656,7 +3659,7 @@ static void hb_nsxTagGoToRelKeyPos( LPTAGINFO pTag, double dPos )
else if( dPos >= 1.0 )
dPos = 1.0;
}
hb_nsxTagSetPageStack( pTag, pPage, iKey );
hb_nsxTagSetPageStack( pTag, pPage, ( HB_USHORTCAST ) iKey );
if( hb_nsxIsLeaf( pPage ) )
break;
ulPage = iKey == 0 ? hb_nsxGetLowerPage( pPage ) :
@@ -3664,7 +3667,7 @@ static void hb_nsxTagGoToRelKeyPos( LPTAGINFO pTag, double dPos )
hb_nsxPageRelease( pTag, pPage );
}
hb_nsxTagGetCurKey( pTag, pPage, iKey );
hb_nsxTagGetCurKey( pTag, pPage, ( HB_USHORTCAST ) iKey );
hb_nsxPageRelease( pTag, pPage );
/* reposition for branch keys */
@@ -4205,8 +4208,8 @@ static HB_BOOL hb_nsxOrdKeyGoto( LPTAGINFO pTag, HB_ULONG ulKeyNo )
--iLevel;
else if( fFirst || --ulKeyNo )
{
pTag->stackLevel = iLevel;
hb_nsxTagSetPageStack( pTag, pPage, iKey );
pTag->stackLevel = ( HB_USHORTCAST ) iLevel;
hb_nsxTagSetPageStack( pTag, pPage, ( HB_USHORTCAST ) iKey );
ulPage = iKey == 0 ? hb_nsxGetLowerPage( pPage ) :
hb_nsxGetKeyPage( pPage, pTag->KeyLength, iKey - 1 );
hb_nsxPageRelease( pTag, pPage );
@@ -4227,8 +4230,8 @@ static HB_BOOL hb_nsxOrdKeyGoto( LPTAGINFO pTag, HB_ULONG ulKeyNo )
--iLevel;
else
{
pTag->stackLevel = iLevel;
hb_nsxTagSetPageStack( pTag, pPage, iKey + 1 );
pTag->stackLevel = ( HB_USHORTCAST ) iLevel;
hb_nsxTagSetPageStack( pTag, pPage, ( HB_USHORTCAST ) ( iKey + 1 ) );
if( --ulKeyNo )
{
ulPage = hb_nsxGetKeyPage( pPage, pTag->KeyLength, iKey );
@@ -4256,7 +4259,7 @@ static HB_BOOL hb_nsxOrdKeyGoto( LPTAGINFO pTag, HB_ULONG ulKeyNo )
}
}
}
pTag->stackLevel = iLevel + 1;
pTag->stackLevel = ( HB_USHORTCAST ) ( iLevel + 1 );
if( ulKeyNo == 0 )
{
if( !hb_nsxTagGetCurKey( pTag, pPage, pTag->stack[ iLevel ].ikey ) )
@@ -4658,7 +4661,7 @@ static HB_BOOL hb_nsxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi
pKey->rec = pArea->lpCurTag->fUsrDescend ? NSX_MAX_REC_NUM :
NSX_IGNORE_REC_NUM;
pKey->mode = NSX_CMP_PREFIX;
if( !hb_nsxTagKeyFind( pTag, pKey, iFixed ) )
if( !hb_nsxTagKeyFind( pTag, pKey, ( HB_USHORTCAST ) iFixed ) )
{
if( fForward )
pTag->TagEOF = HB_TRUE;
@@ -5956,7 +5959,7 @@ static HB_ERRCODE hb_nsxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex )
case HB_IT_STRING | HB_IT_MEMO:
hb_nsxSortKeyAdd( pSort, pArea->dbfarea.ulRecNo,
hb_itemGetCPtr( pItem ),
hb_itemGetCLen( pItem ) );
( HB_INTCAST ) hb_itemGetCLen( pItem ) );
break;
case HB_IT_INTEGER:
@@ -6715,7 +6718,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI
iLen = 1;
break;
case 'C':
iLen = hb_itemGetCLen( pResult );
iLen = ( HB_INTCAST ) hb_itemGetCLen( pResult );
if( iLen > NSX_MAXKEYLEN )
iLen = NSX_MAXKEYLEN;
bTrail = ' ';

View File

@@ -155,6 +155,10 @@
static RDDFUNCS ntxSuper;
static HB_USHORT s_uiRddId;
/* temporary casts to suppress 32/64-bit Windows warnings */
#define HB_SHORTCAST HB_SHORT
#define HB_USHORTCAST HB_USHORT
#define HB_INTCAST int
#define hb_ntxKeyFree(K) hb_xfree(K)
#define hb_ntxFileOffset(I,B) ( (B) << ( (I)->LargeFile ? NTXBLOCKBITS : 0 ) )
@@ -2413,7 +2417,7 @@ static HB_BOOL hb_ntxTagNextKey( LPTAGINFO pTag )
hb_ntxPageRelease( pTag, pPage );
return HB_FALSE;
}
pTag->stackLevel = iLevel + 1;
pTag->stackLevel = ( HB_USHORTCAST ) ( iLevel + 1 );
}
hb_ntxPageGetKey( pPage, pTag->stack[ pTag->stackLevel - 1 ].ikey,
pTag->CurKeyInfo, pTag->KeyLength );
@@ -2468,7 +2472,7 @@ static HB_BOOL hb_ntxTagPrevKey( LPTAGINFO pTag )
hb_ntxPageRelease( pTag, pPage );
return HB_FALSE;
}
pTag->stackLevel = iLevel + 1;
pTag->stackLevel = ( HB_USHORTCAST ) ( iLevel + 1 );
}
hb_ntxPageGetKey( pPage, pTag->stack[ pTag->stackLevel - 1 ].ikey,
pTag->CurKeyInfo, pTag->KeyLength );
@@ -2482,7 +2486,7 @@ static HB_BOOL hb_ntxTagPrevKey( LPTAGINFO pTag )
* find a key value in page
*/
static int hb_ntxPageKeyFind( LPTAGINFO pTag, LPPAGEINFO pPage,
char* key, HB_SHORT keylen, HB_BOOL fNext,
char * key, HB_SHORT keylen, HB_BOOL fNext,
HB_ULONG ulRecNo, HB_BOOL *fStop )
{
HB_SHORT iLast = -1, iBegin = 0, iEnd = pPage->uiKeys - 1, k, i;
@@ -2491,7 +2495,7 @@ static int hb_ntxPageKeyFind( LPTAGINFO pTag, LPPAGEINFO pPage,
while( iBegin <= iEnd )
{
i = ( iBegin + iEnd ) >> 1;
k = hb_ntxValCompare( pTag, key, keylen, hb_ntxGetKeyVal( pPage, i ),
k = ( HB_SHORTCAST ) hb_ntxValCompare( pTag, key, keylen, hb_ntxGetKeyVal( pPage, i ),
pTag->KeyLength, HB_FALSE );
if( k == 0 )
{
@@ -2574,7 +2578,7 @@ static HB_BOOL hb_ntxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, HB_USHORT uiLen
if( ! pPage )
return HB_FALSE;
iKey = hb_ntxPageKeyFind( pTag, pPage, pKey->key, uiLen, fNext, ulRecNo, &fStop );
hb_ntxTagSetPageStack( pTag, pPage->Page, iKey );
hb_ntxTagSetPageStack( pTag, pPage->Page, ( HB_USHORTCAST ) iKey );
if( fStop && ulRecNo && pTag->fSortRec )
break;
ulPage = hb_ntxGetKeyPage( pPage, iKey );
@@ -2583,10 +2587,10 @@ static HB_BOOL hb_ntxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, HB_USHORT uiLen
if( ulRecNo && !pTag->fSortRec ) /* small hack - should speedup in some cases */
{
if( hb_ntxPageFindRecNo( pPage, &iKey, ulRecNo ) )
pTag->stack[ pTag->stackLevel - 1 ].ikey = iKey;
pTag->stack[ pTag->stackLevel - 1 ].ikey = ( HB_SHORTCAST ) iKey;
}
hb_ntxPageGetKey( pPage, iKey, pTag->CurKeyInfo, pTag->KeyLength );
hb_ntxPageGetKey( pPage, ( HB_USHORTCAST ) iKey, pTag->CurKeyInfo, pTag->KeyLength );
hb_ntxPageRelease( pTag, pPage );
if( ulRecNo )
@@ -2849,7 +2853,7 @@ static void hb_ntxBalancePages( LPTAGINFO pTag, LPPAGEINFO pBasePage, HB_USHORT
hb_ntxGetKeyVal( pLast, i ), pTag->KeyLength );
hb_ntxSetKeyPage( pFirst, pFirst->uiKeys, hb_ntxGetKeyPage( pLast, i ) );
i++;
pLast->uiKeys -= i;
pLast->uiKeys -= ( HB_USHORTCAST ) i;
/* TODO?: update to keep last key pointer fixed */
for( j = 0; j <= pLast->uiKeys; j++ )
{
@@ -2878,7 +2882,7 @@ static void hb_ntxBalancePages( LPTAGINFO pTag, LPPAGEINFO pBasePage, HB_USHORT
memcpy( hb_ntxGetKeyPtr( pLast, i ),
hb_ntxGetKeyPtr( pFirst, pFirst->uiKeys ), uiLen );
}
pLast->uiKeys -= iMove;
pLast->uiKeys -= ( HB_USHORTCAST ) iMove;
pFirst->uiKeys--;
hb_ntxSetKeyRec( pBasePage, uiPos, hb_ntxGetKeyRec( pFirst, pFirst->uiKeys ) );
memcpy( hb_ntxGetKeyVal( pBasePage, uiPos ),
@@ -2964,7 +2968,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey )
iKey = pTag->stack[ iLevel ].ikey;
if( pPage->uiKeys < pTag->MaxKeys )
{
hb_ntxPageKeyAdd( pTag, pPage, iKey, pKey->Tag, pKey->Xtra, pKey->key );
hb_ntxPageKeyAdd( pTag, pPage, ( HB_USHORTCAST ) iKey, pKey->Tag, pKey->Xtra, pKey->key );
pKey = NULL;
}
else
@@ -3004,7 +3008,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey )
hb_ntxKeyFree( pNewKey );
return HB_FALSE;
}
uiBaseKey = iKey;
uiBaseKey = ( HB_USHORTCAST ) iKey;
}
else
{
@@ -3018,7 +3022,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey )
hb_ntxKeyFree( pNewKey );
return HB_FALSE;
}
uiBaseKey = pFirst->uiKeys + iKey + 1;
uiBaseKey = pFirst->uiKeys + ( HB_USHORTCAST ) iKey + 1;
}
if( ( pFirst->uiKeys + pLast->uiKeys ) <= ( ( pTag->MaxKeys - 1 ) << 1 ) )
{
@@ -3039,7 +3043,7 @@ static HB_BOOL hb_ntxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey )
}
}
#endif
pKey = hb_ntxPageSplit( pTag, pPage, pKey, iKey );
pKey = hb_ntxPageSplit( pTag, pPage, pKey, ( HB_USHORTCAST ) iKey );
if( pNewKey )
hb_ntxKeyFree( pNewKey );
pNewKey = pKey;
@@ -3111,7 +3115,7 @@ static HB_BOOL hb_ntxTagKeyDel( LPTAGINFO pTag, LPKEYINFO pKey )
#endif
hb_ntxPageRelease( pTag, pBasePage );
}
hb_ntxPageKeyDel( pPage, iKey );
hb_ntxPageKeyDel( pPage, ( HB_USHORTCAST ) iKey );
while( iLevel > 0 )
{
@@ -3407,11 +3411,11 @@ static void hb_ntxTagGoToRelKeyPos( LPTAGINFO pTag, double dPos )
else if( dPos >= 1.0 )
dPos = 1.0;
}
hb_ntxTagSetPageStack( pTag, pPage->Page, iKey );
hb_ntxTagSetPageStack( pTag, pPage->Page, ( HB_USHORTCAST ) iKey );
ulPage = hb_ntxGetKeyPage( pPage, iKey );
} while( ulPage != 0 );
hb_ntxPageGetKey( pPage, iKey, pTag->CurKeyInfo, pTag->KeyLength );
hb_ntxPageGetKey( pPage, ( HB_USHORTCAST ) iKey, pTag->CurKeyInfo, pTag->KeyLength );
hb_ntxPageRelease( pTag, pPage );
if( dPos > 0.75 )
@@ -4273,7 +4277,7 @@ static HB_BOOL hb_ntxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi
pKey->Xtra = pArea->lpCurTag->fUsrDescend ==
pArea->lpCurTag->AscendKey ? NTX_MAX_REC_NUM :
NTX_IGNORE_REC_NUM;
if( !hb_ntxTagKeyFind( pTag, pKey, iFixed ) )
if( !hb_ntxTagKeyFind( pTag, pKey, ( HB_USHORTCAST ) iFixed ) )
{
if( fForward )
pTag->TagEOF = HB_TRUE;
@@ -5458,7 +5462,7 @@ static HB_ERRCODE hb_ntxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex )
case HB_IT_STRING | HB_IT_MEMO:
hb_ntxSortKeyAdd( pSort, pArea->dbfarea.ulRecNo,
hb_itemGetCPtr( pItem ),
hb_itemGetCLen( pItem ) );
( HB_INTCAST ) hb_itemGetCLen( pItem ) );
break;
case HB_IT_INTEGER:
@@ -6278,7 +6282,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI
iLen = 1;
break;
case 'C':
iLen = hb_itemGetCLen( pResult );
iLen = ( HB_INTCAST ) hb_itemGetCLen( pResult );
if( iLen > NTX_MAX_KEY )
iLen = NTX_MAX_KEY;
break;