diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 50186ce881..987f1aa796 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-31 13:54 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/dynlibhb.c + * harbour/source/common/hbgete.c + * harbour/source/common/hbfsapi.c + * harbour/source/rtl/hbinet.c + * harbour/source/rtl/hbffind.c + * harbour/source/rtl/filesys.c + * harbour/contrib/hbct/files.c + * harbour/contrib/hbmzip/hbmzip.c + * harbour/contrib/hbgf/hbgfos2/os2pm.c + * cleanup casting in OS2 builds (use PCSZ/PSZ) + 2008-10-30 21:24 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/source/rtl/gtwvt/gtwvt.c * harbour/source/rtl/gtwvt/gtwvt.h diff --git a/harbour/contrib/hbct/files.c b/harbour/contrib/hbct/files.c index 252d50a57b..4fd310bebe 100644 --- a/harbour/contrib/hbct/files.c +++ b/harbour/contrib/hbct/files.c @@ -270,7 +270,7 @@ HB_FUNC( SETFDATI ) FILESTATUS3 fs3; APIRET ulrc; - ulrc = DosQueryPathInfo( szFile, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + ulrc = DosQueryPathInfo( ( PCSZ ) szFile, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { FDATE fdate; @@ -304,7 +304,7 @@ HB_FUNC( SETFDATI ) } fs3.fdateCreation = fs3.fdateLastAccess = fs3.fdateLastWrite = fdate; fs3.ftimeCreation = fs3.ftimeLastAccess = fs3.ftimeLastWrite = ftime; - ulrc = DosSetPathInfo( szFile, FIL_STANDARD, + ulrc = DosSetPathInfo( ( PCSZ ) szFile, FIL_STANDARD, &fs3, sizeof( fs3 ), DSPI_WRTTHRU ); } hb_retl( ulrc == NO_ERROR ); diff --git a/harbour/contrib/hbgf/hbgfos2/os2pm.c b/harbour/contrib/hbgf/hbgfos2/os2pm.c index 872d3a638a..597bee2f84 100644 --- a/harbour/contrib/hbgf/hbgfos2/os2pm.c +++ b/harbour/contrib/hbgf/hbgfos2/os2pm.c @@ -107,7 +107,7 @@ MRESULT EXPENTRY WndProc( HWND hWnd, ULONG Msg, MPARAM mp1, MPARAM mp2 ) HB_FUNC( WINREGISTERCLASS ) { hb_retl( WinRegisterClass( hb_pm_GetHab(), /* anchor block handle */ - hb_parc( 1 ), /* Class Name */ + ( PCSZ ) hb_parc( 1 ), /* Class Name */ ( PFNWP ) WndProc, /* default Class procedure */ hb_parnl( 2 ), /* style */ hb_parnl( 3 ) ) ); /* extra bytes */ @@ -140,8 +140,8 @@ HB_FUNC( WINCREATESTDWINDOW ) hb_retnl( (LONG) WinCreateStdWindow( ( HWND ) hb_parnl( 1 ), /* hWndParent */ hb_parnl( 2 ), /* style */ &lFrame, /* lFrame */ - hb_parc( 4 ), /* cClassName */ - hb_parc( 5 ), /* cCaption */ + ( PCSZ ) hb_parc( 4 ), /* cClassName */ + ( PCSZ ) hb_parc( 5 ), /* cCaption */ hb_parnl( 6 ), /* lStyleClient */ hb_parnl( 7 ), /* hModule */ hb_parnl( 8 ), /* nId */ @@ -177,15 +177,15 @@ HB_FUNC( NOR ) HB_FUNC( WINSETWINDOWTEXT ) { - hb_retl( WinSetWindowText( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ) ) ); + hb_retl( WinSetWindowText( ( HWND ) hb_parnl( 1 ), ( PCSZ ) hb_parc( 2 ) ) ); } HB_FUNC( WINGETTEXT ) { - BYTE bBuffer[ 255 ]; + char bBuffer[ 255 ]; - WinQueryWindowText( ( HWND ) hb_parnl( 1 ), sizeof( bBuffer ) - 1, bBuffer ); + WinQueryWindowText( ( HWND ) hb_parnl( 1 ), sizeof( bBuffer ) - 1, ( PSZ ) bBuffer ); hb_retc( bBuffer ); } @@ -193,9 +193,9 @@ HB_FUNC( WINGETTEXT ) HB_FUNC( MSGINFO ) { HWND hWnd = WinQueryActiveWindow( HWND_DESKTOP); - PSZ szCaption = ( hb_pcount() > 1 && ISCHAR( 2 ) ? hb_parc( 2 ) : "Information"); + PCSZ szCaption = ISCHAR( 2 ) ? ( PCSZ ) hb_parc( 2 ) : ( PCSZ ) "Information"; - hb_retnl( WinMessageBox( HWND_DESKTOP, hWnd, hb_parc( 1 ), szCaption, + hb_retnl( WinMessageBox( HWND_DESKTOP, hWnd, ( PCSZ ) hb_parc( 1 ), szCaption, 0, MB_INFORMATION | MB_OK | MB_MOVEABLE | MB_APPLMODAL ) ); } diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index acfef7af50..52ba097ef3 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -744,8 +744,8 @@ static int hb_zipStoreFile( zipFile hZip, const char* szFileName, const char* sz FILESTATUS3 fs3; APIRET ulrc; ULONG ulAttr; - - ulrc = DosQueryPathInfo( szName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + + ulrc = DosQueryPathInfo( ( PCSZ ) szName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { ulAttr = 0; @@ -948,7 +948,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char* szFileName, c { FILETIME ftutc, ft; SYSTEMTIME st; - + st.wSecond = ( WORD ) ufi.tmu_date.tm_sec; st.wMinute = ( WORD ) ufi.tmu_date.tm_min; st.wHour = ( WORD ) ufi.tmu_date.tm_hour; @@ -971,7 +971,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char* szFileName, c { iResult = -200 - hb_fsError(); } - } + } unzCloseCurrentFile( hUnzip ); @@ -1036,7 +1036,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char* szFileName, c APIRET ulrc; ULONG ulAttr = FILE_NORMAL; int iAttr = ufi.external_fa & 0xFF; - + if( iAttr & HB_FA_READONLY ) ulAttr |= FILE_READONLY; if( iAttr & HB_FA_HIDDEN ) @@ -1045,8 +1045,8 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char* szFileName, c ulAttr |= FILE_SYSTEM; if( iAttr & HB_FA_ARCHIVE ) ulAttr |= FILE_ARCHIVED; - - ulrc = DosQueryPathInfo( szName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + + ulrc = DosQueryPathInfo( ( PCSZ ) szName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { FDATE fdate; @@ -1063,7 +1063,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char* szFileName, c fs3.fdateCreation = fs3.fdateLastAccess = fs3.fdateLastWrite = fdate; fs3.ftimeCreation = fs3.ftimeLastAccess = fs3.ftimeLastWrite = ftime; - ulrc = DosSetPathInfo( szName, FIL_STANDARD, + ulrc = DosSetPathInfo( ( PCSZ ) szName, FIL_STANDARD, &fs3, sizeof( fs3 ), DSPI_WRTTHRU ); } } diff --git a/harbour/source/common/hbfsapi.c b/harbour/source/common/hbfsapi.c index b9bb17f7f8..fecbaf8660 100644 --- a/harbour/source/common/hbfsapi.c +++ b/harbour/source/common/hbfsapi.c @@ -319,7 +319,7 @@ HB_EXPORT BOOL hb_fsNameExists( const char * pszFileName ) #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; - fExist = DosQueryPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, + fExist = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ) == NO_ERROR; } #elif defined( HB_OS_UNIX ) @@ -377,7 +377,7 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; - fExist = DosQueryPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, + fExist = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ) == NO_ERROR && ( fs3.attrFile & FILE_DIRECTORY ) == 0; } @@ -436,7 +436,7 @@ HB_EXPORT BOOL hb_fsDirExists( const char * pszDirName ) #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; - fExist = DosQueryPathInfo( ( PSZ ) pszDirName, FIL_STANDARD, + fExist = DosQueryPathInfo( ( PCSZ ) pszDirName, FIL_STANDARD, &fs3, sizeof( fs3 ) ) == NO_ERROR && ( fs3.attrFile & FILE_DIRECTORY ) != 0; } diff --git a/harbour/source/common/hbgete.c b/harbour/source/common/hbgete.c index 6d6eeb1f18..2ec8626ac6 100644 --- a/harbour/source/common/hbgete.c +++ b/harbour/source/common/hbgete.c @@ -90,7 +90,7 @@ char * hb_getenv( const char * szName ) PCSZ EnvValue = ""; #endif - if( DosScanEnv( ( PSZ ) szName, &EnvValue ) == NO_ERROR ) + if( DosScanEnv( ( PCSZ ) szName, &EnvValue ) == NO_ERROR ) pszBuffer = hb_strdup( ( char * ) EnvValue ); } @@ -125,7 +125,7 @@ BOOL hb_getenv_buffer( const char * szName, char * szBuffer, int nSize ) PCSZ EnvValue = ""; #endif - if( DosScanEnv( ( PSZ ) szName, &EnvValue ) == NO_ERROR ) + if( DosScanEnv( ( PCSZ ) szName, &EnvValue ) == NO_ERROR ) { bRetVal = TRUE; if( szBuffer != NULL && nSize != 0 ) diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 60aba63414..1e9c6aab2f 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1054,7 +1054,7 @@ HB_EXPORT BOOL hb_fsGetAttr( BYTE * pszFileName, ULONG * pulAttr ) APIRET ulrc; hb_vmUnlock(); - ulrc = DosQueryPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + ulrc = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { *pulAttr = hb_fsAttrFromRaw( fs3.attrFile ); @@ -1148,7 +1148,7 @@ HB_EXPORT BOOL hb_fsSetFileTime( BYTE * pszFileName, LONG lJulian, LONG lMillise pszFileName = hb_fsNameConv( pszFileName, &fFree ); hb_vmUnlock(); - ulrc = DosQueryPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + ulrc = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { FDATE fdate; @@ -1182,7 +1182,7 @@ HB_EXPORT BOOL hb_fsSetFileTime( BYTE * pszFileName, LONG lJulian, LONG lMillise fs3.fdateCreation = fs3.fdateLastAccess = fs3.fdateLastWrite = fdate; fs3.ftimeCreation = fs3.ftimeLastAccess = fs3.ftimeLastWrite = ftime; - ulrc = DosSetPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, + ulrc = DosSetPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ), DSPI_WRTTHRU ); } fResult = ulrc == NO_ERROR; @@ -1302,11 +1302,11 @@ HB_EXPORT BOOL hb_fsSetAttr( BYTE * pszFileName, ULONG ulAttr ) ulOsAttr |= FILE_ARCHIVED; hb_vmUnlock(); - ulrc = DosQueryPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); + ulrc = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ) ); if( ulrc == NO_ERROR ) { fs3.attrFile = ulOsAttr; - ulrc = DosSetPathInfo( ( PSZ ) pszFileName, FIL_STANDARD, + ulrc = DosSetPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD, &fs3, sizeof( fs3 ), DSPI_WRTTHRU ); } fResult = ulrc == NO_ERROR; diff --git a/harbour/source/rtl/hbffind.c b/harbour/source/rtl/hbffind.c index e573cc3b0f..3db3482cbd 100644 --- a/harbour/source/rtl/hbffind.c +++ b/harbour/source/rtl/hbffind.c @@ -512,7 +512,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) info->hFindFile = HDIR_CREATE; info->findCount = 1; - bFound = DosFindFirst( ffind->pszFileMask, + bFound = DosFindFirst( ( PCSZ ) ffind->pszFileMask, &info->hFindFile, ( LONG ) hb_fsAttrToRaw( ffind->attrmask ), &info->entry, diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index d04c3fc7bc..63ab9ede44 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -225,8 +225,8 @@ * that when you're passing by value. But when you're passing by reference * this creates a gross source incompatibility with existing programs. On * 32-bit architectures it creates only a warning. On 64-bit architectures it - * creates broken code -- because "int *" is a pointer to a 64-bit quantity and - * "size_t *" is frequently a pointer to a 32-bit quantity. + * creates broken code -- because "int *" is a pointer to a 32-bit quantity and + * "size_t *" is frequently a pointer to a 64-bit quantity. * * Some Unixes adopted "size_t *" for the sake of POSIX compliance. Others * ignored it because it was such a broken interface. Chaos ensued. POSIX @@ -1717,13 +1717,7 @@ HB_FUNC( HB_INETACCEPT ) HB_SOCKET_T incoming = 0; int iError = EAGAIN; struct sockaddr_in si_remote; -#if defined(_XOPEN_SOURCE_EXTENDED) socklen_t Len; -#elif defined(HB_OS_WIN_32) - int Len; -#else - unsigned int Len; -#endif if( Socket == NULL ) { @@ -2124,11 +2118,7 @@ HB_FUNC( HB_INETDGRAMRECV ) int iLen, iMaxLen; char *Buffer; BOOL fRepeat; -#if defined(HB_OS_WIN_32) - int iDtLen = sizeof( struct sockaddr ); -#else - socklen_t iDtLen = (socklen_t) sizeof( struct sockaddr ); -#endif + socklen_t iDtLen = ( socklen_t ) sizeof( struct sockaddr ); if( Socket == NULL || pBuffer == NULL || !ISBYREF( 2 ) ) { diff --git a/harbour/source/vm/dynlibhb.c b/harbour/source/vm/dynlibhb.c index cbfd18a9b8..d913312b82 100644 --- a/harbour/source/vm/dynlibhb.c +++ b/harbour/source/vm/dynlibhb.c @@ -101,7 +101,7 @@ HB_FUNC( HB_LIBLOAD ) UCHAR LoadError[256] = ""; /* Area for load failure information */ HMODULE hDynModule; if( DosLoadModule( LoadError, sizeof( LoadError ), - hb_parc( 1 ), &hDynModule ) == NO_ERROR ) + ( PCSZ ) hb_parc( 1 ), &hDynModule ) == NO_ERROR ) hDynLib = ( void * ) hDynModule; } #elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )