2012-11-23 15:26 UTC+0100 Viktor Szakats (harbour syenar.net)

* include/hbwinuni.h
    + new HB_WINAPI_KERNEL32_DLL() macro to get kernel32.dll
      regardless of UNICODE or non-UNICODE mode

  * contrib/hbwin/wapi_winbase.c
  * src/rtl/diskspac.c
  * src/rtl/disksphb.c
    % use HB_WINAPI_KERNEL32_DLL() macro
    ! fixed a non-UNICODE bug that slipped in previous commit

  * src/rtl/direct.c
    * made it format well using uncrustify

  * src/vm/asort.c
  * src/vm/memvars.c
    * cleanups
This commit is contained in:
Viktor Szakats
2012-11-23 14:28:51 +00:00
parent ef46ac3a3a
commit 9536bad91a
8 changed files with 48 additions and 57 deletions

View File

@@ -10,6 +10,24 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2012-11-23 15:26 UTC+0100 Viktor Szakats (harbour syenar.net)
* include/hbwinuni.h
+ new HB_WINAPI_KERNEL32_DLL() macro to get kernel32.dll
regardless of UNICODE or non-UNICODE mode
* contrib/hbwin/wapi_winbase.c
* src/rtl/diskspac.c
* src/rtl/disksphb.c
% use HB_WINAPI_KERNEL32_DLL() macro
! fixed a non-UNICODE bug that slipped in previous commit
* src/rtl/direct.c
* made it format well using uncrustify
* src/vm/asort.c
* src/vm/memvars.c
* cleanups
2012-11-23 14:07 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbfbird/firebird.c
* contrib/hbmisc/hb_f.c

View File

@@ -385,12 +385,7 @@ HB_FUNC( WAPI_GETLONGPATHNAME )
{
s_getPathNameAddr =
( _HB_GETPATHNAME )
GetProcAddress(
#if defined( UNICODE )
GetModuleHandle( hb_iswin9x() ? TEXT( "unicows.dll" ) : TEXT( "kernel32.dll" ) ),
#else
GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ),
#endif
GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ),
HB_WINAPI_FUNCTION_NAME( "GetLongPathName" ) );
if( ! s_getPathNameAddr )

View File

@@ -90,6 +90,7 @@
#define HB_OSSTRDUP( str ) hb_osStrU16Decode( str )
#define HB_OSSTRDUP2( str, buf, len ) hb_osStrU16Decode2( str, buf, len )
#define HB_WINAPI_FUNCTION_NAME( a ) ( a "W" )
#define HB_WINAPI_KERNEL32_DLL() ( hb_iswin9x() ? TEXT( "unicows.dll" ) : TEXT( "kernel32.dll" ) )
#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 ) )
@@ -121,6 +122,7 @@
#define HB_OSSTRDUP( str ) hb_osStrDecode( str )
#define HB_OSSTRDUP2( str, buf, len ) hb_osStrDecode2( str, buf, len )
#define HB_WINAPI_FUNCTION_NAME( a ) ( a "A" )
#define HB_WINAPI_KERNEL32_DLL() ( TEXT( "kernel32.dll" ) )
#endif
#endif /* HB_OS_WIN */

View File

@@ -105,27 +105,27 @@
HB_FUNC( DIRECTORY )
{
const char * szDirSpec = hb_parc( 1 );
const char * szAttributes = hb_parc( 2 );
char * pszFree = NULL;
HB_FATTR ulMask;
const char * szDirSpec = hb_parc( 1 );
const char * szAttributes = hb_parc( 2 );
char * pszFree = NULL;
HB_FATTR ulMask;
PHB_ITEM pDir = hb_itemArrayNew( 0 );
PHB_FFIND ffind;
/* Get the passed attributes and convert them to Harbour Flags */
ulMask = HB_FA_ARCHIVE
| HB_FA_READONLY
| HB_FA_DEVICE
| HB_FA_TEMPORARY
| HB_FA_SPARSE
| HB_FA_REPARSE
| HB_FA_COMPRESSED
| HB_FA_OFFLINE
| HB_FA_NOTINDEXED
| HB_FA_ENCRYPTED
| HB_FA_VOLCOMP;
ulMask = HB_FA_ARCHIVE |
HB_FA_READONLY |
HB_FA_DEVICE |
HB_FA_TEMPORARY |
HB_FA_SPARSE |
HB_FA_REPARSE |
HB_FA_COMPRESSED |
HB_FA_OFFLINE |
HB_FA_NOTINDEXED |
HB_FA_ENCRYPTED |
HB_FA_VOLCOMP;
if( szAttributes && *szAttributes )
ulMask |= hb_fsAttrEncode( szAttributes );
@@ -145,7 +145,7 @@ HB_FUNC( DIRECTORY )
if( szDirSpec[ nLen ] == HB_OS_PATH_DELIM_CHR )
#endif
szDirSpec = pszFree =
hb_xstrcpy( NULL, szDirSpec, HB_OS_ALLFILE_MASK, NULL );
hb_xstrcpy( NULL, szDirSpec, HB_OS_ALLFILE_MASK, NULL );
}
}
else
@@ -161,12 +161,12 @@ HB_FUNC( DIRECTORY )
{
char buffer[ 32 ];
hb_arrayNew( pSubarray, F_LEN );
hb_arraySetC ( pSubarray, F_NAME, ffind->szName );
hb_arrayNew( pSubarray, F_LEN );
hb_arraySetC( pSubarray, F_NAME, ffind->szName );
hb_arraySetNInt( pSubarray, F_SIZE, ffind->size );
hb_arraySetDL ( pSubarray, F_DATE, ffind->lDate );
hb_arraySetC ( pSubarray, F_TIME, ffind->szTime );
hb_arraySetC ( pSubarray, F_ATTR, hb_fsAttrDecode( ffind->attr, buffer ) );
hb_arraySetDL( pSubarray, F_DATE, ffind->lDate );
hb_arraySetC( pSubarray, F_TIME, ffind->szTime );
hb_arraySetC( pSubarray, F_ATTR, hb_fsAttrDecode( ffind->attr, buffer ) );
/* Don't exit when array limit is reached */
hb_arrayAddForward( pDir, pSubarray );

View File

@@ -169,12 +169,7 @@ HB_FUNC( DISKSPACE )
{
s_pGetDiskFreeSpaceEx =
( P_GDFSE )
GetProcAddress(
#if defined( UNICODE )
GetModuleHandle( hb_iswin9x() ? TEXT( "unicows.dll" ) : TEXT( "kernel32.dll" ) ),
#else
GetModuleHandle( TEXT( "kernel32.dll" ) ),
#endif
GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ),
HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) );
s_fInit = HB_TRUE;
}

