Bug in IsOem()/IsAnsi() function

Bug in IsOem()/IsAnsi() function

Postby Enrico Maria Giordano » Tue Feb 28, 2006 4:33 pm

The following sample shows .T. and .F. instead of .F. and .T. (CHR( 128 ) is the Euro symbol and is an ANSI code):

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    ? ISOEM( CHR( 128 ) )
    ? ISANSI( CHR( 128 ) )

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Wed Mar 01, 2006 7:45 am

Enrico,

In source\winapi\oemansi.c please implement these changes:
Code: Select all  Expand view  RUN
CLIPPER ISANSI( PARAMS )         // cString    --> lAnsi
{
   LPBYTE pString = ( LPBYTE ) _parc( 1 );
   WORD  w = 0, wLen = _parclen( 1 );
   BOOL  bAnsi = FALSE;

   while( w < wLen && ! bAnsi )
   {
      bAnsi = ( pString[ w ] >= 224 && pString[ w ] <= 255 ) || pString[ w ] == 128;
      w++;
   }

   _retl( bAnsi );
}

//----------------------------------------------------------------------------//

CLIPPER ISOEM( PARAMS )         // cString    --> lOem
{
   LPBYTE pString = ( LPBYTE ) _parc( 1 );
   WORD  w = 0, wLen = _parclen( 1 );
   BOOL  bOem = FALSE;

   while( w < wLen && ! bOem )
   {
      bOem = pString[ w ] > 128 && pString[ w ] <= 168;
      w++;
   }

   _retl( bOem );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Wed Mar 01, 2006 8:24 am

Thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests