From bee89c95db796ceead21d5f4bf7851a9c999d933 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 23 Nov 2009 13:06:05 +0000 Subject: [PATCH] 2009-11-23 14:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/filesys.c % eliminated memory allocation from hb_fsCurDirBuff() if non UNICODE WIN32 API is used --- harbour/ChangeLog | 5 +++++ harbour/src/rtl/filesys.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a739c8e9fe..15e6279ff3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-23 14:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/filesys.c + % eliminated memory allocation from hb_fsCurDirBuff() if non UNICODE + WIN32 API is used + 2009-11-23 13:15 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/beos/gcc.mk * config/bsd/gcc.mk diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 987d143cb3..dd6f37ca00 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -2731,13 +2731,20 @@ HB_ERRCODE hb_fsCurDirBuff( USHORT uiDrive, char * pszBuffer, ULONG ulSize ) #if defined( HB_OS_WIN ) { +#if defined( UNICODE ) LPTSTR lpBuffer = ( LPTSTR ) hb_xgrab( ulSize * sizeof( TCHAR ) ); hb_vmUnlock(); fResult = GetCurrentDirectory( ulSize, lpBuffer ); hb_fsSetIOError( fResult, 0 ); hb_vmLock(); - HB_TCHAR_GETFROM( pszBuffer, lpBuffer, ulSize ); + hb_wctombget( pszBuffer, lpBuffer, ulSize ); hb_xfree( lpBuffer ); +#else + hb_vmUnlock(); + fResult = GetCurrentDirectory( ulSize, pszBuffer ); + hb_fsSetIOError( fResult, 0 ); + hb_vmLock(); +#endif } #elif defined( HB_OS_OS2 ) && defined( __GNUC__ )