From 4e5a819c8025eba6e8838b65b538a430d41fbc0e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 15 Nov 2010 15:14:01 +0000 Subject: [PATCH] 2010-11-15 16:13 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtclip.c ! fixed bug in calculation of maximum unicode clipboard buffer size * harbour/src/compiler/complex.c ! recognize BREAK( [] ) as BREAK [] statement not function call - it enables some addiitonal compiler logic like warning for unreachable code, i.e.: proc main() break() ? "Hello World!!!" return * harbour/contrib/xhb/xhb.hbp * harbour/contrib/xhb/xhb.hbx + harbour/contrib/xhb/xhbmvinf.c + added __MVSYMBOLINFO() xHarbour compatible function * harbour/src/rdd/dbfntx/dbfntx1.c * harbour/src/rdd/dbfnsx/dbfnsx1.c * harbour/src/rdd/dbfcdx/dbfcdx1.c ! fixed INDEX ON ... command with USECURRENT clause to ignore active filter on internal GOTOP operation. Many thanks to Oleg for bug report and self contain code example illustrating the problem. --- harbour/ChangeLog | 26 +++++++++++ harbour/contrib/xhb/xhb.hbp | 1 + harbour/contrib/xhb/xhb.hbx | 1 + harbour/contrib/xhb/xhbmvinf.c | 75 ++++++++++++++++++++++++++++++++ harbour/src/compiler/complex.c | 4 +- harbour/src/rdd/dbfcdx/dbfcdx1.c | 12 +++++ harbour/src/rdd/dbfnsx/dbfnsx1.c | 11 +++++ harbour/src/rdd/dbfntx/dbfntx1.c | 11 +++++ harbour/src/rtl/gtclip.c | 2 +- 9 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 harbour/contrib/xhb/xhbmvinf.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index df28229475..abbb59e44f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,32 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-15 16:13 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtclip.c + ! fixed bug in calculation of maximum unicode clipboard buffer size + + * harbour/src/compiler/complex.c + ! recognize BREAK( [] ) as BREAK [] statement + not function call - it enables some addiitonal compiler + logic like warning for unreachable code, i.e.: + proc main() + break() + ? "Hello World!!!" + return + + * harbour/contrib/xhb/xhb.hbp + * harbour/contrib/xhb/xhb.hbx + + harbour/contrib/xhb/xhbmvinf.c + + added __MVSYMBOLINFO() xHarbour compatible function + + * harbour/src/rdd/dbfntx/dbfntx1.c + * harbour/src/rdd/dbfnsx/dbfnsx1.c + * harbour/src/rdd/dbfcdx/dbfcdx1.c + ! fixed INDEX ON ... command with USECURRENT clause to + ignore active filter on internal GOTOP operation. + Many thanks to Oleg for bug report and self contain + code example illustrating the problem. + 2010-11-14 14:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbhpdf/harupdf.ch * contrib/hbhpdf/harupdf.c diff --git a/harbour/contrib/xhb/xhb.hbp b/harbour/contrib/xhb/xhb.hbp index d33220bc7b..3568b58e37 100644 --- a/harbour/contrib/xhb/xhb.hbp +++ b/harbour/contrib/xhb/xhb.hbp @@ -54,6 +54,7 @@ xhbini.c xhbis.c xhbmsgs.c xhbmtc.c +xhbmvinf.c xhbqself.c xhbproc.c xhbregx.c diff --git a/harbour/contrib/xhb/xhb.hbx b/harbour/contrib/xhb/xhb.hbx index a7a227b3ca..d069281f56 100644 --- a/harbour/contrib/xhb/xhb.hbx +++ b/harbour/contrib/xhb/xhb.hbx @@ -451,6 +451,7 @@ DYNAMIC __CSTR_COPYTO DYNAMIC __ERRORBLOCK DYNAMIC __INIT_LONGLONGS DYNAMIC __MINIMALERRORHANDLER +DYNAMIC __MVSYMBOLINFO DYNAMIC __OUTDEBUG DYNAMIC __SENDRAWMSG diff --git a/harbour/contrib/xhb/xhbmvinf.c b/harbour/contrib/xhb/xhbmvinf.c new file mode 100644 index 0000000000..529e4ae79c --- /dev/null +++ b/harbour/contrib/xhb/xhbmvinf.c @@ -0,0 +1,75 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * + * + * Copyright 2010 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapi.h" +#include "hbapiitm.h" +#include "hbmemvar.ch" + +HB_FUNC( __MVSYMBOLINFO ) +{ + PHB_ITEM pArray; + + pArray = hb_memvarSaveInArray( HB_MV_PUBLIC | HB_MV_PRIVATE, HB_TRUE ); + if( pArray ) + { + HB_SIZE nLen = hb_arrayLen( pArray ), n; + for( n = 1; n <= nLen; ++n ) + { + PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, n ); + PHB_SYMB pSym = hb_arrayGetSymbol( pItem, 1 ); + hb_arraySetC( pItem, 1, pSym->szName ); + } + hb_itemReturnRelease( pArray ); + } + else + hb_reta( 0 ); +} diff --git a/harbour/src/compiler/complex.c b/harbour/src/compiler/complex.c index c47e377cdb..94c1f36cd8 100644 --- a/harbour/src/compiler/complex.c +++ b/harbour/src/compiler/complex.c @@ -1011,9 +1011,7 @@ int hb_comp_yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) */ if( pLex->iState == LOOKUP && ( HB_PP_TOKEN_ISEOC( pToken->pNext ) || - !( HB_PP_LEX_NEEDLEFT( pToken->pNext ) || - HB_PP_TOKEN_TYPE( pToken->pNext->type ) == - HB_PP_TOKEN_LEFT_PB ) ) ) + !HB_PP_LEX_NEEDLEFT( pToken->pNext ) ) ) { pLex->iState = BREAK; return BREAK; diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 477222e8d9..760b793c80 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -9459,6 +9459,18 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, HB_BOOL fReindex ) { pArea->uiTag = 0; } + else if( pArea->uiTag != 0 ) + { + LPCDXTAG pCurrTag = hb_cdxGetActiveTag( pArea ); + if( pCurrTag ) + { + hb_cdxIndexLockRead( pCurrTag->pIndex ); + hb_cdxTagRefreshScope( pCurrTag ); + hb_cdxTagGoTop( pCurrTag ); + ulStartRec = pCurrTag->CurKey->rec; + hb_cdxIndexUnLockRead( pCurrTag->pIndex ); + } + } } fDirectRead = !hb_setGetStrictRead() && /* !pArea->dbfarea.area.lpdbRelations && */ ( !pArea->dbfarea.area.lpdbOrdCondInfo || pArea->dbfarea.area.lpdbOrdCondInfo->fAll || diff --git a/harbour/src/rdd/dbfnsx/dbfnsx1.c b/harbour/src/rdd/dbfnsx/dbfnsx1.c index d29258b8ea..6b917ae879 100644 --- a/harbour/src/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -5855,6 +5855,17 @@ static HB_ERRCODE hb_nsxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) { pArea->lpCurTag = NULL; } + else if( pArea->lpCurTag ) + { + if( hb_nsxTagLockRead( pArea->lpCurTag ) ) + { + hb_nsxTagRefreshScope( pArea->lpCurTag ); + hb_nsxTagGoTop( pArea->lpCurTag ); + if( !pArea->lpCurTag->TagEOF ) + ulStartRec = pArea->lpCurTag->CurKeyInfo->rec; + hb_nsxTagUnLockRead( pArea->lpCurTag ); + } + } } fDirectRead = !hb_setGetStrictRead() && /* !pArea->dbfarea.area.lpdbRelations && */ diff --git a/harbour/src/rdd/dbfntx/dbfntx1.c b/harbour/src/rdd/dbfntx/dbfntx1.c index c391281a8f..4fb51fbaa2 100644 --- a/harbour/src/rdd/dbfntx/dbfntx1.c +++ b/harbour/src/rdd/dbfntx/dbfntx1.c @@ -5359,6 +5359,17 @@ static HB_ERRCODE hb_ntxTagCreate( LPTAGINFO pTag, HB_BOOL fReindex ) { pArea->lpCurTag = NULL; } + else if( pArea->lpCurTag ) + { + if( hb_ntxTagLockRead( pArea->lpCurTag ) ) + { + hb_ntxTagRefreshScope( pArea->lpCurTag ); + hb_ntxTagGoTop( pArea->lpCurTag ); + if( !pArea->lpCurTag->TagEOF ) + ulStartRec = pArea->lpCurTag->CurKeyInfo->Xtra; + hb_ntxTagUnLockRead( pArea->lpCurTag ); + } + } } fDirectRead = !hb_setGetStrictRead() && /* !pArea->dbfarea.area.lpdbRelations && */ diff --git a/harbour/src/rtl/gtclip.c b/harbour/src/rtl/gtclip.c index 27d993b226..47592bd451 100644 --- a/harbour/src/rtl/gtclip.c +++ b/harbour/src/rtl/gtclip.c @@ -181,7 +181,7 @@ HB_BOOL hb_gt_winapi_getClipboard( HB_UINT uFormat, PHB_ITEM pItem ) switch( uFormat ) { case CF_UNICODETEXT: - nSize = hb_wstrnlen( ( const wchar_t * ) lpMem, nSize ); + nSize = hb_wstrnlen( ( const wchar_t * ) lpMem, nSize >> 1 ); if( nSize ) hb_itemPutStrLenU16( pItem, HB_CDP_ENDIAN_NATIVE, ( const wchar_t * ) lpMem, nSize );