2015-09-17 12:23 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbapicls.h
* src/vm/classes.c
* minor modification in variable name
* src/rtl/filebuf.c
* src/rtl/fscopy.c
* src/rtl/fslink.c
* src/rtl/vfile.c
* cleaned FError() setting. It should not be changed by C file IO
functions because they can be activated from RDD code so accessing
work area field could change the FError() result, i.e. this code
does not work when FError() is changed by C level IO operations:
AnyFunc( FSeek( hFile, 0, FS_END ), field->MEMOVAL, FError() )
Even simple field access may cause file IO operations in RDD code
when relations are set because records in child area are repositioned
only when necessary (when user tries to make some operations on this
area). In the past RDD code was full of constructions like:
uiSaveError = hb_fsFError();
// make some IO operations
hb_fsSetFerror( uiSaveError );
to eliminate such overhead I separated PRG level FError() from
C level IOError(). Please keep it.
* ChangeLog.txt
! few typos
This commit is contained in:
@@ -10,6 +10,33 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2015-09-17 12:23 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* include/hbapicls.h
|
||||
* src/vm/classes.c
|
||||
* minor modification in variable name
|
||||
|
||||
* src/rtl/filebuf.c
|
||||
* src/rtl/fscopy.c
|
||||
* src/rtl/fslink.c
|
||||
* src/rtl/vfile.c
|
||||
* cleaned FError() setting. It should not be changed by C file IO
|
||||
functions because they can be activated from RDD code so accessing
|
||||
work area field could change the FError() result, i.e. this code
|
||||
does not work when FError() is changed by C level IO operations:
|
||||
AnyFunc( FSeek( hFile, 0, FS_END ), field->MEMOVAL, FError() )
|
||||
Even simple field access may cause file IO operations in RDD code
|
||||
when relations are set because records in child area are repositioned
|
||||
only when necessary (when user tries to make some operations on this
|
||||
area). In the past RDD code was full of constructions like:
|
||||
uiSaveError = hb_fsFError();
|
||||
// make some IO operations
|
||||
hb_fsSetFerror( uiSaveError );
|
||||
to eliminate such overhead I separated PRG level FError() from
|
||||
C level IOError(). Please keep it.
|
||||
|
||||
* ChangeLog.txt
|
||||
! few typos
|
||||
|
||||
2015-09-17 10:58 UTC+0200 Tamas TEVESZ (ice extreme.hu)
|
||||
* contrib/gtqtc/gtqtc.hbp
|
||||
+ Qt5 include path on FreeBSD
|
||||
@@ -95,7 +122,7 @@
|
||||
|
||||
2015-09-09 12:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/common/hbfsapi.c
|
||||
* pacified warnings OS2 warnings reported by David
|
||||
* pacified OS2 warnings reported by David
|
||||
|
||||
2015-09-09 01:29 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/rtl/filesys.c
|
||||
@@ -112,8 +139,8 @@
|
||||
* include/hbapifs.h
|
||||
* src/common/hbfsapi.c
|
||||
+ added new C function for OS2 builds: hb_fsOS2QueryPathInfo()
|
||||
Unlike DosQueryPathInfo() it uses dir entries so it does not need to
|
||||
open the file what can create file sharing violation problem.
|
||||
Unlike DosQueryPathInfo() it uses dir entries so it does not need
|
||||
to open the file what can create file sharing violation problem.
|
||||
+ added new C function for OS2 builds: hb_isWSeB()
|
||||
It returns true if OS2 version supports long file API
|
||||
(IBM OS/2 Warp Server for e-Business)
|
||||
@@ -12007,7 +12034,7 @@
|
||||
all object instance variables also overloaded by other classes
|
||||
so they can be accessed only with super class casting or by
|
||||
nonvirtual messages. It means that above functions create fully
|
||||
functional serialization system and can be used as backed for
|
||||
functional serialization system and can be used as backend for
|
||||
HB_SERIALIZE() and HB_VALTOEXP() when objects are serialized.
|
||||
Such serialization consumes more time and needs more memory but
|
||||
objects can be deserialized by modified code which uses slightly
|
||||
@@ -82632,7 +82659,7 @@
|
||||
* harbour/contrib/rddsql/sddodbc/sddodbc.c
|
||||
* harbour/contrib/rddsql/sddpg/sddpg.c
|
||||
* harbour/contrib/rddsql/sddsqlt3/sddsqlt3.c
|
||||
* moved SDD backed specific data from SQLCONNECTION and SQLAREA
|
||||
* moved SDD backend specific data from SQLCONNECTION and SQLAREA
|
||||
to a separate SDDCONN and SDDDATA structures. This helps to
|
||||
avoid fake type casting and warinings like "break
|
||||
strict-aliasing rules".
|
||||
|
||||
@@ -117,7 +117,7 @@ extern HB_EXPORT const char * hb_clsMethodName( HB_USHORT uiClass, HB_USHORT uiM
|
||||
extern HB_EXPORT PHB_SYMB hb_clsFuncSym( HB_USHORT uiClass );
|
||||
extern HB_EXPORT HB_BOOL hb_clsIsParent( HB_USHORT uiClass, const char * szParentName ); /* is a class handle inherited from szParentName Class ? */
|
||||
extern HB_EXPORT HB_SIZE hb_clsGetVarIndex( HB_USHORT uiClass, PHB_DYNS pVarSym );
|
||||
extern HB_EXPORT HB_USHORT hb_clsFindClass( const char * szClass, const char * szFunc );
|
||||
extern HB_EXPORT HB_USHORT hb_clsFindClass( const char * szClass, const char * szClassFunc );
|
||||
|
||||
/* object management */
|
||||
extern HB_EXPORT HB_USHORT hb_objGetClass( PHB_ITEM pItem ); /* get object class handle */
|
||||
|
||||
@@ -1209,14 +1209,12 @@ HB_EXPORT HB_FOFFSET hb_fileSizeGet( const char * pszFileName, HB_BOOL bUseDirEn
|
||||
|
||||
if( i >= 0 )
|
||||
{
|
||||
HB_ERRCODE uiError;
|
||||
HB_FOFFSET nSize = 0;
|
||||
|
||||
if( bUseDirEntry )
|
||||
{
|
||||
PHB_ITEM pDir = hb_fileDirectory( pszFileName, "HS" );
|
||||
|
||||
uiError = hb_fsError();
|
||||
if( pDir )
|
||||
{
|
||||
PHB_ITEM pEntry = hb_arrayGetItemPtr( pDir, 1 );
|
||||
@@ -1231,14 +1229,13 @@ HB_EXPORT HB_FOFFSET hb_fileSizeGet( const char * pszFileName, HB_BOOL bUseDirEn
|
||||
PHB_FILE pFile = hb_fileExtOpen( pszFileName, NULL, FO_READ | FO_COMPAT, NULL, NULL );
|
||||
if( pFile )
|
||||
{
|
||||
HB_ERRCODE uiError;
|
||||
nSize = hb_fileSize( pFile );
|
||||
uiError = hb_fsError();
|
||||
hb_fileClose( pFile );
|
||||
hb_fsSetError( uiError );
|
||||
}
|
||||
else
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
hb_fsSetFError( uiError );
|
||||
|
||||
return nSize;
|
||||
}
|
||||
|
||||
@@ -53,13 +53,14 @@
|
||||
|
||||
HB_BOOL hb_fsCopy( const char * pszSource, const char * pszDest )
|
||||
{
|
||||
HB_ERRCODE errCode;
|
||||
HB_BOOL bRetVal;
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
PHB_FILE pSrcFile;
|
||||
PHB_FILE pDstFile;
|
||||
|
||||
if( ( pSrcFile = hb_fileExtOpen( pszSource, NULL, FO_READ | FO_SHARED | FXO_SHARELOCK, NULL, NULL ) ) != NULL )
|
||||
{
|
||||
HB_ERRCODE errCode = 0;
|
||||
|
||||
if( ( pDstFile = hb_fileExtOpen( pszDest, NULL, FXO_TRUNCATE | FO_READWRITE | FO_EXCLUSIVE | FXO_SHARELOCK, NULL, NULL ) ) != NULL )
|
||||
{
|
||||
HB_SIZE nBytesRead;
|
||||
@@ -73,14 +74,13 @@ HB_BOOL hb_fsCopy( const char * pszSource, const char * pszDest )
|
||||
if( nBytesRead != hb_fileWrite( pDstFile, pbyBuffer, nBytesRead, -1 ) )
|
||||
{
|
||||
errCode = hb_fsError();
|
||||
bRetVal = HB_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errCode = hb_fsError();
|
||||
bRetVal = ( errCode == 0 && nBytesRead != ( HB_SIZE ) FS_ERROR );
|
||||
fResult = errCode == 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -90,41 +90,39 @@ HB_BOOL hb_fsCopy( const char * pszSource, const char * pszDest )
|
||||
hb_fileClose( pDstFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
errCode = hb_fsError();
|
||||
bRetVal = HB_FALSE;
|
||||
}
|
||||
|
||||
hb_fileClose( pSrcFile );
|
||||
|
||||
if( bRetVal )
|
||||
if( fResult )
|
||||
{
|
||||
HB_FATTR ulAttr;
|
||||
|
||||
if( hb_fileAttrGet( pszSource, &ulAttr ) )
|
||||
hb_fileAttrSet( pszDest, ulAttr );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errCode = hb_fsError();
|
||||
bRetVal = HB_FALSE;
|
||||
hb_fsSetError( errCode );
|
||||
}
|
||||
|
||||
hb_fsSetFError( errCode );
|
||||
|
||||
return bRetVal;
|
||||
return fResult;
|
||||
}
|
||||
|
||||
HB_FUNC( HB_FCOPY )
|
||||
{
|
||||
HB_ERRCODE errCode = 2; /* file not found */
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
const char * pszSource = hb_parc( 1 ), * pszDest = hb_parc( 2 );
|
||||
|
||||
if( pszSource && pszDest )
|
||||
hb_retni( hb_fsCopy( pszSource, pszDest ) ? 0 : F_ERROR );
|
||||
{
|
||||
fResult = hb_fsCopy( pszSource, pszDest );
|
||||
errCode = hb_fsError();
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 /* file not found */ );
|
||||
hb_retni( F_ERROR );
|
||||
}
|
||||
hb_fsSetFError( errCode );
|
||||
hb_retni( fResult ? 0 : F_ERROR );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,6 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile )
|
||||
|
||||
fResult = s_pCreateHardLink( lpFileName, lpExistingFileName, NULL ) != 0;
|
||||
hb_fsSetIOError( fResult, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
|
||||
if( lpFileNameFree )
|
||||
hb_xfree( lpFileNameFree );
|
||||
@@ -101,7 +100,7 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile )
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +114,6 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile )
|
||||
|
||||
fResult = ( link( pszExisting, pszNewFile ) == 0 );
|
||||
hb_fsSetIOError( fResult, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
|
||||
if( pszExistingFree )
|
||||
hb_xfree( pszExistingFree );
|
||||
@@ -124,7 +122,7 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile )
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
#endif
|
||||
@@ -133,7 +131,7 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile )
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 );
|
||||
hb_fsSetError( 2 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
|
||||
@@ -182,7 +180,6 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile )
|
||||
|
||||
fResult = s_pCreateSymbolicLink( lpSymlinkFileName, lpTargetFileName, fDir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0 ) != 0;
|
||||
hb_fsSetIOError( fResult, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
|
||||
if( lpSymlinkFileNameFree )
|
||||
hb_xfree( lpSymlinkFileNameFree );
|
||||
@@ -191,7 +188,7 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile )
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -205,7 +202,6 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile )
|
||||
|
||||
fResult = ( symlink( pszTarget, pszNewFile ) == 0 );
|
||||
hb_fsSetIOError( fResult, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
|
||||
if( pszTargetFree )
|
||||
hb_xfree( pszTargetFree );
|
||||
@@ -214,7 +210,7 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile )
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
#endif
|
||||
@@ -223,7 +219,7 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile )
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 );
|
||||
hb_fsSetError( 2 );
|
||||
fResult = HB_FALSE;
|
||||
}
|
||||
|
||||
@@ -295,10 +291,7 @@ char * hb_fsLinkRead( const char * pszFile )
|
||||
NULL );
|
||||
|
||||
if( hFile == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
hb_fsSetIOError( HB_FALSE, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD size;
|
||||
@@ -313,17 +306,16 @@ char * hb_fsLinkRead( const char * pszFile )
|
||||
}
|
||||
|
||||
hb_fsSetIOError( HB_TRUE, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
}
|
||||
else
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 9 );
|
||||
}
|
||||
|
||||
if( lpFileNameFree )
|
||||
hb_xfree( lpFileNameFree );
|
||||
}
|
||||
else
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
}
|
||||
#elif defined( HB_OS_UNIX )
|
||||
{
|
||||
@@ -335,7 +327,6 @@ char * hb_fsLinkRead( const char * pszFile )
|
||||
pszLink = ( char * ) hb_xgrab( HB_PATH_MAX + 1 );
|
||||
size = readlink( pszFile, pszLink, HB_PATH_MAX );
|
||||
hb_fsSetIOError( size != ( size_t ) -1, 0 );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
if( size == ( size_t ) -1 )
|
||||
{
|
||||
hb_xfree( pszLink );
|
||||
@@ -353,53 +344,59 @@ char * hb_fsLinkRead( const char * pszFile )
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_fsSetFError( 1 );
|
||||
hb_fsSetError( 1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_vmLock();
|
||||
}
|
||||
else
|
||||
hb_fsSetFError( 2 );
|
||||
hb_fsSetError( 2 );
|
||||
|
||||
return pszLink;
|
||||
}
|
||||
|
||||
HB_FUNC( HB_FLINK )
|
||||
{
|
||||
HB_ERRCODE uiError = 2;
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
const char * pszExisting = hb_parc( 1 ), * pszNewFile = hb_parc( 2 );
|
||||
|
||||
if( pszExisting && pszNewFile )
|
||||
hb_retni( hb_fsLink( pszExisting, pszNewFile ) ? 0 : F_ERROR );
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 );
|
||||
hb_retni( F_ERROR );
|
||||
fResult = hb_fsLink( pszExisting, pszNewFile );
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
hb_retni( fResult ? 0 : F_ERROR );
|
||||
hb_fsSetFError( uiError );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_FLINKSYM )
|
||||
{
|
||||
HB_ERRCODE uiError = 2;
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
const char * pszTarget = hb_parc( 1 ), * pszNewFile = hb_parc( 2 );
|
||||
|
||||
if( pszTarget && pszNewFile )
|
||||
hb_retni( hb_fsLinkSym( pszTarget, pszNewFile ) ? 0 : F_ERROR );
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 );
|
||||
hb_retni( F_ERROR );
|
||||
fResult = hb_fsLinkSym( pszTarget, pszNewFile );
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
hb_retni( fResult ? 0 : F_ERROR );
|
||||
hb_fsSetFError( uiError );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_FLINKREAD )
|
||||
{
|
||||
HB_ERRCODE uiError = 2;
|
||||
char * pszResult = NULL;
|
||||
const char * pszFile = hb_parc( 1 );
|
||||
|
||||
if( pszFile )
|
||||
hb_retc_buffer( hb_fsLinkRead( pszFile ) );
|
||||
else
|
||||
{
|
||||
hb_fsSetFError( 2 );
|
||||
hb_retc_null();
|
||||
pszResult = hb_fsLinkRead( pszFile );
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
hb_retc_buffer( pszResult );
|
||||
hb_fsSetFError( uiError );
|
||||
}
|
||||
|
||||
@@ -767,7 +767,10 @@ HB_FUNC( HB_VFSIZE )
|
||||
const char * pszFile = hb_parc( 1 );
|
||||
|
||||
if( pszFile )
|
||||
{
|
||||
hb_retnint( hb_fileSizeGet( pszFile, hb_parldef( 2, 1 ) ) );
|
||||
hb_fsSetFError( hb_fsError() );
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_FILE pFile = hb_fileParam( 1 );
|
||||
|
||||
@@ -1572,15 +1572,15 @@ HB_SIZE hb_clsGetVarIndex( HB_USHORT uiClass, PHB_DYNS pVarSym )
|
||||
return 0;
|
||||
}
|
||||
|
||||
HB_USHORT hb_clsFindClass( const char * szClass, const char * szFunc )
|
||||
HB_USHORT hb_clsFindClass( const char * szClass, const char * szClassFunc )
|
||||
{
|
||||
HB_USHORT uiClass;
|
||||
|
||||
for( uiClass = 1; uiClass <= s_uiClasses; uiClass++ )
|
||||
{
|
||||
if( strcmp( szClass, s_pClasses[ uiClass ]->szName ) == 0 &&
|
||||
( ! szFunc || ( ! s_pClasses[ uiClass ]->pClassFuncSym ? ! *szFunc :
|
||||
strcmp( szFunc, s_pClasses[ uiClass ]->pClassFuncSym->szName ) == 0 ) ) )
|
||||
( ! szClassFunc || ( ! s_pClasses[ uiClass ]->pClassFuncSym ? ! *szClassFunc :
|
||||
strcmp( szClassFunc, s_pClasses[ uiClass ]->pClassFuncSym->szName ) == 0 ) ) )
|
||||
{
|
||||
return uiClass;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user