2015-02-09 00:22 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/rtl/hardcr.c
    ! fixed HardCR() to work with codepages using custom character encoding
      in which SoftCR can be part of valid character, i.e. UTF8.

  * ChangeLog.txt
    * typos in prev my entry
This commit is contained in:
Przemysław Czerpak
2015-02-09 00:22:36 +01:00
parent 0c1c2ab698
commit 2c23828109
2 changed files with 36 additions and 6 deletions

View File

@@ -10,6 +10,14 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2015-02-09 00:22 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/hardcr.c
! fixed HardCR() to work with codepages using custom character encoding
in which SoftCR can be part of valid character, i.e. UTF8.
* ChangeLog.txt
* typos in prev my entry
2015-02-08 23:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/vm/hvm.c
@@ -19,7 +27,7 @@
* include/hbexprb.c
% replace {|e| Break( e ) } with __BreakBlock() function call.
__BreakBlock() returns exactly the same codeblock on each call
so using it save memory and improve a little bit speed because
so using it saves memory and improves a little bit speed because
it's not necessary to allocate new GC memory block and register
it in GC block list. Additionally in MT mode it eliminates mutex
lock necessary to register new GC block.

View File

@@ -48,22 +48,44 @@
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapicdp.h"
static char * hb_strHardCR( char * pszString, HB_SIZE nStringLen )
{
HB_SIZE nStringPos;
PHB_CODEPAGE cdp;
HB_TRACE( HB_TR_DEBUG, ( "hb_strHardCR(%s, %" HB_PFS "u)", pszString, nStringLen ) );
for( nStringPos = 0; nStringPos < nStringLen; nStringPos++ )
cdp = hb_vmCDP();
if( HB_CDP_ISCUSTOM( cdp ) )
{
if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
HB_WCHAR wc;
nStringPos = 0;
while( nStringPos < nStringLen )
{
pszString[ nStringPos ] = HB_CHAR_HARD1;
if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
{
pszString[ nStringPos ] = HB_CHAR_HARD1;
nStringPos += 2;
}
else if( ! HB_CDPCHAR_GET( cdp, pszString, nStringLen, &nStringPos, &wc ) )
break;
}
}
else
{
for( nStringPos = 0; nStringPos < nStringLen; nStringPos++ )
{
if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
{
pszString[ nStringPos++ ] = HB_CHAR_HARD1;
}
}
}
return pszString;
}