2008-05-31 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/debug/debugger.prg
    * removed some unused var, formatting

  * harbour/source/pp/ppcore.c
  * harbour/source/common/expropt1.c
  * harbour/source/common/expropt2.c
  * harbour/source/common/hbdate.c
    * casting

  * harbour/source/common/hbstr.c
    * casting
    * use HB_ISSPACE() instead of isspace() for strict Clipper
      compatibility

  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
    ! never use 'char' to 'int' casting for parameters of
      toupper()/to*()/isuper()/is*() functions
This commit is contained in:
Przemyslaw Czerpak
2008-05-31 09:30:26 +00:00
parent 2ad741b2b0
commit 29f5f93b0b
9 changed files with 61 additions and 35 deletions

View File

@@ -8,6 +8,26 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-05-31 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/debug/debugger.prg
* removed some unused var, formatting
* harbour/source/pp/ppcore.c
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
* harbour/source/common/hbdate.c
* casting
* harbour/source/common/hbstr.c
* casting
* use HB_ISSPACE() instead of isspace() for strict Clipper
compatibility
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
! never use 'char' to 'int' casting for parameters of
toupper()/to*()/isuper()/is*() functions
2008-05-31 09:57 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* include/hbdefs.h
* For __BORLANDC__:

View File

@@ -1049,7 +1049,7 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr, HB_COMP_DECL )
if( pNegExpr->value.asNum.NumType == HB_ET_DOUBLE )
{
pNegExpr->value.asNum.val.d = - pNegExpr->value.asNum.val.d;
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
pNegExpr->value.asNum.bWidth = ( UCHAR ) HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
}
else
{
@@ -1058,7 +1058,7 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr, HB_COMP_DECL )
{
pNegExpr->value.asNum.NumType = HB_ET_DOUBLE;
pNegExpr->value.asNum.val.d = - ( double ) pNegExpr->value.asNum.val.l;
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
pNegExpr->value.asNum.bWidth = ( UCHAR ) HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
pNegExpr->value.asNum.bDec = 0;
}
else

View File

@@ -280,7 +280,7 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{
pSelf->value.asNum.val.d = pLeft->value.asNum.val.d * pRight->value.asNum.val.d;
pSelf->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec + pRight->value.asNum.bDec;
pSelf->value.asNum.bDec = ( UCHAR ) ( pLeft->value.asNum.bDec + pRight->value.asNum.bDec );
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
break;
@@ -1681,7 +1681,7 @@ BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL )
fDealloc = TRUE;
}
do
szValue[ ulLen ] = toupper( (unsigned char) szValue[ ulLen ] );
szValue[ ulLen ] = ( char ) toupper( ( unsigned char ) szValue[ ulLen ] );
while( ++ulLen < pArg->ulLength );
}
}

View File

