From 2db36d6772948ffdd04cabd959f7ac4deb7642f5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 19 Apr 2010 12:03:51 +0000 Subject: [PATCH] 2010-04-19 14:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbini.prg ! Added proper type checks for all accepted parameters to avoid (sometimes obscure) RTEs when passing wrong parameters. * src/rtl/profiler.prg * src/rtl/hbi18n2.prg + Added proper type checks instead of "DEFAULT .. TO' method. --- harbour/ChangeLog | 43 +++++++++++++++++++------------ harbour/src/rtl/hbi18n2.prg | 8 ++++-- harbour/src/rtl/hbini.prg | 50 ++++++++++++++++++++++-------------- harbour/src/rtl/profiler.prg | 8 ++++-- 4 files changed, 69 insertions(+), 40 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 540e74c5cc..793ee40daf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,15 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-19 14:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/hbini.prg + ! Added proper type checks for all accepted parameters to avoid + (sometimes obscure) RTEs when passing wrong parameters. + + * src/rtl/profiler.prg + * src/rtl/hbi18n2.prg + + Added proper type checks instead of "DEFAULT .. TO' method. + 2010-04-19 12:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbmzip/zip.c ! fixed GPF reported by Mario. @@ -24,7 +33,7 @@ 2010-04-17 23:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_hbslots.cpp - % Slots disconnecting QTableWidget were improper, detected + % Slots disconnecting QTableWidget were improper, detected through Linux. * contrib/hbqt/THbQtUI.prg @@ -53,8 +62,8 @@ * contrib/hbide/idethemes.prg - + Mode methods populated with custome code to accomodate detatched - parents. + + Mode methods populated with custome code to accomodate detatched + parents. Now there is no GPF absolutely neither any RTE at exit (WinXP). It is 17Apr2010 today, exactly one year and one month since @@ -100,28 +109,28 @@ * contrib/hbqt/qtgui/QLayout.cpp * contrib/hbqt/qth/QLayout.qth * contrib/hbqt/generator/hbqtgen.prg - + Implemented to pick function body from .qth headers and + + Implemented to pick function body from .qth headers and posted exactly the same within .cpp. Like: QLayout.qth - + bool activate () // some method before virtual void addItem ( QLayoutItem * item ){ // Code publishes by Istvan. } void addWidget ( QWidget * w ) // some method after or none - Note for the opening and closing braces. These must be - last character of the method header and first character - of the methods last and separate line. + Note for the opening and closing braces. These must be + last character of the method header and first character + of the methods last and separate line. - This feature facilitates to put the code dierect in headers - where we cannot generate it in automated way. This feature is + This feature facilitates to put the code dierect in headers + where we cannot generate it in automated way. This feature is strongly discouraged to be used heavily. 2010-04-16 07:49 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/qth/QApplication.qth * contrib/hbqt/qth/QLayout.qth - + * contrib/hbqt/generator/hbqtgen.prg * contrib/hbqt/hbqt_hbslots.cpp @@ -140,7 +149,7 @@ * contrib/hbide/ideshortcuts.prg * contrib/hbide/idetools.prg - + This commit includes Francesco Perillo's patch, after applying some + + This commit includes Francesco Perillo's patch, after applying some formatting and leaving what did not worked. + Includes Istvan's concept of child detachment, but not made active still. - Deleted many objects which were created in early days of hbIDE development. @@ -149,9 +158,9 @@ + Applied some more control over object destruction placement. + Plus a lot of optimizations I cannot jot down exactly. - Basically, this commit aims at locating the GPF at exit. Now instead of - GPF, we receive two RTE's at the end, if exiting hbIDE at the quick - succession. But if you have worked into it for few seconds, it exits + Basically, this commit aims at locating the GPF at exit. Now instead of + GPF, we receive two RTE's at the end, if exiting hbIDE at the quick + succession. But if you have worked into it for few seconds, it exits normally. Please test. David, the QPixmap bug in hbXBP on OS2 was a bug in hbXBP and is fixed. @@ -173,7 +182,7 @@ This puts msvc in the lead again compared to mingw regarding speed. * config/wce/msvcarm.mk - * Deleted bogus option -Od turning off all optimization for + * Deleted bogus option -Od turning off all optimizations for wce/msvcarm targets for new compiler versions. * config/wce/msvcarm.mk @@ -656,7 +665,7 @@ This version gives ZIP64 support. To exploit it we will need changes in Harbour wrapper code. ; TOFIX: In quick tests BCC was throwing 'Abnormal program termination' - and created corrupted .zip. Rest seems okay. + and created corrupted .zip. Rest seems okay. [DONE] ; TODO: Platforms tests, review patches, etc. 2010-04-09 14:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) diff --git a/harbour/src/rtl/hbi18n2.prg b/harbour/src/rtl/hbi18n2.prg index c453b54653..f561d1a7be 100644 --- a/harbour/src/rtl/hbi18n2.prg +++ b/harbour/src/rtl/hbi18n2.prg @@ -301,8 +301,12 @@ FUNCTION __I18N_POTARRAYSAVE( cFile, aTrans, cErrorMsg, lVersionNo, lSourceRef ) LOCAL cEol, cPOT, cFlg LOCAL msg - DEFAULT lVersionNo TO .T. - DEFAULT lSourceRef TO .T. + IF ! ISLOGICAL( lVersionNo ) + lVersionNo := .T. + ENDIF + IF ! ISLOGICAL( lSourceRef ) + lSourceRef := .T. + ENDIF lRet := .F. cEol := hb_osNewLine() diff --git a/harbour/src/rtl/hbini.prg b/harbour/src/rtl/hbini.prg index ff3fb2fc11..c7f2d44c38 100644 --- a/harbour/src/rtl/hbini.prg +++ b/harbour/src/rtl/hbini.prg @@ -84,36 +84,48 @@ STATIC s_cHalfLineComment := "#" PROCEDURE hb_IniSetComment( cLc, cHlc ) - s_cLineComment := cLc - s_cHalfLineComment := cHlc + IF ISCHARACTER( cLc ) + s_cLineComment := cLc + ENDIF + + IF ISCHARACTER( cHlc ) + s_cHalfLineComment := cHlc + ENDIF RETURN FUNCTION HB_IniNew( lAutoMain ) LOCAL hIni := hb_Hash() + IF ! ISLOGICAL( lAutoMain ) + lAutoMain := .T. + ENDIF + IF lAutoMain hIni[ "MAIN" ] := hb_Hash() ENDIF RETURN hIni - FUNCTION hb_IniRead( cFileSpec, lKeyCaseSens, cSplitters, lAutoMain ) - LOCAL cData - - cData := hb_IniFileLow( cFileSpec ) - - RETURN hb_IniReadStr( cData, lKeyCaseSens, cSplitters, lAutoMain ) + RETURN hb_IniReadStr( iif( ISCHARACTER( cFileSpec ), hb_IniFileLow( cFileSpec ), "" ), lKeyCaseSens, cSplitters, lAutoMain ) FUNCTION hb_IniReadStr( cData, lKeyCaseSens, cSplitters, lAutoMain ) LOCAL hIni := hb_Hash() /* Default case sensitiveness for keys */ - DEFAULT lKeyCaseSens TO .T. - DEFAULT cSplitters TO "=" - DEFAULT lAutoMain TO .T. - DEFAULT cData TO "" + IF ! ISLOGICAL( lKeyCaseSens ) + lKeyCaseSens := .T. + ENDIF + IF ! ISCHARACTER( cSplitters ) + cSplitters := "=" + ENDIF + IF ! ISLOGICAL( lAutoMain ) + lAutoMain := .T. + ENDIF + IF ! ISCHARACTER( cData ) + cData := "" + ENDIF hb_HCaseMatch( hIni, lKeyCaseSens ) @@ -162,8 +174,6 @@ STATIC FUNCTION hb_IniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMai LOCAL cLine LOCAL reComment, reInclude, reSection, reSplitters - DEFAULT cData TO "" - reComment := hb_RegexComp( s_cHalfLineComment + "|^[ \t]*" + s_cLineComment ) reInclude := hb_RegexComp( "include (.*)" ) reSection := hb_RegexComp( "[[](.*)[]]" ) @@ -318,15 +328,17 @@ FUNCTION hb_IniWriteStr( hIni, cCommentBegin, cCommentEnd, lAutoMain ) LOCAL cSection LOCAL cBuffer := "" - IF !HB_ISHASH( hIni ) + IF ! HB_ISHASH( hIni ) RETURN NIL ENDIF - IF ! Empty( cCommentBegin ) + IF ISCHARACTER( cCommentBegin ) .AND. ! Empty( cCommentBegin ) cBuffer += cCommentBegin + cNewLine ENDIF - DEFAULT lAutoMain TO .T. + IF ! ISLOGICAL( lAutoMain ) + lAutoMain := .T. + ENDIF // Fix if lAutoMain is .T. but I haven't a MAIN section IF lAutoMain .AND. !hb_HHasKey( hIni, "MAIN" ) @@ -369,8 +381,8 @@ FUNCTION hb_IniWriteStr( hIni, cCommentBegin, cCommentEnd, lAutoMain ) hb_CStr( xVal ) + cNewLine } ) NEXT - IF ! Empty( cCommentEnd ) + IF ISCHARACTER( cCommentEnd ) .AND. ! Empty( cCommentEnd ) cBuffer += cCommentEnd + cNewLine ENDIF - RETURN IIF( !Empty( cBuffer ), cBuffer, NIL ) + RETURN iif( ! Empty( cBuffer ), cBuffer, NIL ) diff --git a/harbour/src/rtl/profiler.prg b/harbour/src/rtl/profiler.prg index 42d7a2961e..3b5f7d12fd 100644 --- a/harbour/src/rtl/profiler.prg +++ b/harbour/src/rtl/profiler.prg @@ -607,7 +607,9 @@ METHOD emitLine( oEntity ) CLASS HBProfileReport METHOD generate( bFilter ) CLASS HBProfileReport LOCAL lProfile := __setProfiler( .F. ) - DEFAULT bFilter TO {|| .T. } + IF ! ISBLOCK( bFilter ) + bFilter := {|| .T. } + ENDIF ::emitHeader():oProfile:forEach( {| o | iif( Eval( bFilter, o ), ::emitLine( o ), NIL ) } ) @@ -645,7 +647,9 @@ METHOD writeLines( aLines ) CLASS HBProfileReportToFile METHOD generate( bFilter, cFile ) CLASS HBProfileReportToFile LOCAL lProfile := __setProfiler( .F. ) - DEFAULT cFile TO "hbprof.txt" + IF ! ISCHARACTER( cFile ) + cFile := "hbprof.txt" + ENDIF IF ( ::hFile := fcreate( cFile ) ) != F_ERROR ::super:generate( bFilter )