2014-06-27 12:45 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/common/hbfopen.c
* use _wfopen() instead of fopen() in MS-Windows UNICODE builds of
hb_fopen(). It means that now hb_fopen() makes exactly the same file
name conversions as hb_fs*() Harbour RTL functions, i.e. hb_fsOpen()
* contrib/hbmxml/core.c
! fixed unnecessary conversions to UTF8 used for file names passed
to hb_fopen()
* contrib/hbmzip/3rd/minizip/ioapi.c
* contrib/hbmzip/3rd/minizip/minizip.dif
! fixed wrongly used hb_fopen() instead of fopen() what caused double
file name conversions when 32-bit stdio API was used.
This commit is contained in:
@@ -53,20 +53,51 @@
|
||||
#endif
|
||||
|
||||
#include "hbapifs.h"
|
||||
#include "hbvm.h"
|
||||
#if defined( HB_OS_WIN )
|
||||
#include <windows.h>
|
||||
#include "hbwinuni.h"
|
||||
#endif
|
||||
|
||||
FILE * hb_fopen( const char * path, const char * mode )
|
||||
{
|
||||
char * pszFree = NULL;
|
||||
FILE * file;
|
||||
|
||||
path = hb_fsNameConv( path, &pszFree );
|
||||
#if defined( _MSC_VER ) && _MSC_VER >= 1400 && ! defined( _CRT_SECURE_NO_WARNINGS )
|
||||
fopen_s( &file, path, mode );
|
||||
#if defined( HB_OS_WIN ) && defined( UNICODE ) && !defined( __XCC__ )
|
||||
LPCTSTR lpPath, lpMode;
|
||||
LPTSTR lpFreeP, lpFreeM;
|
||||
|
||||
lpPath = HB_FSNAMECONV( path, &lpFreeP );
|
||||
lpMode = HB_FSNAMECONV( mode, &lpFreeM );
|
||||
|
||||
hb_vmUnlock();
|
||||
#if defined( _MSC_VER ) && _MSC_VER >= 1400 && ! defined( _CRT_SECURE_NO_WARNINGS )
|
||||
_wfopen_s( &file, lpPath, lpMode );
|
||||
#else
|
||||
file = _wfopen( lpPath, lpMode );
|
||||
#endif
|
||||
hb_vmLock();
|
||||
|
||||
if( lpFreeP )
|
||||
hb_xfree( lpFreeP );
|
||||
if( lpFreeM )
|
||||
hb_xfree( lpFreeM );
|
||||
#else
|
||||
file = fopen( path, mode );
|
||||
#endif
|
||||
char * pszFree = NULL;
|
||||
|
||||
path = hb_fsNameConv( path, &pszFree );
|
||||
|
||||
hb_vmUnlock();
|
||||
#if defined( _MSC_VER ) && _MSC_VER >= 1400 && ! defined( _CRT_SECURE_NO_WARNINGS )
|
||||
fopen_s( &file, path, mode );
|
||||
#else
|
||||
file = fopen( path, mode );
|
||||
#endif
|
||||
hb_vmLock();
|
||||
|
||||
if( pszFree )
|
||||
hb_xfree( pszFree );
|
||||
#endif
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user