2008-02-13 14:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/direct.c
    * fixed Clipper compatibility when last character of given path
      is directory delimiter or drive delimiter

  * harbour/source/rdd/dbf1.c
    * added RT error when corrupted memo block address is detected
      in DBF file.
This commit is contained in:
Przemyslaw Czerpak
2008-02-13 13:03:38 +00:00
parent e73dd4e363
commit d0450cff7c
3 changed files with 74 additions and 12 deletions

View File

@@ -8,6 +8,15 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-02-13 14:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/direct.c
* fixed Clipper compatibility when last character of given path
is directory delimiter or drive delimiter
* harbour/source/rdd/dbf1.c
* added RT error when corrupted memo block address is detected
in DBF file.
2008-02-12 08:04 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/contrib/hbwhat32/make_gcc.sh
! Fixed compilation under MingW and Cygwin

View File

@@ -1103,7 +1103,20 @@ HB_EXPORT ERRCODE hb_dbfGetMemoData( DBFAREAP pArea, USHORT uiIndex,
if( bByte >= '0' && bByte <= '9' )
ulValue = ulValue * 10 + ( bByte - '0' );
else if( bByte != ' ' || ulValue )
return FAILURE;
{
PHB_ITEM pError = hb_errNew();
ERRCODE uiError;
hb_errPutGenCode( pError, EG_CORRUPTION );
hb_errPutSubCode( pError, EDBF_CORRUPT );
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_CORRUPTION ) );
hb_errPutFileName( pError, pArea->szDataFileName );
hb_errPutFlags( pError, EF_CANDEFAULT );
uiError = SELF_ERROR( ( AREAP ) pArea, pError );
hb_itemRelease( pError );
return uiError == E_DEFAULT ? SUCCESS : FAILURE;
}
}
*pulBlock = ulValue;
}

View File

@@ -98,12 +98,6 @@
#include "directry.ch"
#if defined( HB_OS_UNIX )
#define HB_DIR_ALL_FILES_MASK "*"
#else
#define HB_DIR_ALL_FILES_MASK "*.*"
#endif
/* NOTE: 8.3 three support should be added in a separate way, like
as a function which converts full names to 8.3 names, since
this issue is very much platform specific, and this is
@@ -111,8 +105,9 @@
HB_FUNC( DIRECTORY )
{
PHB_ITEM pDirSpec = hb_param( 1, HB_IT_STRING );
PHB_ITEM pAttributes = hb_param( 2, HB_IT_STRING );
char * szDirSpec = hb_parc( 1 );
char * szAttributes = hb_parc( 2 );
BOOL fFree = FALSE;
USHORT uiMask;
PHB_ITEM pDir = hb_itemArrayNew( 0 );
@@ -132,18 +127,60 @@ HB_FUNC( DIRECTORY )
| HB_FA_ENCRYPTED
| HB_FA_VOLCOMP;
if( pAttributes && hb_itemGetCLen( pAttributes ) > 0 )
if( szAttributes && *szAttributes )
{
if ( ( uiMask |= hb_fsAttrEncode( hb_itemGetCPtr( pAttributes ) ) ) & HB_FA_LABEL )
if( ( uiMask |= hb_fsAttrEncode( szAttributes ) ) & HB_FA_LABEL )
{
/* NOTE: This is Clipper Doc compatible. (not operationally) */
uiMask = HB_FA_LABEL;
}
}
if( szDirSpec && *szDirSpec )
{
szDirSpec = ( char * ) hb_fsNameConv( ( BYTE * ) szDirSpec, &fFree );
if( *szDirSpec )
{
/* CA-Cl*pper compatible behavior - add all file mask when
* last character is directory or drive separator
*/
int iLen = strlen( szDirSpec ) - 1;
#ifdef OS_HAS_DRIVE_LETTER
if( szDirSpec[iLen] == OS_PATH_DELIMITER ||
szDirSpec[iLen] == OS_DRIVE_DELIMITER )
#else
if( szDirSpec[iLen] == OS_PATH_DELIMITER )
#endif
{
if( fFree )
{
char * szTemp = hb_xstrcpy( NULL, szDirSpec, OS_FILE_MASK, NULL );
hb_xfree( szDirSpec );
szDirSpec = szTemp;
}
else
{
szDirSpec = hb_xstrcpy( NULL, szDirSpec, OS_FILE_MASK, NULL );
fFree = TRUE;
}
}
}
else
{
if( fFree )
{
hb_xfree( szDirSpec );
fFree = FALSE;
}
szDirSpec = ( char * ) OS_FILE_MASK;
}
}
else
szDirSpec = ( char * ) OS_FILE_MASK;
/* Get the file list */
if( ( ffind = hb_fsFindFirst( pDirSpec ? hb_itemGetCPtr( pDirSpec ) : HB_DIR_ALL_FILES_MASK, uiMask ) ) != NULL )
if( ( ffind = hb_fsFindFirst( szDirSpec, uiMask ) ) != NULL )
{
PHB_ITEM pSubarray = hb_itemNew( NULL );
@@ -168,5 +205,8 @@ HB_FUNC( DIRECTORY )
hb_fsFindClose( ffind );
}
if( fFree )
hb_xfree( szDirSpec );
hb_itemReturnRelease( pDir );
}