2010-02-13 12:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/vm/strapi.c
! fixed hb_[w]strunshare() functions to always clone writable
buffers shared by two or more different objects or items.
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-02-13 12:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/vm/strapi.c
|
||||
! fixed hb_[w]strunshare() functions to always clone writable
|
||||
buffers shared by two or more different objects or items.
|
||||
|
||||
2010-02-13 11:42 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/wapi_winbase.c
|
||||
+ Added WAPI_GETLONGPATHNAME() (same code as the short version)
|
||||
|
||||
@@ -159,12 +159,15 @@ HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE ulLen )
|
||||
if( pStr == NULL || phStr == NULL || *phStr == NULL )
|
||||
return NULL;
|
||||
|
||||
if( *phStr == ( void * ) s_szConstStr && ulLen > 0 )
|
||||
if( ulLen > 0 &&
|
||||
( *phStr == ( void * ) s_szConstStr || hb_xRefCount( *phStr ) > 1 ) )
|
||||
{
|
||||
HB_WCHAR * pszDest = ( HB_WCHAR * ) hb_xgrab( ( ulLen + 1 ) *
|
||||
sizeof( HB_WCHAR ) );
|
||||
memcpy( pszDest, pStr, ulLen * sizeof( HB_WCHAR ) );
|
||||
pszDest[ ulLen ] = 0;
|
||||
if( *phStr != ( void * ) s_szConstStr )
|
||||
hb_xRefDec( *phStr );
|
||||
* phStr = ( void * ) pszDest;
|
||||
|
||||
return pszDest;
|
||||
@@ -180,11 +183,14 @@ char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE ulLen )
|
||||
if( pStr == NULL || phStr == NULL || *phStr == NULL )
|
||||
return NULL;
|
||||
|
||||
if( *phStr == ( void * ) s_szConstStr && ulLen > 0 )
|
||||
if( ulLen > 0 &&
|
||||
( *phStr == ( void * ) s_szConstStr || hb_xRefCount( *phStr ) > 1 ) )
|
||||
{
|
||||
char * pszDest = ( char * ) hb_xgrab( ( ulLen + 1 ) * sizeof( char ) );
|
||||
memcpy( pszDest, pStr, ulLen * sizeof( char ) );
|
||||
pszDest[ ulLen ] = 0;
|
||||
if( *phStr != ( void * ) s_szConstStr )
|
||||
hb_xRefDec( *phStr );
|
||||
* phStr = ( void * ) pszDest;
|
||||
|
||||
return pszDest;
|
||||
|
||||
Reference in New Issue
Block a user