From aae6eda0c04640fdd01cb701511b663bee103f28 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 30 Mar 2012 13:53:42 +0000 Subject: [PATCH] 2012-03-30 15:53 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/include/hbwinuni.h ! fixed typos in HB_FSNAMECONV() definition * harbour/src/rtl/filesys.c * harbour/src/rtl/fstemp.c * harbour/src/rtl/fslink.c * harbour/src/rtl/hbcom.c * harbour/contrib/hbmzip/mzip.c ! fixed casting in recent modifications (missing const) * harbour/src/rtl/gtcrs/hb-charmap.def * formatting --- harbour/ChangeLog | 14 +++++++++ harbour/contrib/hbmzip/mzip.c | 4 +-- harbour/include/hbwinuni.h | 4 +-- harbour/src/rtl/filesys.c | 44 +++++++++++++++++----------- harbour/src/rtl/fslink.c | 11 +++---- harbour/src/rtl/fstemp.c | 4 +-- harbour/src/rtl/gtcrs/hb-charmap.def | 13 ++++---- harbour/src/rtl/hbcom.c | 3 +- 8 files changed, 61 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fc857c36a7..bd37ff203d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2012-03-30 15:53 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbwinuni.h + ! fixed typos in HB_FSNAMECONV() definition + + * harbour/src/rtl/filesys.c + * harbour/src/rtl/fstemp.c + * harbour/src/rtl/fslink.c + * harbour/src/rtl/hbcom.c + * harbour/contrib/hbmzip/mzip.c + ! fixed casting in recent modifications (missing const) + + * harbour/src/rtl/gtcrs/hb-charmap.def + * formatting + 2012-03-30 12:07 UTC+0200 Viktor Szakats (harbour syenar.net) * src/rtl/fslink.c * contrib/hbmzip/mzip.c diff --git a/harbour/contrib/hbmzip/mzip.c b/harbour/contrib/hbmzip/mzip.c index 3dc42f7ece..9de0bc6f95 100644 --- a/harbour/contrib/hbmzip/mzip.c +++ b/harbour/contrib/hbmzip/mzip.c @@ -712,7 +712,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * #if defined( HB_OS_WIN ) { LPTSTR lpFileNameFree; - LPTSTR lpFileName = HB_FSNAMECONV( szFileName, &lpFileNameFree ); + LPCTSTR lpFileName = HB_FSNAMECONV( szFileName, &lpFileNameFree ); DWORD attr = GetFileAttributes( lpFileName ); if( attr != INVALID_FILE_ATTRIBUTES ) @@ -1119,7 +1119,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, #if defined( HB_OS_WIN ) { LPTSTR lpFileNameFree; - LPTSTR lpFileName = HB_FSNAMECONV( szName, &lpFileNameFree ); + LPCTSTR lpFileName = HB_FSNAMECONV( szName, &lpFileNameFree ); SetFileAttributes( ( LPCTSTR ) lpFileName, ufi.external_fa & 0xFF ); diff --git a/harbour/include/hbwinuni.h b/harbour/include/hbwinuni.h index 12bef92933..ae1ab5a74a 100644 --- a/harbour/include/hbwinuni.h +++ b/harbour/include/hbwinuni.h @@ -84,7 +84,7 @@ #define HB_STRNCAT( dst, src, len ) hb_wstrncat( dst, src, len ) #define HB_STRCMP( s1, s2 ) hb_wstrcmp( s1, s2 ) #define HB_STRNCMP( s1, s2, len ) hb_wstrncmp( s1, s2, len ) - #define HB_FSNAMECONV( fname, pfree ) ( *pfree = hb_fsNameConvU16( fname ) ) + #define HB_FSNAMECONV( fname, pfree ) ( *(pfree) = hb_fsNameConvU16( fname ) ) #else #define HB_PARSTR( n, h, len ) hb_parstr( n, hb_setGetOSCP(), h, len ) #define HB_PARSTRDEF( n, h, len ) hb_strnull( hb_parstr( n, hb_setGetOSCP(), h, len ) ) @@ -110,7 +110,7 @@ #define HB_STRNCAT( dst, src, len ) hb_strncat( dst, src, len ) #define HB_STRCMP( s1, s2 ) strcmp( s1, s2 ) #define HB_STRNCMP( s1, s2, len ) strncmp( s1, s2, len ) - #define HB_FSNAMECONV( fname, pfree ) pfreehb_fsNameConvU16( fname, pfree ) + #define HB_FSNAMECONV( fname, pfree ) hb_fsNameConv( fname, pfree ) #endif #endif /* HB_OS_WIN */ diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index ed11ec6bf1..f7b6ef7cd2 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -1030,7 +1030,8 @@ HB_FHANDLE hb_fsOpen( const char * pFilename, HB_USHORT uiFlags ) #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; DWORD dwMode, dwShare, dwCreat, dwAttr; HANDLE hFile; @@ -1092,7 +1093,8 @@ HB_FHANDLE hb_fsCreate( const char * pFilename, HB_FATTR ulAttr ) #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; DWORD dwMode, dwShare, dwCreat, dwAttr; HANDLE hFile; @@ -1154,7 +1156,8 @@ HB_FHANDLE hb_fsCreateEx( const char * pFilename, HB_FATTR ulAttr, HB_USHORT uiF #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; DWORD dwMode, dwShare, dwCreat, dwAttr; HANDLE hFile; @@ -1402,7 +1405,8 @@ HB_BOOL hb_fsGetAttr( const char * pszFileName, HB_FATTR * pulAttr ) fResult = HB_FALSE; #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; DWORD dwAttr; lpFileName = HB_FSNAMECONV( pszFileName, &lpFree ); @@ -1674,7 +1678,8 @@ HB_BOOL hb_fsSetAttr( const char * pszFileName, HB_FATTR ulAttr ) #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; DWORD dwFlags = FILE_ATTRIBUTE_ARCHIVE; lpFileName = HB_FSNAMECONV( pszFileName, &lpFree ); @@ -2960,7 +2965,8 @@ HB_BOOL hb_fsDelete( const char * pFilename ) #if defined( HB_OS_WIN ) { - LPTSTR lpFileName, lpFree; + LPCTSTR lpFileName; + LPTSTR lpFree; lpFileName = HB_FSNAMECONV( pFilename, &lpFree ); @@ -3003,7 +3009,8 @@ HB_BOOL hb_fsRename( const char * pOldName, const char * pNewName ) #if defined( HB_OS_WIN ) { - LPTSTR lpOldName, lpNewName, lpOldFree, lpNewFree; + LPCTSTR lpOldName, lpNewName; + LPTSTR lpOldFree, lpNewFree; lpOldName = HB_FSNAMECONV( pOldName, &lpOldFree ); lpNewName = HB_FSNAMECONV( pNewName, &lpNewFree ); @@ -3052,7 +3059,8 @@ HB_BOOL hb_fsMkDir( const char * pDirname ) #if defined( HB_OS_WIN ) { - LPTSTR lpDirname, lpFree; + LPCTSTR lpDirname; + LPTSTR lpFree; lpDirname = HB_FSNAMECONV( pDirname, &lpFree ); @@ -3101,7 +3109,8 @@ HB_BOOL hb_fsChDir( const char * pDirname ) #if defined( HB_OS_WIN ) { - LPTSTR lpDirname, lpFree; + LPCTSTR lpDirname; + LPTSTR lpFree; UINT uiErrMode; lpDirname = HB_FSNAMECONV( pDirname, &lpFree ); @@ -3146,7 +3155,8 @@ HB_BOOL hb_fsRmDir( const char * pDirname ) #if defined( HB_OS_WIN ) { - LPTSTR lpDirname, lpFree; + LPCTSTR lpDirname; + LPTSTR lpFree; lpDirname = HB_FSNAMECONV( pDirname, &lpFree ); @@ -3942,25 +3952,25 @@ HB_WCHAR * hb_fsNameConvU16( const char * szFileName ) if( iFileCase == HB_SET_CASE_LOWER ) { if( pFileName->szName ) - pFileName->szName = pszName = hb_cdpnDupLower( hb_vmCDP(), pFileName->szName, NULL ); + pFileName->szName = pszName = hb_cdpnDupLower( cdp, pFileName->szName, NULL ); if( pFileName->szExtension ) - pFileName->szExtension = pszExt = hb_cdpnDupLower( hb_vmCDP(), pFileName->szExtension, NULL ); + pFileName->szExtension = pszExt = hb_cdpnDupLower( cdp, pFileName->szExtension, NULL ); } else if( iFileCase == HB_SET_CASE_UPPER ) { if( pFileName->szName ) - pFileName->szName = pszName = hb_cdpnDupUpper( hb_vmCDP(), pFileName->szName, NULL ); + pFileName->szName = pszName = hb_cdpnDupUpper( cdp, pFileName->szName, NULL ); if( pFileName->szExtension ) - pFileName->szExtension = pszExt = hb_cdpnDupUpper( hb_vmCDP(), pFileName->szExtension, NULL ); + pFileName->szExtension = pszExt = hb_cdpnDupUpper( cdp, pFileName->szExtension, NULL ); } /* DIRCASE */ if( pFileName->szPath ) { if( iDirCase == HB_SET_CASE_LOWER ) - pFileName->szPath = pszPath = hb_cdpnDupLower( hb_vmCDP(), pFileName->szPath, NULL ); + pFileName->szPath = pszPath = hb_cdpnDupLower( cdp, pFileName->szPath, NULL ); else if( iDirCase == HB_SET_CASE_UPPER ) - pFileName->szPath = pszPath = hb_cdpnDupUpper( hb_vmCDP(), pFileName->szPath, NULL ); + pFileName->szPath = pszPath = hb_cdpnDupUpper( cdp, pFileName->szPath, NULL ); } hb_fsFNameMerge( pszBuffer, pFileName ); @@ -3973,7 +3983,7 @@ HB_WCHAR * hb_fsNameConvU16( const char * szFileName ) hb_xfree( pszExt ); } - nLen = hb_cdpStrAsU16Len( hb_vmCDP(), szFileName, strlen( szFileName ), 0 ); + nLen = hb_cdpStrAsU16Len( cdp, szFileName, strlen( szFileName ), 0 ); lpwFileName = ( HB_WCHAR * ) hb_xgrab( ( nLen + 1 ) * sizeof( HB_WCHAR ) ); hb_cdpStrToU16( cdp, HB_CDP_ENDIAN_NATIVE, szFileName, strlen( szFileName ), lpwFileName, nLen + 1 ); diff --git a/harbour/src/rtl/fslink.c b/harbour/src/rtl/fslink.c index 0e6fb7902a..3cb85ceb63 100644 --- a/harbour/src/rtl/fslink.c +++ b/harbour/src/rtl/fslink.c @@ -88,8 +88,8 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile ) if( s_pCreateHardLink ) { - LPTSTR lpFileName, lpFileNameFree; - LPTSTR lpExistingFileName, lpExistingFileNameFree; + LPCTSTR lpFileName, lpExistingFileName; + LPTSTR lpFileNameFree, lpExistingFileNameFree; lpFileName = HB_FSNAMECONV( pszNewFile, &lpFileNameFree ); lpExistingFileName = HB_FSNAMECONV( pszExisting, &lpExistingFileNameFree ); @@ -172,8 +172,8 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile ) if( s_pCreateSymbolicLink ) { - LPTSTR lpSymlinkFileName, lpSymlinkFileNameFree; - LPTSTR lpTargetFileName, lpTargetFileNameFree; + LPCTSTR lpSymlinkFileName, lpTargetFileName; + LPTSTR lpSymlinkFileNameFree, lpTargetFileNameFree; DWORD dwAttr; HB_BOOL fDir; @@ -278,7 +278,8 @@ char * hb_fsLinkRead( const char * pszFile ) if( s_pGetFinalPathNameByHandle ) { - LPTSTR lpFileName, lpFileNameFree; + LPCTSTR lpFileName; + LPTSTR lpFileNameFree; HANDLE hFile; DWORD dwAttr; HB_BOOL fDir; diff --git a/harbour/src/rtl/fstemp.c b/harbour/src/rtl/fstemp.c index aca6a72eca..c90b79663a 100644 --- a/harbour/src/rtl/fstemp.c +++ b/harbour/src/rtl/fstemp.c @@ -249,8 +249,8 @@ static HB_BOOL hb_fsTempName( char * pszBuffer, const char * pszDir, const char #if defined( HB_OS_WIN ) { - LPTSTR lpPrefix, lpPrefixFree = NULL; - LPTSTR lpDir, lpDirFree = NULL; + LPCTSTR lpPrefix, lpDir; + LPTSTR lpPrefixFree = NULL, lpDirFree = NULL; TCHAR lpBuffer[ HB_PATH_MAX ]; TCHAR lpTempDir[ HB_PATH_MAX ]; diff --git a/harbour/src/rtl/gtcrs/hb-charmap.def b/harbour/src/rtl/gtcrs/hb-charmap.def index 913d3aa3dc..1582d7965c 100644 --- a/harbour/src/rtl/gtcrs/hb-charmap.def +++ b/harbour/src/rtl/gtcrs/hb-charmap.def @@ -60,12 +60,16 @@ 27: ',' 5 # ACS_LARROW 30: '-' 5 # ACS_UARROW 31: '.' 5 # ACS_DARROW - -128-255: * 2 + 128-255: * 2 155: '.' 1 # @acsc # include acsc section # @maz2iso # include maz2iso section +:xterm|xterm-color|rxvt|teraterm = xterm terms + 0-31: '.' 1 + 127-159: '.' 1 + @acsc # include acsc section + :tterm = Teraterm modified terminal 0-31: '.' 1 127: '.' 1 @@ -85,11 +89,6 @@ 127-159: '.' 1 @acsc # include acsc section -:xterm|xterm-color|rxvt|teraterm = xterm terms - 0-31: '.' 1 - 127-159: '.' 1 - @acsc # include acsc section - :acsc = display semigraphics chars as ACSC ones 04: '`' 5 # ACS_DIAMOND 16: '+' 5 # ACS_RARROW diff --git a/harbour/src/rtl/hbcom.c b/harbour/src/rtl/hbcom.c index 435558f8a2..52b1b95105 100644 --- a/harbour/src/rtl/hbcom.c +++ b/harbour/src/rtl/hbcom.c @@ -1991,7 +1991,8 @@ int hb_comOpen( int iPort ) { char buffer[ HB_COM_DEV_NAME_MAX ]; const char * szName = hb_comGetName( pCom, buffer, sizeof( buffer ) ); - LPTSTR lpName, lpFree; + LPCTSTR lpName; + LPTSTR lpFree; lpName = HB_FSNAMECONV( szName, &lpFree );