From 64e33bd8844fa7bb52312758f1c7f83d00aaec30 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 13 Sep 2012 08:06:40 +0000 Subject: [PATCH] 2012-09-13 10:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/include/hbpcode.h ! force PCODEs enumeration from zero - some compilers may use different value what can cause problems with casting to bytes * harbour/contrib/xhb/regexrpl.prg ! fixed hb_regexReplace() - hack for older HB_REGEXALL() code could cause RTE --- harbour/ChangeLog | 9 +++++++++ harbour/contrib/xhb/regexrpl.prg | 18 +++++++++--------- harbour/include/hbpcode.h | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 08d92e8b06..5df73e9087 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-13 10:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbpcode.h + ! force PCODEs enumeration from zero - some compilers may + use different value what can cause problems with casting to bytes + + * harbour/contrib/xhb/regexrpl.prg + ! fixed hb_regexReplace() - hack for older HB_REGEXALL() code + could cause RTE + 2012-09-12 14:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/gtwvg.h ! Fixed: casting. diff --git a/harbour/contrib/xhb/regexrpl.prg b/harbour/contrib/xhb/regexrpl.prg index f590ab11bf..408b3b8ff4 100644 --- a/harbour/contrib/xhb/regexrpl.prg +++ b/harbour/contrib/xhb/regexrpl.prg @@ -65,17 +65,17 @@ FUNCTION hb_RegexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, n IF ! Empty( aMatches ) FOR EACH aMatch IN aMatches - IF HB_ISARRAY( aMatch ) .AND. Len( aMatch ) == 1 .AND. ; + IF HB_ISARRAY( aMatch ) .AND. Len( aMatch ) >= 1 .AND. ; HB_ISARRAY( aMatch[ 1 ] ) aMatch := aMatch[ 1 ] - ENDIF - IF Len( aMatch ) == 3 // if regex matches I must have an array of 3 elements - cSearch := aMatch[ MATCH_STRING ] - nStart := aMatch[ MATCH_START ] - nLenSearch := Len( cSearch ) - nLenReplace := Len( cReplace ) - cReturn := Stuff( cReturn, nStart - nOffSet, nLenSearch, cReplace ) - nOffSet += nLenSearch - nLenReplace + IF Len( aMatch ) == 3 // if regex matches I must have an array of 3 elements + cSearch := aMatch[ MATCH_STRING ] + nStart := aMatch[ MATCH_START ] + nLenSearch := Len( cSearch ) + nLenReplace := Len( cReplace ) + cReturn := Stuff( cReturn, nStart - nOffSet, nLenSearch, cReplace ) + nOffSet += nLenSearch - nLenReplace + ENDIF ENDIF NEXT diff --git a/harbour/include/hbpcode.h b/harbour/include/hbpcode.h index e2d2b4ec31..8b210cb179 100644 --- a/harbour/include/hbpcode.h +++ b/harbour/include/hbpcode.h @@ -68,7 +68,7 @@ */ typedef enum { - HB_P_AND, /* 0 performs the logical AND of two latest stack values, removes them and places result */ + HB_P_AND = 0, /* 0 performs the logical AND of two latest stack values, removes them and places result */ HB_P_ARRAYPUSH, /* 1 places on the virtual machine stack an array element */ HB_P_ARRAYPOP, /* 2 pops a value from the eval stack into an array element */ HB_P_ARRAYDIM, /* 3 instructs the virtual machine to build an array with some specific dimensions */