diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3ab1fec4e3..fc27ab453c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +19991006-18:34 GMT+1 Victor Szel + * source/rtl/filesys.c + include/hbdefs.h + ! BIN2I() sign bug fixed + Thanks to gjd@casema.net + * source/rtl/dummy.prg + ! Fixed some return values. + 19991006-11:20 EDT David G. Holm * config/os2/icc.cf diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 123b381a0e..0716e7e9be 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -93,25 +93,28 @@ typedef unsigned long ULONG; #endif /* __IBMCPP__ */ #ifndef MAX -#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) + #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN -#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) + #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef LOBYTE -#define LOBYTE( w ) ( ( BYTE ) ( w ) ) + #define LOBYTE( w ) ( ( BYTE ) ( w ) ) #endif #ifndef HIBYTE -#define HIBYTE( w ) ( ( BYTE ) ( ( ( USHORT ) ( w ) >> 8 ) & 0xFF ) ) + #define HIBYTE( w ) ( ( BYTE ) ( ( ( USHORT ) ( w ) >> 8 ) & 0xFF ) ) #endif -#ifndef MKINT -#define MKINT( b1, b2 ) ( ( int ) ( ( ( int ) b2 ) << 8 ) | b1 ) +#ifndef MKSHORT + #define MKSHORT( b1, b2 ) ( ( SHORT ) ( ( ( SHORT ) b2 ) << 8 ) | b1 ) +#endif +#ifndef MKUSHORT + #define MKUSHORT( b1, b2 ) ( ( USHORT ) ( ( ( USHORT ) b2 ) << 8 ) | b1 ) #endif #ifndef MKLONG -#define MKLONG( b1, b2, b3, b4 ) ( ( ( long ) b4 ) << 24 ) | \ - ( ( ( long ) b3 ) << 16 ) | \ - ( ( ( long ) b2 ) << 8 ) | b1 + #define MKLONG( b1, b2, b3, b4 ) ( ( ( long ) b4 ) << 24 ) | \ + ( ( ( long ) b3 ) << 16 ) | \ + ( ( ( long ) b2 ) << 8 ) | b1 #endif #define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol diff --git a/harbour/source/rtl/dummy.prg b/harbour/source/rtl/dummy.prg index c0813681b4..2f2ecd8cfd 100644 --- a/harbour/source/rtl/dummy.prg +++ b/harbour/source/rtl/dummy.prg @@ -35,7 +35,7 @@ /* TODO: Dummy functions, should be removed when implemented. */ -FUNCTION ordBagExt() ; RETURN "" +FUNCTION ordBagExt() ; RETURN ".ntx" FUNCTION ordBagName() ; RETURN "" FUNCTION ordCondSet() ; RETURN NIL FUNCTION ordCreate() ; RETURN NIL @@ -95,11 +95,11 @@ FUNCTION ReadKey() ; RETURN 0 FUNCTION GetActive() ; RETURN NIL FUNCTION GetApplyKey() ; RETURN NIL FUNCTION GetDoSetKey() ; RETURN NIL -FUNCTION GetPostValidate() ; RETURN NIL -FUNCTION GetPreValidate() ; RETURN NIL +FUNCTION GetPostValidate() ; RETURN .T. +FUNCTION GetPreValidate() ; RETURN .T. FUNCTION GetReader() ; RETURN NIL -FUNCTION ReadFormat() ; RETURN NIL -FUNCTION ReadKill() ; RETURN NIL +FUNCTION ReadFormat() ; RETURN .F. +FUNCTION ReadKill() ; RETURN .F. FUNCTION ReadUpdated() ; RETURN .T. FUNCTION Updated() ; RETURN .T. diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 34b0db6768..a3483f59ea 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1351,6 +1351,26 @@ HARBOUR HB_DISKNAME( void ) s_uiErrorLast = uiErrorOld; } +HARBOUR HB_BIN2W( void ) +{ + PHB_ITEM pItem = hb_param( 1, IT_STRING ); + + if( pItem ) + { + char * pszString = hb_itemGetCPtr( pItem ); + ULONG ulLen = hb_itemGetCLen( pItem ); + BYTE byBuffer[ 2 ]; + + byBuffer[ 0 ] = ( ulLen >= 1 ) ? ( BYTE ) pszString[ 0 ] : 0; + byBuffer[ 1 ] = ( ulLen >= 2 ) ? ( BYTE ) pszString[ 1 ] : 0; + + hb_retni( MKUSHORT( byBuffer[ 0 ], + byBuffer[ 1 ] ) ); + } + else + hb_retni( 0 ); +} + HARBOUR HB_BIN2I( void ) { PHB_ITEM pItem = hb_param( 1, IT_STRING ); @@ -1364,8 +1384,8 @@ HARBOUR HB_BIN2I( void ) byBuffer[ 0 ] = ( ulLen >= 1 ) ? ( BYTE ) pszString[ 0 ] : 0; byBuffer[ 1 ] = ( ulLen >= 2 ) ? ( BYTE ) pszString[ 1 ] : 0; - hb_retni( MKINT( byBuffer[ 0 ], - byBuffer[ 1 ] ) ); + hb_retni( MKSHORT( byBuffer[ 0 ], + byBuffer[ 1 ] ) ); } else hb_retni( 0 ); @@ -1395,11 +1415,6 @@ HARBOUR HB_BIN2L( void ) hb_retnl( 0 ); } -HARBOUR HB_BIN2W( void ) -{ - HB_BIN2I(); -} - HARBOUR HB_I2BIN( void ) { char szString[ 2 ];