On Mon, 17 Aug 2009, Itamar Lins wrote:
> I found the problem.
> Colision again Hwgui function.
> Piece of code hwgui\source\drawtext.c
> #ifndef __XHARBOUR__
> HB_FUNC( OEMTOANSI )
> {
>    char *buffer = hb_parc( 1 );
>    OemToChar( buffer, buffer );
>    hb_retc( buffer );
> }
> HB_FUNC( ANSITOOEM )
> {
>    char *buffer = hb_parc( 1 );
>    CharToOem( buffer, buffer );
>    hb_retc( buffer );
> }
> #else
> HB_FUNC( OEMTOANSI )
> {
>    PHB_ITEM pString = hb_param( 1, HB_IT_STRING );
> 
>    if( pString )
>    {
>       DWORD ulLen = pString->item.asString.length;
>       char *pszDst = ( char * ) hb_xgrab( ulLen + 1 );
> 
>       OemToCharBuff( ( LPCSTR ) pString->item.asString.value,
>             ( LPSTR ) pszDst, ulLen );
> 
>       hb_retclenAdopt( pszDst, ulLen );
>    }
>    else
>    {
>       hb_retc( "" );
>    }
> }
> HB_FUNC( ANSITOOEM )
> {
>    PHB_ITEM pString = hb_param( 1, HB_IT_STRING );
>    if( pString )
> 
>    {
>       DWORD ulLen = pString->item.asString.length;
>       char *pszDst = ( char * ) hb_xgrab( ulLen + 1 );
> 
>       CharToOemBuff( ( LPCSTR ) pString->item.asString.value,
>             ( LPSTR ) pszDst, ulLen );
> 
>       hb_retclenAdopt( pszDst, ulLen );
>    }
>    else
>    {
>       hb_retc( "" );
>    }
> }
> #endif

Both Harbour and xHarbour version of above functions are broken.
Use for this code instead:

   HB_FUNC_EXTERN( HB_OEMTOANSI );
   HB_FUNC_EXTERN( HB_ANSITOOEM );

   HB_FUNC( OEMTOANSI )
   {
      HB_FUNC_EXEC( HB_OEMTOANSI );
   }
   HB_FUNC( ANSITOOEM )
   {
      HB_FUNC_EXEC( HB_ANSITOOEM );
   }

for both compilers. It will fix also UNICODE build problems.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to