2015-10-13 21:22 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/rtl/mlcfunc.c
    ! do not access trailing 0 byte in empty strings passed to hb_MLEval()
      (thanks to Abe for information and example illustrating the problem)
    * respect in return value also empty line after last EOL
This commit is contained in:
Przemysław Czerpak
2015-10-13 21:22:30 +02:00
parent d3c36b080c
commit f3fdf11830
2 changed files with 14 additions and 8 deletions

View File

@@ -10,6 +10,12 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2015-10-13 21:22 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/mlcfunc.c
! do not access trailing 0 byte in empty strings passed to hb_MLEval()
(thanks to Abe for information and example illustrating the problem)
* respect in return value also empty line after last EOL
2015-10-13 15:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/memoedit.prg
* always returned reformatted string after CTRL+W even if user has not

View File

@@ -590,7 +590,7 @@ HB_FUNC( HB_MLEVAL )
fSoftCR = fEOL = HB_FALSE;
++nLines;
do
while( ! fSoftCR && nOffset < nLen )
{
HB_SIZE nRepl;
HB_WCHAR ch;
@@ -667,7 +667,6 @@ HB_FUNC( HB_MLEVAL )
break;
}
}
while( ! fSoftCR && nOffset < nLen );
if( nRowPos == 0 && nOffset >= nPos && ! fSoftCR )
{
@@ -681,19 +680,20 @@ HB_FUNC( HB_MLEVAL )
}
while( nOffset < nLen && hb_vmRequestQuery() == 0 );
if( nRowPos == 0 && nOffset >= nPos )
{
nRowPos = nLines + 1;
nColPos = 0;
}
if( fSoftCR || fEOL )
{
++nLines;
pLineItem = hb_itemPutC( pLineItem, NULL );
pSoftItem = hb_itemPutL( pSoftItem, HB_FALSE );
hb_vmEvalBlockV( pBlock, 2, pLineItem, pSoftItem );
}
if( nRowPos == 0 && nOffset >= nPos )
{
nRowPos = nLines;
nColPos = 0;
}
hb_itemRelease( pLineItem );
hb_itemRelease( pSoftItem );
hb_xfree( pszLine );