From 57eabfaa877755fe6d8be135745ce51c70ee93a6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 9 Jan 2012 13:41:32 +0000 Subject: [PATCH] 2012-01-09 14:41 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/rdd/dbf1.c ! fixed default initialization value in UNICODE fields after APPEND BLANK. Many thanks to Phil Krylov for information about the problem and patch. The fix I committed is slightly different just to follow idea of this code. --- harbour/ChangeLog | 7 +++++++ harbour/src/rdd/dbf1.c | 26 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f53804e4c3..bf1156856a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,13 @@ The license applies to all entries newer than 2009-04-28. */ +2012-01-09 14:41 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/src/rdd/dbf1.c + ! fixed default initialization value in UNICODE fields after + APPEND BLANK. Many thanks to Phil Krylov for information about + the problem and patch. The fix I committed is slightly different + just to follow idea of this code. + 2012-01-06 16:13 UTC+0100 Viktor Szakats (harbour syenar.net) * ChangeLog * (whole tree) diff --git a/harbour/src/rdd/dbf1.c b/harbour/src/rdd/dbf1.c index c233bb595e..741a245729 100644 --- a/harbour/src/rdd/dbf1.c +++ b/harbour/src/rdd/dbf1.c @@ -230,11 +230,15 @@ static void hb_dbfSetBlankRecord( DBFAREAP pArea, int iType ) bNext = uiLen == 8 ? ' ' : '\0'; break; - case HB_FT_STRING: case HB_FT_LOGICAL: bNext = ' '; break; + case HB_FT_STRING: + bNext = ( pField->uiFlags & HB_FF_UNICODE ) != 0 ? + HB_BLANK_UNISPACE : ' '; + break; + case HB_FT_LONG: case HB_FT_FLOAT: if( pField->uiFlags & HB_FF_AUTOINC ) @@ -291,20 +295,24 @@ static void hb_dbfSetBlankRecord( DBFAREAP pArea, int iType ) } else { - if( bFill == HB_BLANK_UNISPACE ) + if( nSize ) { - HB_SIZE n; - for( n = 0; n < nSize; n += 2 ) - HB_PUT_LE_UINT16( &pPtr[ n ], ' ' ); - } - else memset( pPtr, bFill, nSize ); - pPtr += nSize; - nSize = 0; + pPtr += nSize; + nSize = 0; + } if( bNext == HB_BLANK_SKIP ) { pPtr += uiLen; } + else if( bNext == HB_BLANK_UNISPACE ) + { + while( uiLen-- ) + { + HB_PUT_LE_UINT16( pPtr, 0x0020 ); + pPtr += 2; + } + } else if( bNext == HB_BLANK_AUTOINC ) { HB_MAXINT nValue = hb_dbfGetNextValue( pArea, uiCount );