2013-08-22 19:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbct/getsecrt.prg
! applied Clipper compatibility fix to GetSecret() by Pavel Tsarenko
* src/common/hbdate.c
* removed explicit _BSD_SOURCE definition - it was confusing our
code used to detect localtime_r() support and is not necessary
if we do not use extended fields of tm structure
* src/rtl/mtran.c
* updated to show strict Clipper compatible behavior - Clipper
ignores 3-rd cSoftCR parameter if 2-nd one cHardCR is not given
(strict compatibility is covered by HB_CLP_STRICT macro and
disabled by default - undocumented feature which may confuse
users)
% minor optimization
This commit is contained in:
@@ -10,6 +10,23 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2013-08-22 19:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbct/getsecrt.prg
|
||||
! applied Clipper compatibility fix to GetSecret() by Pavel Tsarenko
|
||||
|
||||
* src/common/hbdate.c
|
||||
* removed explicit _BSD_SOURCE definition - it was confusing our
|
||||
code used to detect localtime_r() support and is not necessary
|
||||
if we do not use extended fields of tm structure
|
||||
|
||||
* src/rtl/mtran.c
|
||||
* updated to show strict Clipper compatible behavior - Clipper
|
||||
ignores 3-rd cSoftCR parameter if 2-nd one cHardCR is not given
|
||||
(strict compatibility is covered by HB_CLP_STRICT macro and
|
||||
disabled by default - undocumented feature which may confuse
|
||||
users)
|
||||
% minor optimization
|
||||
|
||||
2013-08-20 17:32 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/gtqtc/gtqtc1.cpp
|
||||
* accept META key as CTRL key in MacOSX builds.
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
#include "getexit.ch"
|
||||
#include "setcurs.ch"
|
||||
#include "inkey.ch"
|
||||
|
||||
FUNCTION GetSecret( cVar, nRow, nCol, lSay, xPrompt )
|
||||
|
||||
@@ -136,10 +137,18 @@ STATIC PROCEDURE _SECRET( _cGetSecret, lHide, oGet, oGetList )
|
||||
oGetList:ReadVar() )
|
||||
lHide := .T.
|
||||
LOOP
|
||||
ELSEIF nKey == K_BS
|
||||
IF oGet:pos > 1
|
||||
_cGetSecret := Padr( Left( _cGetSecret, oGet:pos - 2 ) + ;
|
||||
Substr( _cGetSecret, oGet:pos ), nLen )
|
||||
ENDIF
|
||||
ELSEIF nKey == K_DEL
|
||||
_cGetSecret := Padr( Left( _cGetSecret, oGet:pos - 1 ) + ;
|
||||
Substr( _cGetSecret, oGet:pos + 1 ), nLen )
|
||||
ELSEIF ! ( cKey := hb_keyChar( nKey ) ) == ""
|
||||
IF Set( _SET_INSERT )
|
||||
_cGetSecret := Stuff( Left( _cGetSecret, nLen - 1 ), ;
|
||||
oGet:pos, 0, cKey )
|
||||
oGet:pos, 0, cKey )
|
||||
ELSE
|
||||
_cGetSecret := Stuff( _cGetSecret, oGet:pos, 1, cKey )
|
||||
ENDIF
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _BSD_SOURCE
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbdate.h"
|
||||
#if defined( HB_LONG_LONG_OFF )
|
||||
|
||||
@@ -51,25 +51,25 @@
|
||||
|
||||
/* NOTE: pszResult must have an allocated buffer of at least nStringLen */
|
||||
|
||||
static char * hb_strMemotran( char * pszResult, HB_SIZE * pnResultLen, const char * pszString, HB_SIZE nStringLen, char cHardcr, char cSoftcr )
|
||||
HB_SIZE hb_strMemotran( char * pszResult, const char * pszString, HB_SIZE nStringLen, char cHardCR, char cSoftCR )
|
||||
{
|
||||
HB_SIZE nStringPos = 0;
|
||||
HB_SIZE nResultPos = 0;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %p, %s, %" HB_PFS "u, %x, %x)", pszResult, pnResultLen, pszString, nStringLen, cHardcr, cSoftcr ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %p, %s, %" HB_PFS "u, %x, %x)", pszResult, pnResultLen, pszString, nStringLen, cHardCR, cSoftCR ) );
|
||||
|
||||
while( nStringPos < nStringLen )
|
||||
{
|
||||
if( pszString[ nStringPos ] == HB_CHAR_HARD1 &&
|
||||
pszString[ nStringPos + 1 ] == HB_CHAR_HARD2 )
|
||||
{
|
||||
pszResult[ nResultPos++ ] = cHardcr;
|
||||
pszResult[ nResultPos++ ] = cHardCR;
|
||||
nStringPos += 2;
|
||||
}
|
||||
else if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
|
||||
{
|
||||
pszResult[ nResultPos++ ] = cSoftcr;
|
||||
pszResult[ nResultPos++ ] = cSoftCR;
|
||||
nStringPos += 2;
|
||||
}
|
||||
else
|
||||
@@ -78,9 +78,7 @@ static char * hb_strMemotran( char * pszResult, HB_SIZE * pnResultLen, const cha
|
||||
|
||||
pszResult[ nResultPos ] = '\0';
|
||||
|
||||
*pnResultLen = nResultPos;
|
||||
|
||||
return pszResult;
|
||||
return nResultPos;
|
||||
}
|
||||
|
||||
HB_FUNC( MEMOTRAN )
|
||||
@@ -89,13 +87,29 @@ HB_FUNC( MEMOTRAN )
|
||||
|
||||
if( pString )
|
||||
{
|
||||
char * pszResult = ( char * ) hb_xgrab( hb_itemGetCLen( pString ) + 1 );
|
||||
char cHardcr = HB_ISCHAR( 2 ) ? *hb_parc( 2 ) : ';';
|
||||
char cSoftcr = HB_ISCHAR( 3 ) ? *hb_parc( 3 ) : ' ';
|
||||
HB_SIZE nResultLen;
|
||||
HB_SIZE nLen = hb_itemGetCLen( pString );
|
||||
char * pszResult = ( char * ) hb_xgrab( nLen + 1 );
|
||||
const char * pszRepl;
|
||||
char cHardCR = ';';
|
||||
char cSoftCR = ' ';
|
||||
|
||||
hb_strMemotran( pszResult, &nResultLen, hb_itemGetCPtr( pString ), hb_itemGetCLen( pString ), cHardcr, cSoftcr );
|
||||
hb_retclen_buffer( pszResult, nResultLen );
|
||||
pszRepl = hb_parc( 2 );
|
||||
if( pszRepl )
|
||||
cHardCR = *pszRepl;
|
||||
|
||||
/* CA-Cl*pper checks 3-rd cSoftCR parameter only
|
||||
* if 2-nd one cHardCR is specified [druzus]
|
||||
*/
|
||||
#ifdef HB_CLP_STRICT
|
||||
if( pszRepl )
|
||||
#endif
|
||||
pszRepl = hb_parc( 3 );
|
||||
if( pszRepl )
|
||||
cSoftCR = *pszRepl;
|
||||
|
||||
nLen = hb_strMemotran( pszResult, hb_itemGetCPtr( pString ), nLen,
|
||||
cHardCR, cSoftCR );
|
||||
hb_retclen_buffer( pszResult, nLen );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
|
||||
Reference in New Issue
Block a user