From edff135b131fda25abccd1e61ed66f299b111dc6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 3 Jul 2008 14:50:43 +0000 Subject: [PATCH] 2008-07-03 16:48 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbmzip/hbmzip.c + Added ".cmd" to the (commented) list of OS/2 executable extensions. + Added headers for DOS/GCC line. + Guarded new DOS section with GCC guards, added dummy branch for other DOS compilers. ! Fixed embedded comment. ; TOFIX: ../../hbmzip.c:563: error: 'FILE_ATTRIBUTE_READONLY' undeclared (first use in this function) ../../hbmzip.c:568: error: 'FILE_ATTRIBUTE_DIRECTORY' undeclared (first use in this function) * contrib/hbmisc/spd.c - Removed two __XHARBOUR__ guards, because these feature have since been implemented in xhb. ! Fixed DJGPP warning. The problem is that DJGPP will preprocess snprintf() to sprintf() (not very safe), which makes ulMaxBuf var unused. --- harbour/ChangeLog | 19 ++++++++++++++++++ harbour/contrib/hbmisc/spd.c | 15 +++++++-------- harbour/contrib/hbmzip/hbmzip.c | 34 +++++++++++++++++++++++++++++---- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 631d8e8e6f..8a797ea620 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-03 16:48 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbmzip/hbmzip.c + + Added ".cmd" to the (commented) list of OS/2 executable + extensions. + + Added headers for DOS/GCC line. + + Guarded new DOS section with GCC guards, added dummy + branch for other DOS compilers. + ! Fixed embedded comment. + ; TOFIX: + ../../hbmzip.c:563: error: 'FILE_ATTRIBUTE_READONLY' undeclared (first use in this function) + ../../hbmzip.c:568: error: 'FILE_ATTRIBUTE_DIRECTORY' undeclared (first use in this function) + + * contrib/hbmisc/spd.c + - Removed two __XHARBOUR__ guards, because these feature + have since been implemented in xhb. + ! Fixed DJGPP warning. The problem is that DJGPP will preprocess + snprintf() to sprintf() (not very safe), which makes ulMaxBuf + var unused. + 2008-07-03 16:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/Makefile ! fixed some contrib library comments: # used before 1-st commented diff --git a/harbour/contrib/hbmisc/spd.c b/harbour/contrib/hbmisc/spd.c index fc82262ffb..7dc26c708d 100644 --- a/harbour/contrib/hbmisc/spd.c +++ b/harbour/contrib/hbmisc/spd.c @@ -70,17 +70,20 @@ static void STAItm( PHB_ITEM pItmPar ) cRes[i++] = *c++; } cRes[i++] = '\''; /* cRes[i] = '\0'; */ -#ifdef __XHARBOUR__ - hb_itemPutCPtr( pItmPar, cRes, i ); -#else hb_itemPutCLPtr( pItmPar, cRes, i ); -#endif } static ULONG SCItm( char *cBuffer, ULONG ulMaxBuf, char *cParFrm, int iCOut, int IsIndW, int iIndWidth, int IsIndP, int iIndPrec, PHB_ITEM pItmPar ) { ULONG s; + /* NOTE: In DJGPP (4.2.3) snprintf() will be preprocessed to sprintf(), which + makes ulMaxBuf unused, and this in turn causes a warning, so we're + manually suppressing it. [vszakats] */ + #if defined(__DJGPP__) + HB_SYMBOL_UNUSED( ulMaxBuf ); + #endif + if( IsIndW && IsIndP ){ switch( iCOut ){ case 'p': @@ -176,10 +179,6 @@ static ULONG SCItm( char *cBuffer, ULONG ulMaxBuf, char *cParFrm, int iCOut, int #define DK_INCBUF 512 #define DK_BLKBUF HB_MAX_DOUBLE_LENGTH /* Expense of DK_INCBUF */ -#if defined( __XHARBOUR__ ) && ! defined( HB_ERR_FUNCNAME ) - #define HB_ERR_FUNCNAME "SQL_SPRINTF" -#endif - HB_FUNC( SQL_SPRINTF ) { ULONG ulItmFrm; diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index 33d5b49dea..4dcd59beb8 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -68,6 +68,11 @@ #include #include #include +#elif defined( HB_OS_DOS ) + #if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) + #include "hb_io.h" + #include + #endif #endif @@ -544,6 +549,8 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char* fError = TRUE; } #elif defined( HB_OS_DOS ) + +# if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) { int iAttr; @@ -567,7 +574,8 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char* if( ulLen > 4 ) { pString = &szZipName[ ulLen - 4 ]; - if( hb_stricmp( pString, ".exe" ) == 0 || hb_stricmp( pString, ".com" ) == 0 || + if( hb_stricmp( pString, ".exe" ) == 0 || + hb_stricmp( pString, ".com" ) == 0 || hb_stricmp( pString, ".bat" ) == 0 ) { ulExtAttr |= 0x00490000; /* --x--x--x */ @@ -577,6 +585,14 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char* else fError = TRUE; } +# else + { + int TODO; /* To force warning */ + + ulExtAttr = 0x81B60020; /* FILE_ATTRIBUTE_ARCHIVE | rw-rw-rw- */ + } +# endif + #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; @@ -608,18 +624,20 @@ static int hb_zipStoreFile( zipFile hZip, char* szFileName, char* szName, char* else ulExtAttr |= 0x80000000; -/* Please uncomment it if .exe, .bat and .com are executable files under OS2 +#if 0 /* Please enable it if .exe, .bat and .com are executable files under OS2 ulLen = strlen( szZipName ); if( ulLen > 4 ) { pString = &szZipName[ ulLen - 4 ]; - if( hb_stricmp( pString, ".exe" ) == 0 || hb_stricmp( pString, ".com" ) == 0 || + if( hb_stricmp( pString, ".exe" ) == 0 || + hb_stricmp( pString, ".com" ) == 0 || + hb_stricmp( pString, ".cmd" ) == 0 || hb_stricmp( pString, ".bat" ) == 0 ) { ulExtAttr |= 0x00490000; /* --x--x--x */ } } -*/ +#endif } else fError = TRUE; @@ -840,9 +858,17 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, char* szFileName, char* s utime( szName, &utim ); } #elif defined( HB_OS_DOS ) + +# if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) { _chmod( szName, 1, ufi.external_fa & 0xFF ); } +# else + { + int TODO; /* To force warning */ + } +# endif + #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3;