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:
@@ -10,6 +10,21 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
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.
|
||||
|
||||
2014-06-26 18:42 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbwin/olecore.c
|
||||
+ added some additional error codes to win_oleErrorText() function
|
||||
|
||||
@@ -736,7 +736,6 @@ static mxml_type_t type_cb( mxml_node_t * node )
|
||||
|
||||
HB_FUNC( MXMLLOADFILE )
|
||||
{
|
||||
void * hFree;
|
||||
mxml_node_t * node_top;
|
||||
mxml_node_t * node;
|
||||
mxml_load_cb_t cb = MXML_NO_CALLBACK;
|
||||
@@ -775,7 +774,7 @@ HB_FUNC( MXMLLOADFILE )
|
||||
}
|
||||
}
|
||||
|
||||
file = hb_fopen( hb_parstr_utf8( 2, &hFree, NULL ), "rb" );
|
||||
file = hb_fopen( hb_parc( 2 ), "rb" );
|
||||
if( file )
|
||||
{
|
||||
node = mxmlLoadFile( node_top, file, cb );
|
||||
@@ -786,7 +785,6 @@ HB_FUNC( MXMLLOADFILE )
|
||||
}
|
||||
|
||||
pCbs->type_cb = NULL;
|
||||
hb_strfree( hFree );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1135,7 +1133,6 @@ static void sax_cb( mxml_node_t * node, mxml_sax_event_t event, void * data )
|
||||
|
||||
HB_FUNC( MXMLSAXLOADFILE )
|
||||
{
|
||||
void * hFree;
|
||||
mxml_node_t * node_top;
|
||||
mxml_node_t * node;
|
||||
mxml_load_cb_t cb = MXML_NO_CALLBACK;
|
||||
@@ -1182,7 +1179,7 @@ HB_FUNC( MXMLSAXLOADFILE )
|
||||
cb_sax = sax_cb;
|
||||
}
|
||||
|
||||
file = hb_fopen( hb_parstr_utf8( 2, &hFree, NULL ), "rb" );
|
||||
file = hb_fopen( hb_parc( 2 ), "rb" );
|
||||
if( file )
|
||||
{
|
||||
node = mxmlSAXLoadFile( node_top, file, cb, cb_sax, pData );
|
||||
@@ -1194,8 +1191,6 @@ HB_FUNC( MXMLSAXLOADFILE )
|
||||
|
||||
pCbs->type_cb = NULL;
|
||||
pCbs->sax_cb = NULL;
|
||||
|
||||
hb_strfree( hFree );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1357,7 +1352,6 @@ HB_FUNC( MXMLSAVEFILE )
|
||||
{
|
||||
mxml_node_t * node = mxml_node_param( 1 );
|
||||
FILE * file;
|
||||
void * hFree;
|
||||
|
||||
if( node && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
@@ -1370,7 +1364,7 @@ HB_FUNC( MXMLSAVEFILE )
|
||||
cb = save_cb;
|
||||
}
|
||||
|
||||
file = hb_fopen( hb_parstr_utf8( 2, &hFree, NULL ), "wb" );
|
||||
file = hb_fopen( hb_parc( 2 ), "wb" );
|
||||
if( file )
|
||||
{
|
||||
hb_retni( mxmlSaveFile( node, file, cb ) );
|
||||
@@ -1383,7 +1377,6 @@ HB_FUNC( MXMLSAVEFILE )
|
||||
hb_strfree( pCbs->hText );
|
||||
pCbs->hText = NULL;
|
||||
}
|
||||
hb_strfree( hFree );
|
||||
}
|
||||
else
|
||||
MXML_ERR_ARGS;
|
||||
|
||||
@@ -110,7 +110,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = hb_fopen(filename, mode_fopen);
|
||||
file = fopen(filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,15 +31,6 @@ diff -urN minizip.orig/ioapi.c minizip/ioapi.c
|
||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||
mode_fopen = "rb";
|
||||
else
|
||||
@@ -106,7 +110,7 @@
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
- file = fopen(filename, mode_fopen);
|
||||
+ file = hb_fopen(filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -114,6 +118,9 @@
|
||||
{
|
||||
FILE* file = NULL;
|
||||
|
||||
@@ -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