diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6ce78951d6..4f1b870247 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,13 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-12 14:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbwinuni.h + ! fixed typo in last commit + + * harbour/contrib/hbwin/win_com.c + * eliminated HB_TCHAR_*() usage + 2009-12-12 10:45 UTC-0300 Antonio Carlos Pantaglione + harbour/contrib/hbwin/mapi.c + harbour/contrib/hbwin/tests/testmapi.prg diff --git a/harbour/contrib/hbwin/win_com.c b/harbour/contrib/hbwin/win_com.c index d83193b252..f41941dd1c 100644 --- a/harbour/contrib/hbwin/win_com.c +++ b/harbour/contrib/hbwin/win_com.c @@ -81,21 +81,32 @@ HB_FUNC( WIN_COMOPEN ) int iParity = hb_parni( 3 ); int iByteSize = hb_parni( 4 ); int iStopBits = hb_parni( 5 ); - - char szName[ 11 ]; - TCHAR tszName[ 11 ]; + int iPos, i; HANDLE hCommPort; DCB NewDCB; - hb_snprintf( szName, sizeof( szName ), "\\\\.\\COM%d", iPort + 1 ); - HB_TCHAR_CPTO( tszName, szName, sizeof( tszName ) - 1 ); + TCHAR szName[ 11 ] = { '\\', '\\', '.', '\\', 'C', 'O', 'M', 0, 0, 0, 0 }; + + i = iPort + 1; + iPos = 6; + while( i > 0 ) + { + iPos++; + i /= 10; + } + i = iPort + 1; + while( i > 0 ) + { + szName[ iPos-- ] = ( TCHAR ) ( i % 10 + '0' ); + i /= 10; + } s_PortData[ iPort ].hPort = INVALID_HANDLE_VALUE; s_PortData[ iPort ].iFunction = WIN_COM_FUN_CREATEFILE; s_PortData[ iPort ].dwError = 0; - if( ( hCommPort = CreateFile( tszName, + if( ( hCommPort = CreateFile( szName, GENERIC_READ | GENERIC_WRITE, 0, NULL, diff --git a/harbour/include/hbwinuni.h b/harbour/include/hbwinuni.h index f7a6174e54..d261f61223 100644 --- a/harbour/include/hbwinuni.h +++ b/harbour/include/hbwinuni.h @@ -82,8 +82,8 @@ #define HB_ARRAYSETSTR( arr, n, str ) hb_arraySetStr( arr, n, hb_setGetOSCP(), str ) #define HB_ARRAYSETSTRLEN( arr, n, str, len ) hb_arraySetStrLen( arr, n, hb_setGetOSCP(), str, len ) #define HB_ITEMGETSTR( itm, phstr, plen ) hb_itemGetStr( itm, hb_setGetOSCP(), phstr, plen ) - #define HB_ITEMPUTSTR( p, str ) hb_itemPutStr( itm, hb_setGetOSCP(), str ) - #define HB_ITEMPUTSTRLEN( p, str, len ) hb_itemPutStrLen( itm, hb_setGetOSCP(), str, len ) + #define HB_ITEMPUTSTR( itm, str ) hb_itemPutStr( itm, hb_setGetOSCP(), str ) + #define HB_ITEMPUTSTRLEN( itm, str, len ) hb_itemPutStrLen( itm, hb_setGetOSCP(), str, len ) #define HB_STRUNSHARE( h, str, len ) hb_strunshare( h, str, len ) #endif