diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ebceffb8f5..38d5947063 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,26 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +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__: diff --git a/harbour/source/common/expropt1.c b/harbour/source/common/expropt1.c index 5cef045e64..95edcd5b1a 100644 --- a/harbour/source/common/expropt1.c +++ b/harbour/source/common/expropt1.c @@ -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 diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index e1ecfb7528..12ceafc931 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -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 ); } } diff --git a/harbour/source/common/hbdate.c b/harbour/source/common/hbdate.c index 4cc2626704..c315531dfa 100644 --- a/harbour/source/common/hbdate.c +++ b/harbour/source/common/hbdate.c @@ -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 { diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index 66af96670a..b2233627bd 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -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--; diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 1417919191..9a9ea815f9 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -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 diff --git a/harbour/source/compiler/harbour.yyc b/harbour/source/compiler/harbour.yyc index c8b73153b9..849c5e8220 100644 --- a/harbour/source/compiler/harbour.yyc +++ b/harbour/source/compiler/harbour.yyc @@ -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 diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index 32b34a561a..d5a7dc6d34 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -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 ) diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 290cb68b84..e178242a09 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -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;