View File

@@ -66,8 +66,8 @@
#include <sys/statvfs.h>
#endif
#elif defined( HB_OS_WIN )
#include "hbwinuni.h"
#include <windows.h>
#include "hbwinuni.h"
#if defined( HB_OS_WIN_CE )
#include "hbwince.h"
#endif
@@ -128,13 +128,8 @@ HB_FUNC( HB_DISKSPACE )
{
s_pGetDiskFreeSpaceEx =
( P_GDFSE )
GetProcAddress(
#if defined( UNICODE )
GetModuleHandle( hb_iswin9x() ? TEXT( "unicows.dll" ) : TEXT( "kernel32.dll" ) ),
#else
GetModuleHandle( TEXT( "kernel32.dll" ) ),
#endif
HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) );
GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ),
HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) );
s_fInit = HB_TRUE;
}

View File

@@ -151,19 +151,13 @@ static HB_ISIZ hb_arraySortQuickPartition( PHB_BASEARRAY pBaseArray, HB_ISIZ lb,
for( ;; )
{
while( j >= i && ! hb_itemIsLess( pBaseArray->pItems + j, pBaseArray->pItems + lb, pBlock, pBaseArray, j ) )
{
j--;
}
while( i < j && ! hb_itemIsLess( pBaseArray->pItems + lb, pBaseArray->pItems + i, pBlock, pBaseArray, i ) )
{
i++;
}
if( i >= j )
{
break;
}
/* Swap the items */
hb_itemSwap( pBaseArray->pItems + i, pBaseArray->pItems + j );
@@ -171,7 +165,7 @@ static HB_ISIZ hb_arraySortQuickPartition( PHB_BASEARRAY pBaseArray, HB_ISIZ lb,
i++;
}
/* pivot belongs in pBaseArray->pItems[j] */
/* pivot belongs in pBaseArray->pItems[ j ] */
if( j > lb && pBaseArray->nLen > ( HB_SIZE ) j )
hb_itemSwap( pBaseArray->pItems + lb, pBaseArray->pItems + j );
@@ -222,7 +216,7 @@ HB_BOOL hb_arraySort( PHB_ITEM pArray, HB_SIZE * pnStart, HB_SIZE * pnCount, PHB
HB_SIZE nCount;
HB_SIZE nEnd;
if( pnStart && ( *pnStart >= 1 ) )
if( pnStart && *pnStart >= 1 )
nStart = *pnStart;
else
nStart = 1;

View File

@@ -389,7 +389,6 @@ void hb_memvarSetValue( PHB_SYMB pMemvarSymb, PHB_ITEM pItem )
/* assignment to undeclared memvar - PRIVATE is assumed */
hb_memvarCreateFromDynSymbol( pDyn, VS_PRIVATE, pItem );
}
}
else
hb_errInternal( HB_EI_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
@@ -407,7 +406,6 @@ HB_ERRCODE hb_memvarGet( PHB_ITEM pItem, PHB_SYMB pMemvarSymb )
{
PHB_ITEM pMemvar;
pMemvar = hb_dynsymGetMemvar( pDyn );
HB_TRACE( HB_TR_INFO, ( "Memvar item (%p)(%s) queried", pMemvar, pMemvarSymb->szName ) );
@@ -558,22 +556,16 @@ static PHB_DYNS hb_memvarFindSymbol( const char * szArg, HB_SIZE nLen )
char cChar = *szArg++;
if( cChar >= 'a' && cChar <= 'z' )
{
szUprName[ iSize++ ] = cChar - ( 'a' - 'A' );
}
else if( cChar == ' ' || cChar == '\t' || cChar == '\n' )
{
if( iSize )
break;
}
else if( ! cChar )
{
break;
}
else
{
szUprName[ iSize++ ] = cChar;
}
}
while( --nLen && iSize < HB_SYMBOL_NAME_LEN );