2010-01-22 17:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/vm/strapi.c
   * allow to pass NULL as item pointer in hb_item{Get,Copy}Str*() functions
   * updated hb_itemCopyStr*() functions to set '\0' in the buffer if not
     string item is passed as parameter
   * updated hb_itemCopyStr to return number of characters which could be
     stored in buffer if buffer when passed buffer is NULL and its size is 0
     Now all hb_itemCopyStr*() functions can be used to retirve the size in
     character of destination string by:
         ulSize = hb_itemCopyStr*( pItem ..., NULL, 0 )

  * harbour/contrib/hbnetio/netiocli.c
    * simplified the code by removing one unnecessary protection

  * harbour/contrib/xhb/xhw32prn.prg
    ! fixed stupid typo in method redirecting:
      :StartPage() was redirected to :Create() and :Create() was
      redirected to :StartPage()
This commit is contained in:
Przemyslaw Czerpak
2010-01-22 16:49:28 +00:00
parent b6fbba81d8
commit 492f8fb1fd
4 changed files with 48 additions and 26 deletions

View File

@@ -17,6 +17,25 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-22 17:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/vm/strapi.c
* allow to pass NULL as item pointer in hb_item{Get,Copy}Str*() functions
* updated hb_itemCopyStr*() functions to set '\0' in the buffer if not
string item is passed as parameter
* updated hb_itemCopyStr to return number of characters which could be
stored in buffer if buffer when passed buffer is NULL and its size is 0
Now all hb_itemCopyStr*() functions can be used to retirve the size in
character of destination string by:
ulSize = hb_itemCopyStr*( pItem ..., NULL, 0 )
* harbour/contrib/hbnetio/netiocli.c
* simplified the code by removing one unnecessary protection
* harbour/contrib/xhb/xhw32prn.prg
! fixed stupid typo in method redirecting:
:StartPage() was redirected to :Create() and :Create() was
redirected to :StartPage()
2010-01-22 17:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/hbwapi.h
* contrib/hbwin/wapi_wingdi.c

View File

@@ -658,7 +658,6 @@ HB_FUNC( NETIO_DECODE )
const char * pszFullName = hb_parc( 1 );
const char * pszServer, * pszPasswd, * pszFile;
int iPort, iTimeOut, iPassLen, iLevel, iStrategy;
HB_BOOL fResult;
pszServer = hb_parc( 2 );
iPort = hb_parni( 3 );
@@ -683,20 +682,13 @@ HB_FUNC( NETIO_DECODE )
hb_storclen( pszPasswd, iPassLen, 5 );
hb_storni( iLevel, 6 );
hb_storni( iStrategy, 7 );
if( pszFile != pszFullName )
/* the order is important and 1-st parameter
* should be assigned at the end
*/
hb_storc( pszFile, 1 );
fResult = pszFile != pszFullName;
if( fResult && HB_ISBYREF( 1 ) )
{
if( * pszFile )
{
char * pszFileName = hb_strdup( pszFile );
if( !hb_storclen_buffer( pszFileName, strlen( pszFileName ), 1 ) )
hb_xfree( pszFileName );
}
else
hb_storc( NULL, 1 );
}
hb_retl( fResult );
hb_retl( pszFile != pszFullName );
}
/* NETIO_CONNECT( [<cServer>], [<nPort>], [<nTimeOut>], ;

View File

@@ -87,13 +87,13 @@ CREATE CLASS WIN32PRN FROM WIN_PRN
ENDCLASS
METHOD StartPage() CLASS WIN32PRN
METHOD Create() CLASS WIN32PRN
IF ::PaperLength > 0 .AND. ::PaperWidth > 0
::FormType := FORM_CUSTOM
ENDIF
RETURN ::WIN_PRN:Create()
METHOD Create() CLASS WIN32PRN
METHOD StartPage() CLASS WIN32PRN
IF ::PaperLength > 0 .AND. ::PaperWidth > 0
::FormType := FORM_CUSTOM
ENDIF

View File

@@ -222,7 +222,7 @@ const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZ
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStr(%p,%p,%p,%p)", pItem, cdp, phString, pulLen));
if( HB_IS_STRING( pItem ) )
if( pItem && HB_IS_STRING( pItem ) )
{
const char * pString;
char * pFree = NULL;
@@ -255,7 +255,7 @@ const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pulL
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrUTF8(%p,%p,%p)", pItem, phString, pulLen));
if( HB_IS_STRING( pItem ) )
if( pItem && HB_IS_STRING( pItem ) )
{
PHB_CODEPAGE cdp = hb_vmCDP();
HB_SIZE ulLen = hb_cdpStrAsUTF8Len( cdp, HB_FALSE,
@@ -296,7 +296,7 @@ const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian,
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrU16(%p,%d,%p,%p)", pItem, iEndian, phString, pulLen));
if( HB_IS_STRING( pItem ) )
if( pItem && HB_IS_STRING( pItem ) )
{
HB_WCHAR * pszU16;
PHB_CODEPAGE cdp = hb_vmCDP();
@@ -333,13 +333,20 @@ HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE u
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStr(%p,%p,%p,%lu)", pItem, cdp, pStrBuffer, ulSize));
if( HB_IS_STRING( pItem ) )
if( pItem && HB_IS_STRING( pItem ) )
{
return hb_cdpTransTo( pItem->item.asString.value,
pItem->item.asString.length,
pStrBuffer, ulSize,
hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
if( pStrBuffer )
return hb_cdpTransTo( pItem->item.asString.value,
pItem->item.asString.length,
pStrBuffer, ulSize,
hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
else
return hb_cdpnDup2Len( pItem->item.asString.value,
pItem->item.asString.length,
ulSize, hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
}
else if( pStrBuffer && ulSize )
pStrBuffer[ 0 ] = '\0';
return 0;
}
@@ -348,7 +355,7 @@ HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE ulSize )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrUTF8(%p,%p,%lu)", pItem, pStrBuffer, ulSize));
if( HB_IS_STRING( pItem ) )
if( pItem && HB_IS_STRING( pItem ) )
{
if( pStrBuffer )
ulSize = hb_cdpStrToUTF8( hb_vmCDP(), HB_FALSE,
@@ -361,6 +368,8 @@ HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE ulSize )
pItem->item.asString.length, ulSize );
return ulSize;
}
else if( pStrBuffer && ulSize )
pStrBuffer[ 0 ] = '\0';
return 0;
}
@@ -370,7 +379,7 @@ HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, H
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrU16(%p,%d,%p,%lu)", pItem, iEndian, pStrBuffer, ulSize));
if( HB_IS_STRING( pItem ) && ulSize )
if( pItem && HB_IS_STRING( pItem ) )
{
if( pStrBuffer )
ulSize = hb_cdpStrToU16( hb_vmCDP(), HB_FALSE, iEndian,
@@ -383,6 +392,8 @@ HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, H
pItem->item.asString.length, ulSize );
return ulSize;
}
else if( pStrBuffer && ulSize )
pStrBuffer[ 0 ] = '\0';
return 0;
}