From 13427dd60a45ed93eb596d0c44ea65809aeb4c57 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 3 Nov 2007 01:35:47 +0000 Subject: [PATCH] 2007-11-03 02:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/bmdbfcdx/bmdbfcdx1.c * replaced all direct access to hb_set structure with functions Now it's possible to link bmdbfcdx with harbour.dll but because it still access hb_cdp_page then only if linker supports auto import conversions * harbour/source/common/hbfsapi.c * harbour/source/main/harbour.c * harbour/source/pp/hbppgen.c * harbour/utils/hbpp/hbpp.c * added filename conversion (hb_fsNameConv()) to hb_fsFileExists() function * harbour/include/hbapifs.h + harbour/source/common/hbfopen.c * harbour/source/common/Makefile * harbour/common.mak + added hb_fopen() function - it's a wrapper to fopen() function but calls internally hb_fsNameConv() * harbour/source/pp/hbppgen.c * harbour/source/pp/ppcore.c * harbour/source/common/hbtrace.c * harbour/source/compiler/hbmain.c * harbour/source/compiler/genhrb.c * harbour/source/compiler/gencobj.c * harbour/source/compiler/genobj32.c * harbour/source/compiler/genc.c * harbour/source/rtl/gtchrmap.c * harbour/source/vm/fm.c * use hb_fopen() instead of fopen() --- harbour/ChangeLog | 33 ++++++++++++++ harbour/common.mak | 1 + harbour/contrib/bmdbfcdx/bmdbfcdx1.c | 26 +++++------ harbour/include/hbapifs.h | 3 ++ harbour/source/common/Makefile | 1 + harbour/source/common/hbfopen.c | 65 ++++++++++++++++++++++++++++ harbour/source/common/hbfsapi.c | 25 ++++++++--- harbour/source/common/hbtrace.c | 3 +- harbour/source/compiler/genc.c | 2 +- harbour/source/compiler/gencobj.c | 2 +- harbour/source/compiler/genhrb.c | 2 +- harbour/source/compiler/genobj32.c | 2 +- harbour/source/compiler/hbmain.c | 2 +- harbour/source/main/harbour.c | 9 ++++ harbour/source/pp/hbppgen.c | 3 +- harbour/source/pp/ppcore.c | 8 ++-- harbour/source/rtl/gtchrmap.c | 7 +-- harbour/source/vm/fm.c | 3 +- harbour/utils/hbpp/hbpp.c | 8 ++++ 19 files changed, 169 insertions(+), 36 deletions(-) create mode 100644 harbour/source/common/hbfopen.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2e5924551d..10f9123bec 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,39 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-11-03 02:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/bmdbfcdx/bmdbfcdx1.c + * replaced all direct access to hb_set structure with functions + Now it's possible to link bmdbfcdx with harbour.dll but because + it still access hb_cdp_page then only if linker supports auto + import conversions + + * harbour/source/common/hbfsapi.c + * harbour/source/main/harbour.c + * harbour/source/pp/hbppgen.c + * harbour/utils/hbpp/hbpp.c + * added filename conversion (hb_fsNameConv()) to hb_fsFileExists() + function + + * harbour/include/hbapifs.h + + harbour/source/common/hbfopen.c + * harbour/source/common/Makefile + * harbour/common.mak + + added hb_fopen() function - it's a wrapper to fopen() function but + calls internally hb_fsNameConv() + + * harbour/source/pp/hbppgen.c + * harbour/source/pp/ppcore.c + * harbour/source/common/hbtrace.c + * harbour/source/compiler/hbmain.c + * harbour/source/compiler/genhrb.c + * harbour/source/compiler/gencobj.c + * harbour/source/compiler/genobj32.c + * harbour/source/compiler/genc.c + * harbour/source/rtl/gtchrmap.c + * harbour/source/vm/fm.c + * use hb_fopen() instead of fopen() + 2007-11-02 18:52 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/source/common/hbfsapi.c ! fixed hb_fsFileExists() to return TRUE for files only diff --git a/harbour/common.mak b/harbour/common.mak index 4b59ec2060..2ec30a0136 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -288,6 +288,7 @@ COMMON_LIB_OBJS = \ $(OBJ_DIR)\hbarch$(OBJEXT) \ $(OBJ_DIR)\hbfhnd$(OBJEXT) \ $(OBJ_DIR)\hbfsapi$(OBJEXT) \ + $(OBJ_DIR)\hbfopen$(OBJEXT) \ $(OBJ_DIR)\hbgete$(OBJEXT) \ $(OBJ_DIR)\hbwince$(OBJEXT) \ $(OBJ_DIR)\hbhash$(OBJEXT) \ diff --git a/harbour/contrib/bmdbfcdx/bmdbfcdx1.c b/harbour/contrib/bmdbfcdx/bmdbfcdx1.c index 69c5de6293..d945148bd5 100644 --- a/harbour/contrib/bmdbfcdx/bmdbfcdx1.c +++ b/harbour/contrib/bmdbfcdx/bmdbfcdx1.c @@ -3928,7 +3928,7 @@ static BOOL hb_cdxCheckRecordFilter( CDXAREAP pArea, ULONG ulRecNo ) if( pArea->ulRecNo != ulRecNo || pArea->lpdbPendingRel ) SELF_GOTO( ( AREAP ) pArea, ulRecNo ); - if( hb_set.HB_SET_DELETED ) + if( hb_setGetL( HB_SET_DELETED ) ) SUPER_DELETED( ( AREAP ) pArea, &lResult ); if( !lResult && pArea->dbfi.itmCobExpr ) @@ -3948,12 +3948,12 @@ static BOOL hb_cdxCheckRecordFilter( CDXAREAP pArea, ULONG ulRecNo ) else lResult = TRUE; } - else if ( pArea->dbfi.itmCobExpr || hb_set.HB_SET_DELETED ) + else if ( pArea->dbfi.itmCobExpr || hb_setGetL( HB_SET_DELETED ) ) { if( pArea->ulRecNo != ulRecNo || pArea->lpdbPendingRel ) SELF_GOTO( ( AREAP ) pArea, ulRecNo ); - if( hb_set.HB_SET_DELETED ) + if( hb_setGetL( HB_SET_DELETED ) ) SUPER_DELETED( ( AREAP ) pArea, &lResult ); if( !lResult && pArea->dbfi.itmCobExpr ) @@ -4884,7 +4884,7 @@ static void hb_cdxCreateFName( CDXAREAP pArea, char * szBagName, BOOL * fProd, szBaseName[ 0 ] = '\0'; } - if( ( hb_set.HB_SET_DEFEXTENSIONS && !pFileName->szExtension ) || !fName ) + if( ( hb_setGetL( HB_SET_DEFEXTENSIONS ) && !pFileName->szExtension ) || !fName ) { DBORDERINFO pExtInfo; memset( &pExtInfo, 0, sizeof( pExtInfo ) ); @@ -7289,7 +7289,7 @@ static ERRCODE hb_cdxFlush( CDXAREAP pArea ) uiError = SUPER_FLUSH( ( AREAP ) pArea ); - if ( hb_set.HB_SET_HARDCOMMIT ) + if ( hb_setGetL( HB_SET_HARDCOMMIT ) ) { pIndex = pArea->lpIndexes; while ( pIndex ) @@ -7632,7 +7632,7 @@ static ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) } /* open (production) structural index */ - if( CDXAREA_DATA( pArea )->fStrictStruct ? pArea->fHasTags : hb_set.HB_SET_AUTOPEN ) + if( CDXAREA_DATA( pArea )->fStrictStruct ? pArea->fHasTags : hb_setGetL( HB_SET_AUTOPEN ) ) { char szFileName[ _POSIX_PATH_MAX + 1 ]; @@ -7650,7 +7650,7 @@ static ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) errCode = SELF_ORDLSTADD( ( AREAP ) pArea, &pOrderInfo ); if( errCode == SUCCESS ) { - pOrderInfo.itmOrder = hb_itemPutNI( NULL, hb_set.HB_SET_AUTORDER ); + pOrderInfo.itmOrder = hb_itemPutNI( NULL, hb_setGetL( HB_SET_AUTORDER ) ); errCode = SELF_ORDLSTFOCUS( ( AREAP ) pArea, &pOrderInfo ); hb_itemRelease( pOrderInfo.itmOrder ); if( errCode == SUCCESS ) @@ -7850,7 +7850,7 @@ static ERRCODE hb_cdxOrderListClear( CDXAREAP pArea ) return FAILURE; hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ? - pArea->fHasTags : hb_set.HB_SET_AUTOPEN ), NULL ); + pArea->fHasTags : hb_setGetL( HB_SET_AUTOPEN ) ), NULL ); pArea->uiTag = 0; return SUCCESS; @@ -8087,7 +8087,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo if ( !pArea->lpdbOrdCondInfo || ( pArea->lpdbOrdCondInfo->fAll && !pArea->lpdbOrdCondInfo->fAdditive ) ) hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ? - pArea->fHasTags : hb_set.HB_SET_AUTOPEN ), NULL ); + pArea->fHasTags : hb_setGetL( HB_SET_AUTOPEN ) ), NULL ); pIndex = hb_cdxFindBag( pArea, szFileName ); @@ -8207,7 +8207,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo !pArea->lpdbOrdCondInfo->fAdditive ) ) { hb_cdxOrdListClear( pArea, !( CDXAREA_DATA( pArea )->fStrictStruct ? - pArea->fHasTags : hb_set.HB_SET_AUTOPEN ), NULL ); + pArea->fHasTags : hb_setGetL( HB_SET_AUTOPEN ) ), NULL ); } hb_cdxIndexUnLockWrite( pIndex ); /* Update DBF header */ @@ -8215,7 +8215,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo { pArea->fHasTags = TRUE; if ( !pArea->fReadonly && ( pArea->dbfHeader.bHasTags & 0x01 ) == 0 && - ( hb_set.HB_SET_AUTOPEN || CDXAREA_DATA( pArea )->fStrictStruct ) ) + ( hb_setGetL( HB_SET_AUTOPEN ) || CDXAREA_DATA( pArea )->fStrictStruct ) ) SELF_WRITEDBHEADER( ( AREAP ) pArea ); } else @@ -8282,7 +8282,7 @@ static ERRCODE hb_cdxOrderDestroy( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) { pArea->fHasTags = FALSE; if ( !pArea->fReadonly && ( pArea->dbfHeader.bHasTags & 0x01 ) != 0 && - ( hb_set.HB_SET_AUTOPEN || + ( hb_setGetL( HB_SET_AUTOPEN ) || CDXAREA_DATA( pArea )->fStrictStruct ) ) SELF_WRITEDBHEADER( ( AREAP ) pArea ); } @@ -9970,7 +9970,7 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, BOOL fReindex ) pArea->uiTag = 0; } } - fDirectRead = !hb_set.HB_SET_STRICTREAD && /* !pArea->lpdbRelations && */ + fDirectRead = !hb_setGetL( HB_SET_STRICTREAD ) && /* !pArea->lpdbRelations && */ ( !pArea->lpdbOrdCondInfo || pArea->lpdbOrdCondInfo->fAll || ( pArea->uiTag == 0 && !fUseFilter ) ); diff --git a/harbour/include/hbapifs.h b/harbour/include/hbapifs.h index 63cb36c9d5..c2ada6d05a 100644 --- a/harbour/include/hbapifs.h +++ b/harbour/include/hbapifs.h @@ -229,6 +229,9 @@ extern char * hb_fsAttrDecode( USHORT uiAttr, char * szAttr ); extern HB_EXPORT BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree ); extern HB_EXPORT BYTE * hb_fileNameConv( char *str ); +/* wrapper to fopen() which calls hb_fsNameConv() */ +extern FILE * hb_fopen( const char *path, const char *mode ); + HB_EXTERN_END #endif /* HB_APIFS_H_ */ diff --git a/harbour/source/common/Makefile b/harbour/source/common/Makefile index 6ae8f3c054..7cbd7352eb 100644 --- a/harbour/source/common/Makefile +++ b/harbour/source/common/Makefile @@ -7,6 +7,7 @@ ROOT = ../../ C_SOURCES=\ hbfhnd.c \ hbfsapi.c \ + hbfopen.c \ hbgete.c \ hbwince.c \ hbhash.c \ diff --git a/harbour/source/common/hbfopen.c b/harbour/source/common/hbfopen.c new file mode 100644 index 0000000000..d448198ae7 --- /dev/null +++ b/harbour/source/common/hbfopen.c @@ -0,0 +1,65 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * + * + * Copyright 2007 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbapifs.h" + +FILE * hb_fopen( const char *path, const char *mode ) +{ + BOOL fFree; + char * pszFile = ( char * ) hb_fsNameConv( ( BYTE * ) path, &fFree ); + FILE * file = fopen( pszFile, mode ); + + if( fFree ) + hb_xfree( pszFile ); + + return file; +} diff --git a/harbour/source/common/hbfsapi.c b/harbour/source/common/hbfsapi.c index 71c46be602..12ec9bde4c 100644 --- a/harbour/source/common/hbfsapi.c +++ b/harbour/source/common/hbfsapi.c @@ -279,11 +279,16 @@ HB_EXPORT char * hb_fsFNameMerge( char * pszFileName, PHB_FNAME pFileName ) HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) { + BOOL fExist; + BOOL fFree; + HB_TRACE(HB_TR_DEBUG, ("hb_fsFileExists(%p)", pszFileName)); if( pszFileName == NULL ) return FALSE; + pszFileName = ( char * ) hb_fsNameConv( ( BYTE * ) pszFileName, &fFree ); + #if defined( HB_OS_DOS ) { union REGS regs; @@ -295,26 +300,34 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) HB_DOS_INT86X( 0x21, ®s, ®s, &sregs ); - return regs.x.cflag == 0; + fExist = regs.x.cflag == 0; } #elif defined( HB_OS_WIN_32 ) { DWORD dwAttr; dwAttr = GetFileAttributesA( pszFileName ); - return ( dwAttr != INVALID_FILE_ATTRIBUTES ) && - ( dwAttr & ( FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE ) ) == 0; + fExist = ( dwAttr != INVALID_FILE_ATTRIBUTES ) && + ( dwAttr & ( FILE_ATTRIBUTE_DIRECTORY | + FILE_ATTRIBUTE_DEVICE ) ) == 0; } #elif defined( HB_OS_UNIX ) { struct stat statbuf; - return stat( pszFileName, &statbuf ) == 0 && - ( statbuf.st_mode & S_IFMT ) == S_IFREG; + fExist = stat( pszFileName, &statbuf ) == 0 && + S_ISREG( statbuf.st_mode ); } #else { - return FALSE; + int TODO; /* To force warning */ + + fExist = FALSE; } #endif + + if( fFree ) + hb_xfree( ( void * ) pszFileName ); + + return fExist; } diff --git a/harbour/source/common/hbtrace.c b/harbour/source/common/hbtrace.c index a71a55e073..288e04fed3 100644 --- a/harbour/source/common/hbtrace.c +++ b/harbour/source/common/hbtrace.c @@ -56,6 +56,7 @@ #include #include "hbapi.h" +#include "hbapifs.h" #include "hb_io.h" #include "hbtrace.h" @@ -115,7 +116,7 @@ int hb_tr_level( void ) env = hb_getenv( "HB_TR_OUTPUT" ); if( env != NULL && env[ 0 ] != '\0' ) { - s_fp = fopen( env, "w" ); + s_fp = hb_fopen( env, "w" ); if( s_fp == NULL ) s_fp = stderr; diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index bbeb0835c1..109309703d 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -70,7 +70,7 @@ void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the pFileName->szExtension = ".c"; hb_fsFNameMerge( szFileName, pFileName ); - yyc = fopen( szFileName, "wb" ); + yyc = hb_fopen( szFileName, "wb" ); if( ! yyc ) { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); diff --git a/harbour/source/compiler/gencobj.c b/harbour/source/compiler/gencobj.c index 73c764f4d4..1fbc8ab2e4 100644 --- a/harbour/source/compiler/gencobj.c +++ b/harbour/source/compiler/gencobj.c @@ -163,7 +163,7 @@ void hb_compGenCObj( HB_COMP_DECL, PHB_FNAME pFileName ) if( pszEnv && *hb_searchpath( pszCfgFileName, pszEnv, pszTemp ) ) { - filecfg = fopen( pszTemp, "rt" ); + filecfg = hb_fopen( pszTemp, "rt" ); if( ! filecfg ) { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OPEN_CFG, szFileName, NULL ); diff --git a/harbour/source/compiler/genhrb.c b/harbour/source/compiler/genhrb.c index 304ea201c7..fe7a8f28bf 100644 --- a/harbour/source/compiler/genhrb.c +++ b/harbour/source/compiler/genhrb.c @@ -141,7 +141,7 @@ void hb_compGenPortObj( HB_COMP_DECL, PHB_FNAME pFileName ) pFileName->szExtension = ".hrb"; hb_fsFNameMerge( szFileName, pFileName ); - yyc = fopen( szFileName, "wb" ); + yyc = hb_fopen( szFileName, "wb" ); if( ! yyc ) { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); diff --git a/harbour/source/compiler/genobj32.c b/harbour/source/compiler/genobj32.c index 55c4742bcc..cab9925390 100644 --- a/harbour/source/compiler/genobj32.c +++ b/harbour/source/compiler/genobj32.c @@ -72,7 +72,7 @@ void hb_compGenObj32( HB_COMP_DECL, PHB_FNAME pFileName ) pFileName->szExtension = ".obj"; hb_fsFNameMerge( szFileName, pFileName ); - if( ( hObjFile = fopen( szFileName, "wb" ) ) == NULL ) + if( ( hObjFile = hb_fopen( szFileName, "wb" ) ) == NULL ) { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; diff --git a/harbour/source/compiler/hbmain.c b/harbour/source/compiler/hbmain.c index f35e0631ec..56fdccd75e 100644 --- a/harbour/source/compiler/hbmain.c +++ b/harbour/source/compiler/hbmain.c @@ -209,7 +209,7 @@ static int hb_compProcessRSPFile( HB_COMP_DECL, char * szRspName ) szRspName = szFile; } - inFile = fopen( szRspName, "r" ); + inFile = hb_fopen( szRspName, "r" ); if( !inFile ) { char buffer[ _POSIX_PATH_MAX + 80 ]; diff --git a/harbour/source/main/harbour.c b/harbour/source/main/harbour.c index 9b0dff2d82..e1839be1da 100644 --- a/harbour/source/main/harbour.c +++ b/harbour/source/main/harbour.c @@ -51,6 +51,7 @@ */ #include "hbcomp.h" +#include "hbapifs.h" #include "hbmemory.ch" int main( int argc, char * argv[] ) @@ -360,3 +361,11 @@ char * hb_conNewLine( void ) { return "\n"; } + +HB_EXPORT BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree ) +{ + if( pfFree ) + * pfFree = FALSE; + + return szFileName; +} diff --git a/harbour/source/pp/hbppgen.c b/harbour/source/pp/hbppgen.c index afaf164b5c..445300c9d1 100644 --- a/harbour/source/pp/hbppgen.c +++ b/harbour/source/pp/hbppgen.c @@ -65,6 +65,7 @@ void * hb_xgrab( ULONG ulSize ) { return malloc( ulSize ); } void * hb_xrealloc( void * pMem, ULONG ulSize ) { return realloc( pMem, ulSize ); } void hb_xfree( void * pMem ) { free( pMem ); } +BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree ) { if( pfFree ) * pfFree = FALSE; return szFileName; } /* @@ -275,7 +276,7 @@ static int hb_pp_preprocesfile( PHB_PP_STATE pState, char * szRuleFile ) { FILE * foutr; - foutr = fopen( szRuleFile, "w" ); + foutr = hb_fopen( szRuleFile, "w" ); if( !foutr ) { #if !defined(__MINGW32CE__) && !defined(HB_WINCE) diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 68850dc990..e56e483e58 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -1804,7 +1804,7 @@ static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName, } } - file_in = fopen( szFileName, "r" ); + file_in = hb_fopen( szFileName, "r" ); #if !defined(__MINGW32CE__) && !defined(HB_WINCE) fNested = errno == EMFILE; #endif @@ -1825,7 +1825,7 @@ static PHB_PP_FILE hb_pp_FileNew( PHB_PP_STATE pState, char * szFileName, { pFileName->szPath = pPath->szPath; hb_fsFNameMerge( szFileNameBuf, pFileName ); - file_in = fopen( szFileNameBuf, "r" ); + file_in = hb_fopen( szFileNameBuf, "r" ); pPath = pPath->pNext; } } @@ -5223,7 +5223,7 @@ BOOL hb_pp_outFile( PHB_PP_STATE pState, const char * szOutFileName, if( file_out ) pState->file_out = file_out; else - pState->file_out = fopen( szOutFileName, "w" ); + pState->file_out = hb_fopen( szOutFileName, "w" ); if( pState->file_out ) { @@ -5252,7 +5252,7 @@ BOOL hb_pp_traceFile( PHB_PP_STATE pState, const char * szTraceFileName, FILE * if( file_trace ) pState->file_trace = file_trace; else - pState->file_trace = fopen( szTraceFileName, "w" ); + pState->file_trace = hb_fopen( szTraceFileName, "w" ); if( pState->file_trace ) { diff --git a/harbour/source/rtl/gtchrmap.c b/harbour/source/rtl/gtchrmap.c index 91c47572aa..ef5b54aebf 100644 --- a/harbour/source/rtl/gtchrmap.c +++ b/harbour/source/rtl/gtchrmap.c @@ -55,10 +55,7 @@ /* NOTE: User programs should never call this layer directly! */ #include "hbgtcore.h" - -#include -#include -#include +#include "hbapifs.h" #define MAX_CHAR_VAL 0xff #define HB_CHRMAP(a,c) ( ( (a) << 16 ) | (c) ) @@ -377,7 +374,7 @@ static int hb_gt_chrmapread( const char *pszFile, const char *pszTerm, int *nTra char buf[256], *ptr, *pTerm; int isTerm = -1; - fp = fopen( pszFile, "r" ); + fp = hb_fopen( pszFile, "r" ); if( fp != NULL ) { diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index eeae480756..00a181b71b 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -82,6 +82,7 @@ #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" +#include "hbapifs.h" #include "hbstack.h" #include "hbapierr.h" #include "hbmemory.ch" @@ -582,7 +583,7 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ FILE *hLog = NULL; if( s_lMemoryBlocks ) - hLog = fopen( "fm.log", "a+" ); + hLog = hb_fopen( "fm.log", "a+" ); hb_conOutErr( hb_conNewLine(), 0 ); hb_conOutErr( "----------------------------------------", 0 ); diff --git a/harbour/utils/hbpp/hbpp.c b/harbour/utils/hbpp/hbpp.c index 5a5ba9563d..00377ab924 100644 --- a/harbour/utils/hbpp/hbpp.c +++ b/harbour/utils/hbpp/hbpp.c @@ -519,6 +519,14 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ hb_compGenError( NULL, hb_pp_szErrors, 'P', HB_PP_ERR_MEMFREE, NULL, NULL ); } +BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree ) +{ + if( pfFree ) + * pfFree = FALSE; + + return szFileName; +} + static BOOL hb_pp_fopen( char * szFileName ) { PFILE pFile;