From 3f5f68133f74b078e4e50533f0c040bc89e9ab70 Mon Sep 17 00:00:00 2001 From: Paul Tucker Date: Tue, 15 Jan 2002 02:53:56 +0000 Subject: [PATCH] 2002-01-14 21:53 UTC-0500 Paul Tucker * source\common\hbffind.c * replaced 3 literals with proper defines * minor formatting. --- harbour/ChangeLog | 7 +- harbour/source/common/hbffind.c | 137 ++++++++++++++++---------------- 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fa8e458db2..46190ad7a8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,7 +8,12 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ * cBuffer not initialized, fixed. -2002-01-14 31:32 UTC-0500 Paul Tucker + +2002-01-16 00:44 UTC+0100 Maurilio Longo + * common/hbffind.c + ! DosFindFirst() call on OS/2 section of file was wrong (parameter findcount was not + set to any correct value) + NOTE: OS/2 builds of Alpha 38 _are broken_ because of this bug 2002-01-15 22:30 UTC+0300 Alexander Kresin * contrib/rdd_ads/ads1.c diff --git a/harbour/source/common/hbffind.c b/harbour/source/common/hbffind.c index 0d5086392d..bb05ad11a2 100644 --- a/harbour/source/common/hbffind.c +++ b/harbour/source/common/hbffind.c @@ -600,7 +600,7 @@ PHB_FFIND hb_fsFindFirst( const char * pszFileName, USHORT uiAttr ) if( info->hFindFile != INVALID_HANDLE_VALUE ) { if( info->dwAttr == 0 || - ( info->pFindFileData.dwFileAttributes == 0x80 ) || + ( info->pFindFileData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ) || ( info->dwAttr & info->pFindFileData.dwFileAttributes )) { bFound = TRUE; @@ -612,7 +612,7 @@ PHB_FFIND hb_fsFindFirst( const char * pszFileName, USHORT uiAttr ) while( FindNextFile( info->hFindFile, &info->pFindFileData ) ) { if( info->dwAttr == 0 || - ( info->pFindFileData.dwFileAttributes == 0x80 ) || + ( info->pFindFileData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ) || ( info->dwAttr & info->pFindFileData.dwFileAttributes ) ) { bFound = TRUE; @@ -663,56 +663,57 @@ PHB_FFIND hb_fsFindFirst( const char * pszFileName, USHORT uiAttr ) strcpy( pattern, "*.*" ); if( strlen( pattern ) > 0 ) - { - strcpy( string, pattern ); - pos = strrchr( string, '.' ); - if( pos ) - { - strcpy( info->pfext, pos + 1 ); - *pos = '\0'; - strcpy( info->pfname, string ); - } - else - { - strcpy( info->pfname, string ); - info->pfext[ 0 ] = '\0'; - } - } + { + strcpy( string, pattern ); + pos = strrchr( string, '.' ); + if( pos ) + { + strcpy( info->pfext, pos + 1 ); + *pos = '\0'; + strcpy( info->pfname, string ); + } + else + { + strcpy( info->pfname, string ); + info->pfext[ 0 ] = '\0'; + } + } - if( strlen( info->pfname ) < 1 ) - strcpy( info->pfname, "*" ); + if( strlen( info->pfname ) < 1 ) + strcpy( info->pfname, "*" ); tzset(); info->dir = opendir( dirname ); if( info->dir != NULL) + while( ( info->entry = readdir( info->dir ) ) != NULL ) + { + strcpy( string, info->entry->d_name ); + pos = strrchr( string, OS_PATH_DELIMITER ); + pos = strrchr( pos ? ( pos + 1 ) : string, '.' ); - while( ( info->entry = readdir( info->dir ) ) != NULL ){ - strcpy( string, info->entry->d_name ); - pos = strrchr( string, OS_PATH_DELIMITER ); - pos = strrchr( pos ? ( pos + 1 ) : string, '.' ); + if( pos && ! ( pos == &string[ 0 ] ) ) + { + strcpy( fext, pos + 1 ); + *pos = '\0'; + } + else + fext[ 0 ] = '\0'; - if( pos && ! ( pos == &string[ 0 ] ) ) - { - strcpy( fext, pos + 1 ); - *pos = '\0'; - } - else - fext[ 0 ] = '\0'; + pos = strrchr( string, OS_PATH_DELIMITER ); + strcpy( fname, pos ? ( pos + 1 ) : string ); - pos = strrchr( string, OS_PATH_DELIMITER ); - strcpy( fname, pos ? ( pos + 1 ) : string ); + if( !*fname ) + strcpy( fname, "*" ); - if( !*fname ) - strcpy( fname, "*" ); - - /* TOFIX: uiAttr check */ - if( hb_strMatchRegExp( fname, info->pfname ) && hb_strMatchRegExp( fext, info->pfext ) ) { - bFound=TRUE; - break; + /* TOFIX: uiAttr check */ + if( hb_strMatchRegExp( fname, info->pfname ) && hb_strMatchRegExp( fext, info->pfext ) ) + { + bFound=TRUE; + break; } - } + } else bFound = FALSE; } @@ -777,7 +778,7 @@ BOOL hb_fsFindNext( PHB_FFIND ffind ) while( FindNextFile( info->hFindFile, &info->pFindFileData ) ) { if( info->dwAttr == 0 || - ( info->pFindFileData.dwFileAttributes == 0x80 ) || + ( info->pFindFileData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ) || ( info->dwAttr & info->pFindFileData.dwFileAttributes )) { bFound = TRUE; @@ -797,36 +798,36 @@ BOOL hb_fsFindNext( PHB_FFIND ffind ) bFound=FALSE; - while( ( info->entry = readdir( info->dir ) ) != NULL ) - { + while( ( info->entry = readdir( info->dir ) ) != NULL ) + { - strcpy( string, info->entry->d_name ); - pos = strrchr( string, OS_PATH_DELIMITER ); - pos = strrchr( pos ? ( pos + 1 ) : string, '.' ); - - if( pos && ! ( pos == &string[ 0 ] ) ) - { - strcpy( fext, pos + 1 ); - *pos = '\0'; - } - else - fext[ 0 ] = '\0'; - - pos = strrchr( string, OS_PATH_DELIMITER ); - strcpy( fname, pos ? ( pos + 1 ) : string ); - if( !*fname ) - strcpy( fname, "*" ); - - /* TOFIX: uiAttr check */ - bTest=hb_strMatchRegExp( fname, info->pfname ) && hb_strMatchRegExp( fext, info->pfext ) ; - - if (bTest) - { - bFound=TRUE; - break; - } + strcpy( string, info->entry->d_name ); + pos = strrchr( string, OS_PATH_DELIMITER ); + pos = strrchr( pos ? ( pos + 1 ) : string, '.' ); + if( pos && ! ( pos == &string[ 0 ] ) ) + { + strcpy( fext, pos + 1 ); + *pos = '\0'; } + else + fext[ 0 ] = '\0'; + + pos = strrchr( string, OS_PATH_DELIMITER ); + strcpy( fname, pos ? ( pos + 1 ) : string ); + if( !*fname ) + strcpy( fname, "*" ); + + /* TOFIX: uiAttr check */ + bTest=hb_strMatchRegExp( fname, info->pfname ) && hb_strMatchRegExp( fext, info->pfext ) ; + + if( bTest ) + { + bFound=TRUE; + break; + } + + } }