2009-12-10 10:42 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/xhb/fparse.c
    * pacified BCC warning

  * harbour/src/rtl/base64c.c
  * harbour/src/rtl/diskspac.c
  * harbour/src/rtl/filesys.c
  * harbour/src/rtl/hbproces.c
  * harbour/src/rtl/gtos2/gtos2.c
  * harbour/src/rdd/dbffpt/dbffpt1.c
  * harbour/contrib/xhb/freadlin.c
  * harbour/contrib/xhb/txtline.c
  * harbour/contrib/hbbtree/hb_btree.c
  * harbour/contrib/rddsql/sqlbase.c
  * harbour/contrib/rddsql/sddodbc/odbcdd.c
    * pacified OpenWatcom C warnings

  * harbour/include/hbatomic.h
    % rewritten OpenWatcom atomic ASM macros.
      Now they precisely informs compiler about used and modified
      registered and also force passing arguments in strictly defined
      what simplify ASM code.
This commit is contained in:
Przemyslaw Czerpak
2009-12-10 09:42:34 +00:00
parent 48c8cf9c55
commit f674969aba
14 changed files with 74 additions and 55 deletions

View File

@@ -17,6 +17,29 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-10 10:42 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/xhb/fparse.c
* pacified BCC warning
* harbour/src/rtl/base64c.c
* harbour/src/rtl/diskspac.c
* harbour/src/rtl/filesys.c
* harbour/src/rtl/hbproces.c
* harbour/src/rtl/gtos2/gtos2.c
* harbour/src/rdd/dbffpt/dbffpt1.c
* harbour/contrib/xhb/freadlin.c
* harbour/contrib/xhb/txtline.c
* harbour/contrib/hbbtree/hb_btree.c
* harbour/contrib/rddsql/sqlbase.c
* harbour/contrib/rddsql/sddodbc/odbcdd.c
* pacified OpenWatcom C warnings
* harbour/include/hbatomic.h
% rewritten OpenWatcom atomic ASM macros.
Now they precisely informs compiler about used and modified
registered and also force passing arguments in strictly defined
what simplify ASM code.
2009-12-10 02:08 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/generator/hbqtgen.prg
% Changed to only save files which have indeed changed

View File