@@ -145,16 +145,16 @@ HB_EXPORT void hb_dateStrPut( char * szDate, int iYear, int iMonth, int iDay )
if( iYear >= 0 && iMonth > 0 && iDay > 0 )
{
szDate[ 0 ] = ( ( iYear / 1000 ) % 10 ) + '0';
szDate[ 1 ] = ( ( iYear / 100 ) % 10 ) + '0';
szDate[ 2 ] = ( ( iYear / 10 ) % 10 ) + '0';
szDate[ 3 ] = ( iYear % 10 ) + '0';
szDate[ 0 ] = ( char ) ( ( ( iYear / 1000 ) % 10 ) + '0' );
szDate[ 1 ] = ( char ) ( ( ( iYear / 100 ) % 10 ) + '0' );
szDate[ 2 ] = ( char ) ( ( ( iYear / 10 ) % 10 ) + '0' );
szDate[ 3 ] = ( char ) ( ( iYear % 10 ) + '0' );
szDate[ 4 ] = ( iMonth / 10 ) + '0';
szDate[ 5 ] = ( iMonth % 10 ) + '0';
szDate[ 4 ] = ( char ) ( ( iMonth / 10 ) + '0' );
szDate[ 5 ] = ( char ) ( ( iMonth % 10 ) + '0' );
szDate[ 6 ] = ( iDay / 10 ) + '0';
szDate[ 7 ] = ( iDay % 10 ) + '0';
szDate[ 6 ] = ( char ) ( ( iDay / 10 ) + '0' );
szDate[ 7 ] = ( char ) ( ( iDay % 10 ) + '0' );
}
else
{

View File

@@ -124,7 +124,7 @@ HB_EXPORT char * hb_strupr( char * pszText )
HB_TRACE(HB_TR_DEBUG, ("hb_strupr(%s)", pszText));
for( pszPos = pszText; *pszPos; pszPos++ )
*pszPos = toupper( ( UCHAR ) *pszPos );
*pszPos = ( char ) toupper( ( UCHAR ) *pszPos );
return pszText;
}
@@ -136,7 +136,7 @@ HB_EXPORT char * hb_strlow( char * pszText )
HB_TRACE(HB_TR_DEBUG, ("hb_strlow(%s)", pszText));
for( pszPos = pszText; *pszPos; pszPos++ )
*pszPos = tolower( ( UCHAR ) *pszPos );
*pszPos = ( char ) tolower( ( UCHAR ) *pszPos );
return pszText;
}
@@ -196,8 +196,8 @@ HB_EXPORT int hb_stricmp( const char * s1, const char * s2 )
do
{
c1 = toupper( (unsigned char) *s1 );
c2 = toupper( (unsigned char) *s2 );
c1 = toupper( ( unsigned char ) *s1 );
c2 = toupper( ( unsigned char ) *s2 );
if( c1 != c2 )
{
@@ -223,8 +223,8 @@ HB_EXPORT int hb_strnicmp( const char * s1, const char * s2, ULONG count )
for( ulCount = 0; ulCount < count; ulCount++ )
{
unsigned char c1 = toupper( (unsigned char) s1[ ulCount ] );
unsigned char c2 = toupper( (unsigned char) s2[ ulCount ] );
unsigned char c1 = ( char ) toupper( ( unsigned char ) s1[ ulCount ] );
unsigned char c2 = ( char ) toupper( ( unsigned char ) s2[ ulCount ] );
if( c1 != c2 )
{
@@ -506,7 +506,7 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG
HB_TRACE(HB_TR_DEBUG, ("hb_str2number(%d, %p, %lu, %p, %p, %p, %p)", (int) fPCode, szNum, ulLen, lVal, dVal, piDec, piWidth ));
while( ulPos < ulLen && isspace( (BYTE) szNum[ulPos] ) )
while( ulPos < ulLen && HB_ISSPACE( szNum[ulPos] ) )
ulPos++;
if( ulPos >= ulLen )
@@ -794,13 +794,13 @@ HB_EXPORT char * hb_strncpyLower( char * pDest, const char * pSource, ULONG ulLe
/* some compilers implement tolower as a macro, and this has side effects! */
/* *pDest++ = tolower( *pSource++ ); */
while( ulLen && (*pDest++ = tolower( *pSource )) != '\0' )
while( ulLen && ( *pDest++ = ( char ) tolower( ( UCHAR ) *pSource ) ) != '\0' )
{
ulLen--;
pSource++;
}
while(ulLen--)
while( ulLen-- )
{
*pDest++ = '\0';
}
@@ -825,13 +825,13 @@ HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLe
/* some compilers implement toupper as a macro, and this has side effects! */
/* *pDest++ = toupper( *pSource++ ); */
while( ulLen && (*pDest++ = toupper( *pSource )) != '\0' )
while( ulLen && ( *pDest++ = ( char ) toupper( ( UCHAR ) *pSource ) ) != '\0' )
{
ulLen--;
pSource++;
}
while(ulLen--)
while( ulLen-- )
{
*pDest++ = '\0';
}
@@ -867,7 +867,8 @@ HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG
/* some compilers impliment toupper as a macro, and this has side effects! */
/* *pDest++ = toupper( *pSource++ ); */
while( ulLen && ulSLen && (*pDest++ = toupper( *pSource )) != '\0' )
while( ulLen && ulSLen &&
( *pDest++ = ( char ) toupper( ( UCHAR ) *pSource ) ) != '\0' )
{
ulSLen--;
ulLen--;

View File

@@ -1238,7 +1238,7 @@ Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( HB_COMP_PARAM, $2 ); HB
if( ! HB_COMP_PARAM->pLastDeclared->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastDeclared->szName );
HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
}
/* Resetting */
@@ -1277,7 +1277,7 @@ DecMethod : IdentName '(' { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_C
if( ! HB_COMP_PARAM->pLastMethod->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
}
HB_COMP_PARAM->szFromClass = NULL;
@@ -1307,7 +1307,7 @@ DecData : IdentName { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_
if( ! HB_COMP_PARAM->pLastMethod->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' :'o' );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' :'o' );
}
}
else

View File

@@ -6182,7 +6182,7 @@ yyreduce:
if( ! HB_COMP_PARAM->pLastDeclared->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastDeclared->szName );
HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
}
/* Resetting */
@@ -6247,7 +6247,7 @@ yyreduce:
if( ! HB_COMP_PARAM->pLastMethod->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' );
}
HB_COMP_PARAM->szFromClass = NULL;
@@ -6283,7 +6283,7 @@ yyreduce:
if( ! HB_COMP_PARAM->pLastMethod->pClass )
{
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' :'o' );
HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) HB_COMP_PARAM->cVarType ) ? 'O' :'o' );
}
}
else

