diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7daa23e0a8..8763ee8937 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,53 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-01 22:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbziparch/hbzipnew.cpp + ! Fixed a potential GPFs. (GCC warnings) + + * contrib/hbpgsql/postgres.c + * contrib/hbwhat32/_wininet.c + ! Fixed two const casting warnings in MSVS non-CPP mode. + + - tests/run_test.bat + + tests/run_prg_all.bat + - tests/gnu_test.bat + + tests/bld_gnu.bat + - tests/bld4dll.bat + + tests/bld_b32_dll.bat + + Some renames in the hope they will be easier to + understand, and more standard. + ! Fixed .dll reference. + + * contrib/hbziparch/Makefile + ! Excluded from Darwin and OS/2 builds. + + ; NOTE: The Windows build I've tried are now building relatively + clearly, only with the 1) known warnings 2) warnings in + foreign code, plus 3) quite some in contrib/hbwhat32. + + Tested compilers: + Win32 + BCC551 - OK + BCC582 - OK + MSVS2005 - OK (doesn't work with set HB_BUILD_DLL=yes) + MSVS2005cpp - OK (doesn't work with set HB_BUILD_DLL=yes) + MSVS2008 - OK (doesn't work with set HB_BUILD_DLL=yes) + MSVS2008cpp - OK (doesn't work with set HB_BUILD_DLL=yes) + MinGW412 - OK + MinGW430 + Win64 + MSVS2008 + Fails with: + 'include\hbinit.h(218) : fatal error C1189: #error : Unknown initialization method. + MSVS2008cpp - OK (doesn't work with set HB_BUILD_DLL=yes) + Linux-Ubuntu (7.10) + GCC413 - OK (FreeImage f.e. fails.) + Darwin (OS X Leopard 10.5.4) + GCC401 + Fails with a lot of: + 'Wrong type of codeblock parameter, is: 1, should be: 8' + 2008-07-01 22:10 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/gtwvt/gtwvt.c * contrib/gtwvg/gtwvg.c diff --git a/harbour/contrib/hbpgsql/postgres.c b/harbour/contrib/hbpgsql/postgres.c index 22526c8efd..39e80b37f3 100644 --- a/harbour/contrib/hbpgsql/postgres.c +++ b/harbour/contrib/hbpgsql/postgres.c @@ -269,12 +269,12 @@ HB_FUNC( PQEXECPARAMS ) long n = hb_arrayLen( aParam ); long i; - const char ** paramvalues = ( const char ** ) hb_xgrab( sizeof( char * ) * n ); + char ** paramvalues = ( char ** ) hb_xgrab( sizeof( char * ) * n ); for( i = 0; i < n; i++ ) paramvalues[ i ] = hb_arrayGetCPtr( aParam, i + 1 ); - res = PQexecParams( PGconn_par( 1 ), hb_parcx( 2 ), n, NULL, paramvalues, NULL, NULL, 1 ); + res = PQexecParams( PGconn_par( 1 ), hb_parcx( 2 ), n, NULL, ( const char * const * ) paramvalues, NULL, NULL, 1 ); hb_xfree( paramvalues ); } diff --git a/harbour/contrib/hbwhat32/_wininet.c b/harbour/contrib/hbwhat32/_wininet.c index 6d155fe927..51e602b797 100644 --- a/harbour/contrib/hbwhat32/_wininet.c +++ b/harbour/contrib/hbwhat32/_wininet.c @@ -221,23 +221,23 @@ HB_FUNC( INTERNETWRITEFILE ) HB_FUNC( INTERNETREADFILE ) { HINTERNET hFile = ( HINTERNET ) hb_parnl( 1 ) ; - LPCVOID lpBuffer = hb_parcx( 2 ) ; + LPVOID lpBuffer = hb_parcx( 2 ) ; DWORD dwNumberOfBytesToRead = ( DWORD ) hb_parnl( 3 ) ; LPDWORD lpdwNumberOfBytesRead = ( LPDWORD ) 0 ; BOOL bRet ; bRet = InternetReadFile( hFile, &lpBuffer, - dwNumberOfBytesToRead, lpdwNumberOfBytesRead ) ; + dwNumberOfBytesToRead, lpdwNumberOfBytesRead ) ; hb_retl( bRet ); - if ( bRet ) + if( bRet ) { if ISBYREF( 4 ) { hb_stornl( ( ULONG ) lpdwNumberOfBytesRead, 4 ) ; } - hb_storclen( ( char * ) lpBuffer, ( ULONG ) lpdwNumberOfBytesRead, 2 ) ; + hb_storclen( ( char * ) lpBuffer, ( ULONG ) lpdwNumberOfBytesRead, 2 ) ; } } diff --git a/harbour/contrib/hbziparch/Makefile b/harbour/contrib/hbziparch/Makefile index 8a9a8fce78..0cbc741bae 100644 --- a/harbour/contrib/hbziparch/Makefile +++ b/harbour/contrib/hbziparch/Makefile @@ -2,6 +2,9 @@ # $Id$ # +ifneq ($(HB_ARCHITECTURE),darwin) +ifneq ($(HB_ARCHITECTURE),os2) + ROOT = ../../ PRG_HEADERS = \ @@ -43,16 +46,16 @@ CPP_SOURCES = \ ZipStorage.cpp \ ZipString.cpp \ -ifeq ($(HB_ARCHITECTURE),linux) -CPP_SOURCES += \ - ZipPathComponent_lnx.cpp \ - ZipPlatform_lnx.cpp \ - -else +ifeq ($(HB_ARCHITECTURE),win32) CPP_SOURCES += \ ZipPathComponent_win.cpp \ ZipPlatform_win.cpp \ +else +CPP_SOURCES += \ + ZipPathComponent_lnx.cpp \ + ZipPlatform_lnx.cpp \ + endif PRG_SOURCES= \ @@ -64,3 +67,6 @@ C_USR += -DZIP_ARCHIVE_LNX endif include $(TOP)$(ROOT)config/lib.cf + +endif +endif diff --git a/harbour/contrib/hbziparch/hbzipnew.cpp b/harbour/contrib/hbziparch/hbzipnew.cpp index 13be120f04..c47f38e3a0 100644 --- a/harbour/contrib/hbziparch/hbzipnew.cpp +++ b/harbour/contrib/hbziparch/hbzipnew.cpp @@ -387,7 +387,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) time_t theTime; tm *SzTime; - for( ulCount = 0 ; ulCount < ( ULONG )iNumberOfFiles ; ulCount++ ) + for( ulCount = 0 ; ulCount < ( ULONG ) iNumberOfFiles ; ulCount++ ) { CZipFileHeader fh; PHB_ITEM Item; @@ -401,7 +401,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) PHB_ITEM TempArray; char szAttr[ 5 ]; char szTime[ 9 ]; - char *szMethod; + char * szMethod = NULL; char szCRC[ 8 ]; int iRatio; int iMeth = fh.m_uMethod; @@ -460,7 +460,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) } #if defined( HB_OS_WIN_32 ) - if( iMeth == 0 || uAttr & FILE_ATTRIBUTE_DIRECTORY ) + if( iMeth == 0 || uAttr & FILE_ATTRIBUTE_DIRECTORY ) { szMethod = "Stored"; } @@ -486,10 +486,9 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) break; default: - szMethod = "Unknow"; + szMethod = "Unknown"; } } - Item = hb_itemNew( NULL ); hb_arraySetForward( TempArray, Method, hb_itemPutC( Item, szMethod )); @@ -594,24 +593,26 @@ BOOL hb_IsPassWord( char *szFile ) return bReturn; } -int hb___GetNumberofFilestoUnzip( char *szFile ) +int hb___GetNumberofFilestoUnzip( char * szFile ) { - int iNumberOfFiles; + int iNumberOfFiles = 0; CZipArchive szZip; SegmCallback span; szZip.SetSegmCallback( &span ); - try { - szZip.Open( szFile, hbza_pZipI.iReadOnly ? CZipArchive::zipOpenReadOnly : CZipArchive::zipOpen, 0 ); - iNumberOfFiles = szZip.GetCount( ); - szZip.Close( ); - } - catch ( CZipException &e ) + + try { - if( e.m_iCause == CZipException::badZipFile || e.m_iCause == CZipException::cdirNotFound ) + szZip.Open( szFile, hbza_pZipI.iReadOnly ? CZipArchive::zipOpenReadOnly : CZipArchive::zipOpen, 0 ); + iNumberOfFiles = szZip.GetCount(); + szZip.Close(); + } + catch( CZipException &e ) + { + if( e.m_iCause == CZipException::badZipFile || e.m_iCause == CZipException::cdirNotFound ) { - iNumberOfFiles = -1; + iNumberOfFiles = -1; } } @@ -620,28 +621,23 @@ int hb___GetNumberofFilestoUnzip( char *szFile ) int hb___SetCallbackFunc( PHB_ITEM pFunc ) { - - //hbza_ChangeDiskBlock.type = HB_IT_NIL; if( hbza_ChangeDiskBlock ) { hb_itemRelease( hbza_ChangeDiskBlock ); hbza_ChangeDiskBlock = NULL; } - hbza_ChangeDiskBlock = hb_itemNew(NULL); + + hbza_ChangeDiskBlock = hb_itemNew( NULL ); if( pFunc ) - { - hb_itemCopy( hbza_ChangeDiskBlock, pFunc ); - } - -// hbza_pZipI.pItem = hbza_ChangeDiskBlock; + hb_itemCopy( hbza_ChangeDiskBlock, pFunc ); return ( int ) true; } bool hb_SetCallBack( DWORD iNumber, int, void* pData ) { - PHB_ITEM Disk=hb_itemPutNL( NULL, iNumber ) ; + PHB_ITEM Disk = hb_itemPutNL( NULL, iNumber ) ; HB_SYMBOL_UNUSED( pData ); @@ -772,18 +768,18 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord { CZipFileHeader fh; - const char * szFileNameInZip; + const char * szFileNameInZip; CZipString szTempString; PHB_FNAME pOut; szZip.GetFileInfo( fh, ( WORD )ulCount ); - szTempString = ( LPCTSTR )fh.GetFileName( ); - szFileNameInZip = ( const char * )szTempString; + szTempString = ( LPCTSTR ) fh.GetFileName(); + szFileNameInZip = ( const char * ) szTempString; pOut = hb_fsFNameSplit( ( char * ) szFileNameInZip ); if( szPath == NULL ) { - szPath = ( char* )pOut->szDrive; + szPath = ( char * ) pOut->szDrive; pOut->szDrive = ""; - hb_fsFNameMerge( ( char* )szFileNameInZip, pOut ); + hb_fsFNameMerge( ( char * ) szFileNameInZip, pOut ); bChange = TRUE; bFreePath = FALSE; } @@ -792,9 +788,9 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord if( pBlock != NULL ) { - PHB_ITEM FileName=hb_itemPutC( NULL, ( char * )szFileNameInZip ), Pos=hb_itemPutNI( NULL , iCause ); + PHB_ITEM FileName = hb_itemPutC( NULL, ( char * ) szFileNameInZip ), Pos = hb_itemPutNI( NULL, iCause ); - hb_vmEvalBlockV( pBlock, 2, FileName,Pos ); + hb_vmEvalBlockV( pBlock, 2, FileName, Pos ); hb_itemRelease( FileName ); hb_itemRelease( Pos ); @@ -805,9 +801,8 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord /* TODO: They're both the same.... */ if( !HB_IS_BLOCK( pProgress ) ) { - // szZip.SetPassword( szPassWord ); - szZip.ExtractFile( ( WORD )ulCount, ( LPCTSTR )szPath, bWithPath, NULL, 65536 ); + szZip.ExtractFile( ( WORD ) ulCount, ( LPCTSTR ) szPath, bWithPath, NULL, 65536 ); } else { @@ -874,10 +869,10 @@ void hb_SetZipReadOnly(int iRead ) hbza_pZipI.iReadOnly = iRead ; } -const char * hb_GetZipComment( char *szFile ) +const char * hb_GetZipComment( char * szFile ) { - const char *szReturn; - char *szTempR; + const char * szReturn; + char * szTempR; bool iReturn = true; CZipString szTemp; @@ -906,22 +901,23 @@ const char * hb_GetZipComment( char *szFile ) iReturn = false; } } - - catch ( CZipException ) {} + catch( CZipException ) + {} if( iReturn ) { szTemp = szZip.GetGlobalComment( ); szReturn = ( const char * ) szTemp; } + else + szReturn = ""; - szTempR = ( char* ) hb_xgrab( strlen( ( const char* ) szReturn ) + 1 ); + szTempR = ( char* ) hb_xgrab( strlen( ( const char * ) szReturn ) + 1 ); strcpy( szTempR, ( char* ) szReturn ); - szZip.Close( ); + szZip.Close(); return szTempR; - } int hb_UnzipSelIndex( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord, char *szPath, PHB_ITEM pSelArray, PHB_ITEM pProgress ) @@ -1235,7 +1231,6 @@ int hb_UnzipAll(char *szFile,PHB_ITEM pBlock, BOOL bWithPath,char *szPassWord,ch return iReturn; } - #ifdef __cplusplus } #endif diff --git a/harbour/tests/bld4dll.bat b/harbour/tests/bld4dll.bat deleted file mode 100644 index 26814be2e8..0000000000 --- a/harbour/tests/bld4dll.bat +++ /dev/null @@ -1,33 +0,0 @@ -@echo off -rem -rem $Id$ -rem - -rem --------------------------------------------------------------- -rem This file is intended to build a program, which uses harbour.dll -rem The main function must be called _AppMain. -rem To run the program, you need to have harbour.dll in your path. -rem --------------------------------------------------------------- - -set HB_PATH=..\ - -%HB_PATH%\bin\harbour %1.prg -n -i%HB_PATH%\include %2 %3 - -bcc32 -c -O2 -d -I%HB_PATH%\include %1.c %HB_PATH%\source\vm\mainwin.c - -@echo c0w32.obj + > _b32.bc -@echo %1.obj + >> _b32.bc -@echo mainwin.obj,+ >> _b32.bc -@echo %1.exe, + >> _b32.bc -@echo , + >> _b32.bc -@echo %HB_PATH%\lib\harbour.lib + >> _b32.bc -@echo cw32.lib + >> _b32.bc -@echo import32.lib, >> _b32.bc - -ilink32 -Tpe -Gn @_b32.bc - -del %1.obj -del mainwin.obj -del %1.c -del *.tds -del _b32.bc diff --git a/harbour/tests/bld_b32_dll.bat b/harbour/tests/bld_b32_dll.bat new file mode 100644 index 0000000000..08cda29fb6 --- /dev/null +++ b/harbour/tests/bld_b32_dll.bat @@ -0,0 +1,32 @@ +@echo off +rem +rem $Id$ +rem + +rem --------------------------------------------------------------- +rem This file is intended to build a program, which uses harbour-b32.dll +rem The main function must be called _AppMain. +rem To run the program, you need to have harbour-b32.dll in your path. +rem --------------------------------------------------------------- + +..\bin\harbour %1.prg -n -i..\include %2 %3 + +bcc32 -c -O2 -d -I..\include %1.c ..\source\vm\mainwin.c + +@echo c0w32.obj + > _bld_b32_dll.tmp +@echo %1.obj + >> _bld_b32_dll.tmp +@echo mainwin.obj, + >> _bld_b32_dll.tmp +@echo %1.exe, + >> _bld_b32_dll.tmp +@echo , + >> _bld_b32_dll.tmp +@echo ..\lib\harbour-b32.lib + >> _bld_b32_dll.tmp +@echo cw32.lib + >> _bld_b32_dll.tmp +@echo import32.lib, >> _bld_b32_dll.tmp + +ilink32 -Tpe -Gn @_bld_b32_dll.tmp + +del %1.obj +del mainwin.obj +del %1.c +del *.tds + +del _bld_b32_dll.tmp diff --git a/harbour/tests/gnu_test.bat b/harbour/tests/bld_gnu.bat similarity index 100% rename from harbour/tests/gnu_test.bat rename to harbour/tests/bld_gnu.bat diff --git a/harbour/tests/run_test.bat b/harbour/tests/run_prg_all.bat similarity index 100% rename from harbour/tests/run_test.bat rename to harbour/tests/run_prg_all.bat