@@ -421,7 +421,7 @@ static void ioBufferAlloc( struct hb_BTree * pBTree, ULONG ulBuffers )
{
ioBuffer_T *thisptr = NULL, *last = NULL;
if ( ulBuffers <= 0 )
if ( ulBuffers == 0 )
ulBuffers = 1;
if ( ulBuffers > 1 || GETFLAG( pBTree, IsInMemory ) )

View File

@@ -672,7 +672,7 @@ static HB_ERRCODE odbcGoTo( SQLBASEAREAP pArea, ULONG ulRecNo )
pArea->pRowFlags[ pArea->ulRecCount ] = SQLDD_FLAG_CACHED;
}
if ( ulRecNo <= 0 || ulRecNo > pArea->ulRecCount )
if ( ulRecNo == 0 || ulRecNo > pArea->ulRecCount )
{
pArea->pRecord = pArea->pRow[ 0 ];
pArea->bRecordFlags = pArea->pRowFlags[ 0 ];

View File

@@ -188,7 +188,7 @@ static HB_ERRCODE sddClose( SQLBASEAREAP pArea )
static HB_ERRCODE sddGoTo( SQLBASEAREAP pArea, ULONG ulRecNo )
{
if ( ulRecNo <= 0 || ulRecNo > pArea->ulRecCount )
if ( ulRecNo == 0 || ulRecNo > pArea->ulRecCount )
{
pArea->pRecord = pArea->pRow[ 0 ];
pArea->bRecordFlags = pArea->pRowFlags[ 0 ];
@@ -786,7 +786,7 @@ static HB_ERRCODE sqlbaseOpen( SQLBASEAREAP pArea, LPDBOPENINFO pOpenInfo )
pArea->ulConnection = pOpenInfo->ulConnection ? pOpenInfo->ulConnection : s_ulConnectionCurrent;
if ( pArea->ulConnection <= 0 || pArea->ulConnection > s_ulConnectionCount ||
if ( pArea->ulConnection == 0 || pArea->ulConnection > s_ulConnectionCount ||
! s_pConnection[ pArea->ulConnection - 1 ].hConnection )
{
hb_errRT_SQLBASE( EG_OPEN, ESQLDD_NOTCONNECTED, "Not connected", NULL );

View File

@@ -669,7 +669,7 @@ HB_FUNC( FCHARCOUNT )
/*----------------------------------------------------------------------------*/
HB_FUNC( FPARSELINE )
{
PHB_ITEM pArray = NULL;
PHB_ITEM pArray;
int iWords = 0;
const char * szText;

View File

@@ -58,14 +58,14 @@
#define READING_BLOCK 4096
char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Term, int * iTermSizes, USHORT iTerms, BOOL * bFound, BOOL * bEOF )
char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Term, int * iTermSizes, int iTerms, BOOL * bFound, BOOL * bEOF )
{
USHORT uiPosTerm = 0, iPos, uiPosition;
USHORT nTries;
int iPosTerm = 0, iPos, iPosition;
int nTries;
LONG lRead = 0, lOffset, lSize;
char * pBuff;
HB_TRACE(HB_TR_DEBUG, ("hb_fsReadLine(%p, %ld, %p, %p, %hu, %i, %i)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, Term, iTermSizes, iTerms, *bFound, *bEOF ));
HB_TRACE(HB_TR_DEBUG, ("hb_fsReadLine(%p, %ld, %p, %p, %i, %i, %i)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, Term, iTermSizes, iTerms, *bFound, *bEOF ));
*bFound = FALSE;
*bEOF = FALSE;
@@ -97,16 +97,16 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te
{
for( iPos = 0; iPos < lRead; iPos++ )
{
for( uiPosTerm = 0; uiPosTerm < iTerms; uiPosTerm++ )
for( iPosTerm = 0; iPosTerm < iTerms; iPosTerm++ )
{
/* Compare with the LAST terminator byte */
if( pBuff[lOffset+iPos] == Term[uiPosTerm][iTermSizes[uiPosTerm]-1] && (iTermSizes[uiPosTerm]-1) <= (iPos+lOffset) )
if( pBuff[lOffset+iPos] == Term[iPosTerm][iTermSizes[iPosTerm]-1] && (iTermSizes[iPosTerm]-1) <= (iPos+lOffset) )
{
*bFound = TRUE;
for(uiPosition=0; uiPosition < (iTermSizes[uiPosTerm]-1); uiPosition++)
for(iPosition=0; iPosition < (iTermSizes[iPosTerm]-1); iPosition++)
{
if(Term[uiPosTerm][uiPosition] != pBuff[ lOffset+(iPos-iTermSizes[uiPosTerm])+uiPosition+1 ])
if(Term[iPosTerm][iPosition] != pBuff[ lOffset+(iPos-iTermSizes[iPosTerm])+iPosition+1 ])
{
*bFound = FALSE;
break;
@@ -124,7 +124,7 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te
if( *bFound )
{
*plBuffLen = lOffset + iPos - iTermSizes[ uiPosTerm ] + 1;
*plBuffLen = lOffset + iPos - iTermSizes[ iPosTerm ] + 1;
pBuff[ *plBuffLen ] = '\0';
@@ -170,7 +170,7 @@ HB_FUNC( HB_FREADLINE )
char * pBuffer;
int * iTermSizes;
LONG lSize = hb_parnl( 4 );
USHORT i, iTerms;
int i, iTerms;
BOOL bFound, bEOF;
if( ( !HB_ISBYREF( 2 ) ) || ( !HB_ISNUM( 1 ) ) )
@@ -188,7 +188,7 @@ HB_FUNC( HB_FREADLINE )
if( HB_ISARRAY( 3 ) )
{
pTerm1 = hb_param( 3, HB_IT_ARRAY );
iTerms = ( USHORT ) hb_arrayLen( pTerm1 );
iTerms = ( int ) hb_arrayLen( pTerm1 );
if( iTerms <= 0 )
{

View File

@@ -70,7 +70,7 @@ void hb_readLine( const char * szText, ULONG ulTextLen, ULONG uiLineLen, USHORT
ulCurrCol = 0;
ulLastBlk = 0;
if( ulTextLen <= 0 )
if( ulTextLen == 0 )
{
*lEnd = -1;
*ulEndOffset = 0;

View File

@@ -293,30 +293,22 @@ HB_EXTERN_BEGIN
# endif /* x86 */
#elif defined( __WATCOMC__ ) && defined( __cplusplus )
#elif defined( __WATCOMC__ )
# if defined( HB_CPU_X86 ) || defined( HB_CPU_X86_64 )
# if HB_COUNTER_SIZE == 4
static inline void hb_atomic_inc32( volatile int * p )
{
_asm {
mov eax, p
lock inc dword ptr [eax]
}
}
static inline void hb_atomic_inc32( volatile int * p );
#pragma aux hb_atomic_inc32 = \
"lock inc dword ptr [eax]" \
parm [ eax ] modify exact [] ;
static inline int hb_atomic_dec32( volatile int * p )
{
unsigned char c;
_asm {
mov eax, p
lock dec dword ptr [eax]
setne c
}
return c;
}
static inline unsigned char hb_atomic_dec32( volatile int * p );
#pragma aux hb_atomic_dec32 = \
"lock dec dword ptr [eax]", \
"setne al" \
parm [ eax ] value [ al ] modify exact [ al ] ;
# define HB_ATOM_INC( p ) ( hb_atomic_inc32( ( volatile int * ) (p) ) )
# define HB_ATOM_DEC( p ) ( hb_atomic_dec32( ( volatile int * ) (p) ) )
@@ -329,17 +321,11 @@ HB_EXTERN_BEGIN
# endif
static inline int hb_spinlock_trylock( volatile int * p )
{
int i = 1;
_asm {
mov eax, i
mov edx, p
xchg eax, dword ptr [edx]
mov i, eax
}
return i;
}
static inline int hb_spinlock_trylock( volatile int * p );
#pragma aux hb_spinlock_trylock = \
"mov eax, 1", \
"xchg eax, dword ptr [edx]" \
parm [ edx ] value [ eax ] modify exact [ eax ] ;
static inline void hb_spinlock_acquire( volatile int * l )
{

View File

@@ -963,7 +963,7 @@ static ULONG hb_fptGetMemoLen( FPTAREAP pArea, USHORT uiIndex )
{
ulLen = hb_fileReadAt( pArea->pMemoFile, pBlock, DBT_DEFBLOCKSIZE, fOffset );
fOffset += ulLen;
if( ulLen <= 0 )
if( ulLen == 0 )
break;
u = 0;
while( u < ulLen && pBlock[ u ] != 0x1A )
@@ -2364,7 +2364,7 @@ static HB_ERRCODE hb_fptCopyToRawFile( PHB_FILE pSrc, HB_FOFFSET from,
ulRead = hb_fileReadAt( pSrc, pBuffer, ( ULONG )
HB_MIN( ( HB_FOFFSET ) ulBufSize, size - written ),
from + written );
if( ulRead <= 0 )
if( ulRead == 0 )
errCode = EDBF_READ;
else if( hb_fsWriteLarge( hDst, pBuffer, ulRead ) != ulRead )
errCode = EDBF_WRITE;
@@ -2398,7 +2398,7 @@ static HB_ERRCODE hb_fptCopyToFile( PHB_FILE pSrc, HB_FOFFSET from,
ulRead = hb_fileReadAt( pSrc, pBuffer, ( ULONG )
HB_MIN( ( HB_FOFFSET ) ulBufSize, size - written ),
from + written );
if( ulRead <= 0 )
if( ulRead == 0 )
errCode = EDBF_READ;
else if( hb_fileWriteAt( pDst, pBuffer, ulRead,
to + written ) != ulRead )
@@ -2833,7 +2833,7 @@ static HB_ERRCODE hb_fptWriteMemo( FPTAREAP pArea, ULONG ulBlock, ULONG ulSize,
{
ulRead = hb_fsReadLarge( hFile, bBuffer,
HB_MIN( ulBufSize, ulLen - ulWritten ) );
if( ulRead <= 0 )
if( ulRead == 0 )
errCode = EDBF_READ;
else if( hb_fileWriteAt( pArea->pMemoFile, bBuffer,
ulRead, fOffset ) != ulRead )

View File

@@ -71,7 +71,7 @@ HB_FUNC( HB_BASE64ENCODE )
x = *s++;
*p++ = s_b64chars[ ( x >> 2 ) & 0x3F ];
if( len-- <= 0 )
if( len-- == 0 )
{
*p++ = s_b64chars[ ( x << 4 ) & 0x3F ];
*p++ = '=';
@@ -81,7 +81,7 @@ HB_FUNC( HB_BASE64ENCODE )
y = *s++;
*p++ = s_b64chars[ ( ( x << 4 ) | ( ( y >> 4 ) & 0x0F ) ) & 0x3F ];
if( len-- <= 0 )
if( len-- == 0 )
{
*p++ = s_b64chars[ ( y << 2 ) & 0x3F ];
*p++ = '=';

View File

@@ -202,6 +202,8 @@ HB_FUNC( DISKSPACE )
{
#if defined( __WATCOMC__ ) || defined( __CEGCC__ )
int iTODO;
bError = FALSE;
#else
#if defined( HB_OS_DARWIN )
struct statfs st;

View File

@@ -615,7 +615,11 @@ HB_FHANDLE hb_fsPOpen( const char * pFilename, const char * pMode )
close( hNullHandle );
setuid( getuid() );
setgid( getgid() );
#if defined( __WATCOMC__ )
execv( "/bin/sh", argv );
#else
execv( "/bin/sh", ( char ** ) argv );
#endif
exit(1);
}
}

View File

@@ -681,7 +681,7 @@ static void hb_gt_os2_Tone( PHB_GT pGT, double dFrequency, double dDuration )
USHORT temp = ( USHORT ) HB_MIN( HB_MAX( 0, dDuration ), USHRT_MAX );
dDuration -= temp;
if( temp <= 0 )
if( temp == 0 )
{
/* Ensure that the loop gets terminated when
only a fraction of the delay time remains. */

View File

@@ -347,7 +347,7 @@ static int hb_fsProcessExec( const char *pszFilename,
#elif defined( _MSC_VER ) || defined( __LCC__ ) || \
defined( __XCC__ ) || defined( __POCC__ )
iResult = _spawnvp( _P_WAIT, argv[ 0 ], argv );
#elif defined( __MINGW32__ )
#elif defined( __MINGW32__ ) || defined( __WATCOMC__ )
iResult = spawnvp( P_WAIT, argv[ 0 ], ( const char * const * ) argv );
#else
iResult = spawnvp( P_WAIT, argv[ 0 ], ( char * const * ) argv );
@@ -607,7 +607,11 @@ HB_FHANDLE hb_fsProcessOpen( const char *pszFilename,
char ** argv;
argv = hb_buildArgs( pszFilename );
#if defined( __WATCOMC__ )
execvp( argv[ 0 ], ( const char ** ) argv );
#else
execvp( argv[ 0 ], argv );
#endif
hb_freeArgs( argv );
#endif
exit(1);
@@ -717,7 +721,7 @@ HB_FHANDLE hb_fsProcessOpen( const char *pszFilename,
#if defined( _MSC_VER ) || defined( __LCC__ ) || \
defined( __XCC__ ) || defined( __POCC__ )
pid = _spawnvp( _P_NOWAIT, argv[ 0 ], argv );
#elif defined( __MINGW32__ )
#elif defined( __MINGW32__ ) || defined( __WATCOMC__ )
pid = spawnvp( P_NOWAIT, argv[ 0 ], ( const char * const * ) argv );
#else
pid = spawnvp( P_NOWAIT, argv[ 0 ], ( char * const * ) argv );