diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6b260abe3a..07a71bd5aa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ + symbols then we should expect some farther speed improvement, + it will also resolve some set of memory leaks like in: + type("user input") + and will allow to make some parts of grammar parser common to + compiler and macro compiler by removing #if[n]def HB_MACRO_SUPPORT + +2006-11-17 14:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/common/hbstr.c + ! fixed decoding strings without trailing ASCII NUL character in + hb_strRemEscSeq() * harbour/source/pp/ppcore.c + added decoding C escaped strings (e"...") to PP so they can be diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index f873c674c3..a83b0dca57 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -871,25 +871,32 @@ char * hb_strRemEscSeq( char *str, ULONG *pLen ) if( ch == '\\' ) { ++ulStripped; - ch = *ptr++; - switch( ch ) + if( ul ) { - case 'r': - ch = '\r'; - break; - case 'n': - ch = '\n'; - break; - case 't': - ch = '\t'; - break; - case 'b': - ch = '\b'; - break; - case '\\': - default: - break; + ul--; + ch = *ptr++; + switch( ch ) + { + case 'r': + ch = '\r'; + break; + case 'n': + ch = '\n'; + break; + case 't': + ch = '\t'; + break; + case 'b': + ch = '\b'; + break; + case '\\': + default: + break; + } } + else + break; + } *dst++ = ch; } diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 2a6e1d33ee..02bac9b290 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -938,6 +938,32 @@ static void hb_pp_getLine( PHB_PP_STATE pState ) else ++ul; } +#ifndef HB_C52_STRICT + else if( ( ch == 'e' || ch == 'E' ) && ulLen > 1 && + pBuffer[ 1 ] == '"' ) + { + ULONG ulStrip; + ++ul; + while( ++ul < ulLen && pBuffer[ ul ] != '"' ) + { + if( pBuffer[ ul ] == '\\' && ulLen - ul > 1 ) + ++ul; + } + ulStrip = ul - 2; + hb_strRemEscSeq( pBuffer + 2, &ulStrip ); + hb_pp_tokenAddNext( pState, pBuffer + 2, ulStrip, + HB_PP_TOKEN_STRING ); + if( ul == ulLen ) + { + ULONG ulSkip = pBuffer - hb_membufPtr( pState->pBuffer ); + hb_membufAddCh( pState->pBuffer, '\0' ); + pBuffer = hb_membufPtr( pState->pBuffer ) + ulSkip; + hb_pp_error( pState, 'E', HB_PP_ERR_STRING_TERMINATOR, pBuffer + 1 ); + } + else + ++ul; + } +#endif else if( ch == '[' && !pState->fDirective && hb_pp_canQuote( pState->fCanNextLine || HB_PP_TOKEN_CANQUOTE( pState->iLastType ),