From 6918a1f683c4684ffb78a785c999f8fa95bb1e21 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 18 May 2012 16:00:53 +0000 Subject: [PATCH] 2012-05-18 17:58 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbwin/win_reg.prg ! fixed RTE when non-NIL/non-numeric nRegSam is passed + minor cleanup/formatting --- harbour/ChangeLog | 26 +++++++++++++++----------- harbour/contrib/hbwin/win_reg.prg | 27 ++++++++++++--------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1284700362..60c6ddf75a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-18 17:58 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbwin/win_reg.prg + ! fixed RTE when non-NIL/non-numeric nRegSam is passed + minor cleanup/formatting + 2012-05-18 18:15 UTC+0300 Pavel Tsarenko (tpe2 at mail.ru) * contrib/hbwin/win_reg.prg * contrib/hbwin/tests/test_reg.prg @@ -40,12 +44,12 @@ * contrib/hbqt/tests/demoqt.prg ! On path to prevent memory leaks. - Please investigate the code changes and you will know - how many objects were been around without any mechanism + Please investigate the code changes and you will know + how many objects were been around without any mechanism to free them. You can take help of Qt documentation. - ; NOTE: currently demoqt.prg is the test bed for oncoming - GC related changes. + ; NOTE: currently demoqt.prg is the test bed for oncoming + GC related changes. * contrib/hbide/hbqreportsmanager.prg * contrib/hbide/hbqtoolbar.prg @@ -56,16 +60,16 @@ ; WARNING: hbIDE is not at stable stage present. - ; I always wondered why memory consumption goes on increasing + ; I always wondered why memory consumption goes on increasing with time application written with hbQT. Now I have the answer, and hopefully in few coming days a great amount of them will be covered. 2012-05-17 14:07 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb - + Implemented: detach a returned object of a method where parent - do not retain the ownership of the child with itself. In that case - Harbour has to delete it explicitly. This can be activated with + + Implemented: detach a returned object of a method where parent + do not retain the ownership of the child with itself. In that case + Harbour has to delete it explicitly. This can be activated with [*R=1*] tag postfixing the method call in relevant .qth. EXAMPLE: QToolBar():addAction( cText ) @@ -75,9 +79,9 @@ * contrib/hbqt/qtgui/qth/QToolBar.qth + Added: [*R=1*] tags whereever necessary. - ; NOTE: I have tried with QAction() only to locate where it is - returned as a not-owned object. Please dig into Qt documentation - to find the other occurances. I know it is a tedious job, but + ; NOTE: I have tried with QAction() only to locate where it is + returned as a not-owned object. Please dig into Qt documentation + to find the other occurances. I know it is a tedious job, but we have to do it anyway, which me alone cannot achieve. 2012-05-17 23:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) diff --git a/harbour/contrib/hbwin/win_reg.prg b/harbour/contrib/hbwin/win_reg.prg index 1e7ed3dc07..0f528984a6 100644 --- a/harbour/contrib/hbwin/win_reg.prg +++ b/harbour/contrib/hbwin/win_reg.prg @@ -132,12 +132,11 @@ FUNCTION win_regDelete( cRegPath, nRegSam ) IF Empty( cEntry ) lRetVal := win_regDeleteKey( nHKEY, cKey ) ELSE - IF nRegSam == NIL - nRegSam := KEY_SET_VALUE - ELSE - nRegSam := hb_bitor( nRegSam, KEY_SET_VALUE) + IF ! hb_isNumeric( nRegSam ) + nRegSam := 0 ENDIF - IF win_regOpenKeyEx( nHKEY, cKey, 0, nRegSam, @pKeyHandle ) + + IF win_regOpenKeyEx( nHKEY, cKey, 0, hb_bitOr( KEY_SET_VALUE, nRegSam ), @pKeyHandle ) lRetVal := win_regDeleteValue( pKeyHandle, cEntry ) win_regCloseKey( pKeyHandle ) ELSE @@ -181,12 +180,11 @@ FUNCTION win_regGet( nHKEY, cKeyName, cEntryName, xDefault, nRegSam ) LOCAL pKeyHandle LOCAL nValueType - IF nRegSam == NIL - nRegSam := KEY_QUERY_VALUE - ELSE - nRegSam := hb_bitor( nRegSam, KEY_QUERY_VALUE) + IF ! hb_isNumeric( nRegSam ) + nRegSam := 0 ENDIF - IF win_regOpenKeyEx( nHKEY, cKeyName, 0, nRegSam, @pKeyHandle ) + + IF win_regOpenKeyEx( nHKEY, cKeyName, 0, hb_bitOr( KEY_QUERY_VALUE, nRegSam ), @pKeyHandle ) /* retrieve the length of the value */ @@ -225,12 +223,11 @@ FUNCTION win_regSet( nHKEY, cKeyName, cEntryName, xValue, nValueType, nRegSam ) LOCAL lRetVal := .F. LOCAL pKeyHandle - IF nRegSam == NIL - nRegSam := KEY_SET_VALUE - ELSE - nRegSam := hb_bitor( nRegSam, KEY_SET_VALUE) + IF ! hb_isNumeric( nRegSam ) + nRegSam := 0 ENDIF - IF win_regCreateKeyEx( nHKEY, cKeyName, 0, 0, 0, nRegSam, 0, @pKeyHandle ) + + IF win_regCreateKeyEx( nHKEY, cKeyName, 0, 0, 0, hb_bitOr( KEY_SET_VALUE, nRegSam ), 0, @pKeyHandle ) /* no support for Arrays, Codeblock ... */ SWITCH ValType( xValue )