View File

@@ -1122,7 +1122,10 @@ METHOD EditColor( nColor, oBrwColors ) CLASS HBDebugger
READ
SetCursor( SC_NONE )
#else
cColor := getdbginput( Row(), Col() + 15, cColor, { | cColor | iif( Type( cColor ) != "C", ( Alert( "Must be string" ), .F. ), .T. ) }, SubStr( ::ClrModal(), 5 ) )
cColor := getdbginput( Row(), Col() + 15, cColor, ;
{ | cColor | iif( Type( cColor ) != "C", ;
( Alert( "Must be string" ), .F. ), .T. ) }, ;
SubStr( ::ClrModal(), 5 ) )
#endif
Set( _SET_SCOREBOARD, lPrevScore )
@@ -1156,7 +1159,10 @@ METHOD EditSet( nSet, oBrwSets ) CLASS HBDebugger
READ
SetCursor( SC_NONE )
#else
cSet := getdbginput( Row(), Col() + 13, cSet, { | cSet | iif( Type( cSet ) != cType, ( Alert( "Must be of type '" + cType + "'" ), .F. ), .T. ) }, SubStr( ::ClrModal(), 5 ) )
cSet := getdbginput( Row(), Col() + 13, cSet, ;
{ | cSet | iif( Type( cSet ) != cType,
( Alert( "Must be of type '" + cType + "'" ), .F. ), .T. ) }, ;
SubStr( ::ClrModal(), 5 ) )
#endif
Set( _SET_SCOREBOARD, lPrevScore )
@@ -1543,13 +1549,13 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger
LOCAL nWidth := nRight - nLeft - 1
LOCAL cPicture
LOCAL uTemp
LOCAL GetList := {}
LOCAL nOldCursor
LOCAL lScoreBoard := Set( _SET_SCOREBOARD, .F. )
LOCAL lExit
LOCAL oWndInput := HBDbWindow():New( nTop, nLeft, nBottom, nRight, cMsg,;
::oPullDown:cClrPopup )
#ifndef HB_NO_READDBG
LOCAL GetList := {}
LOCAL bMouseSave
LOCAL oGet
#endif
@@ -1683,7 +1689,6 @@ METHOD ListBox( cCaption, aItems ) CLASS HBDebugger
LOCAL oWndList
LOCAL cSelected := ""
LOCAL cColors
LOCAL GetList := {}
LOCAL n
nItems := Len( aItems )

View File

@@ -690,7 +690,7 @@ static void hb_pp_readLine( PHB_PP_STATE pState )
/* Clipper strips \r characters even from quoted strings */
else if( ch != '\r' )
{
hb_membufAddCh( pState->pBuffer, ch );
hb_membufAddCh( pState->pBuffer, ( char ) ch );
}
}
pState->iLineTot += iLine;