2015-11-23 23:24 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rdd/dbf1.c
+ reserve space for DBC name in newly created DBF files with VFP DBF
signature, Thanks to Nikos Christophi, Jeff Stone and other who
reported this problem.
+ added RTE when size of DBF header is exceed by "_NullFlags" field
* src/vm/thread.c
! typo in comment
This commit is contained in:
@@ -10,6 +10,16 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2015-11-23 23:24 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/rdd/dbf1.c
|
||||
+ reserve space for DBC name in newly created DBF files with VFP DBF
|
||||
signature, Thanks to Nikos Christophi, Jeff Stone and other who
|
||||
reported this problem.
|
||||
+ added RTE when size of DBF header is exceed by "_NullFlags" field
|
||||
|
||||
* src/vm/thread.c
|
||||
! typo in comment
|
||||
|
||||
2015-11-16 15:32 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* src/vm/thread.c
|
||||
! fixed typo in hb_threadOnceInit() - thanks to Teo
|
||||
|
||||
@@ -3099,10 +3099,10 @@ static HB_ERRCODE hb_dbfClose( DBFAREAP pArea )
|
||||
*/
|
||||
static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
{
|
||||
HB_ERRCODE errCode = HB_SUCCESS;
|
||||
HB_ERRCODE errCode = HB_SUCCESS, errSubCode = 0;
|
||||
HB_SIZE nSize;
|
||||
HB_USHORT uiCount, uiLen;
|
||||
HB_BOOL fError, fRawBlob;
|
||||
HB_BOOL fRawBlob;
|
||||
DBFFIELD * pThisField;
|
||||
HB_BYTE * pBuffer;
|
||||
PHB_FNAME pFileName;
|
||||
@@ -3179,8 +3179,9 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
if( pItem )
|
||||
hb_itemRelease( pItem );
|
||||
|
||||
if( pArea->area.uiFieldCount * sizeof( DBFFIELD ) + sizeof( DBFHEADER ) +
|
||||
( pArea->bTableType == DB_DBF_VFP ? 1 : 2 ) > UINT16_MAX )
|
||||
nSize = ( HB_SIZE ) pArea->area.uiFieldCount * sizeof( DBFFIELD ) +
|
||||
( pArea->bTableType == DB_DBF_VFP ? 264 : 2 );
|
||||
if( nSize + sizeof( DBFHEADER ) > UINT16_MAX )
|
||||
{
|
||||
hb_dbfErrorRT( pArea, EG_CREATE, EDBF_DATAWIDTH, pCreateInfo->abName, 0, 0, NULL );
|
||||
pArea->lpdbOpenInfo = NULL;
|
||||
@@ -3217,12 +3218,10 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
|
||||
pArea->szDataFileName = hb_strdup( szFileName );
|
||||
|
||||
nSize = ( HB_SIZE ) pArea->area.uiFieldCount * sizeof( DBFFIELD ) +
|
||||
( pArea->bTableType == DB_DBF_VFP ? 1 : 2 );
|
||||
pBuffer = ( HB_BYTE * ) hb_xgrabz( nSize + sizeof( DBFFIELD ) + 1 );
|
||||
pThisField = ( DBFFIELD * ) pBuffer;
|
||||
|
||||
pArea->fHasMemo = fError = HB_FALSE;
|
||||
pArea->fHasMemo = HB_FALSE;
|
||||
|
||||
/* Size for deleted flag */
|
||||
pArea->uiRecordLen = 1;
|
||||
@@ -3304,7 +3303,7 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
|
||||
case HB_FT_ANY:
|
||||
if( pArea->bTableType == DB_DBF_VFP )
|
||||
fError = HB_TRUE;
|
||||
errSubCode = EDBF_DATATYPE;
|
||||
else
|
||||
{
|
||||
pThisField->bType = 'V';
|
||||
@@ -3453,18 +3452,13 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
break;
|
||||
|
||||
default:
|
||||
fError = HB_TRUE;
|
||||
errSubCode = EDBF_DATATYPE;
|
||||
}
|
||||
|
||||
if( fError || pArea->pFieldOffset[ uiCount ] > pArea->uiRecordLen )
|
||||
{
|
||||
hb_xfree( pBuffer );
|
||||
SELF_CLOSE( &pArea->area );
|
||||
hb_dbfErrorRT( pArea, EG_CREATE, fError ? EDBF_DATATYPE : EDBF_DATAWIDTH,
|
||||
pCreateInfo->abName, 0, 0, NULL );
|
||||
pArea->lpdbOpenInfo = NULL;
|
||||
return HB_FAILURE;
|
||||
}
|
||||
if( pArea->pFieldOffset[ uiCount ] > pArea->uiRecordLen )
|
||||
errSubCode = EDBF_DATATYPE;
|
||||
if( errSubCode != 0 )
|
||||
break;
|
||||
|
||||
if( ( pField->uiFlags & HB_FF_NULLABLE ) != 0 )
|
||||
hb_dbfAllocNullFlag( pArea, uiCount, HB_FALSE );
|
||||
@@ -3472,7 +3466,7 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
pThisField++;
|
||||
}
|
||||
|
||||
if( pArea->uiNullCount )
|
||||
if( errSubCode == 0 && pArea->uiNullCount )
|
||||
{
|
||||
hb_strncpy( ( char * ) pThisField->bName, "_NullFlags", sizeof( pThisField->bName ) - 1 );
|
||||
HB_PUT_LE_UINT16( pThisField->bReserved1, pArea->uiRecordLen );
|
||||
@@ -3484,8 +3478,23 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
pArea->uiNullOffset = pArea->uiRecordLen;
|
||||
pArea->uiRecordLen += uiCount;
|
||||
nSize += sizeof( DBFFIELD );
|
||||
pThisField++;
|
||||
if( nSize + sizeof( DBFHEADER ) > UINT16_MAX || pArea->uiNullOffset > pArea->uiRecordLen )
|
||||
errSubCode = EDBF_DATAWIDTH;
|
||||
}
|
||||
|
||||
if( errSubCode != 0 )
|
||||
{
|
||||
hb_xfree( pBuffer );
|
||||
SELF_CLOSE( &pArea->area );
|
||||
hb_dbfErrorRT( pArea, EG_CREATE, errSubCode, pCreateInfo->abName, 0, 0, NULL );
|
||||
pArea->lpdbOpenInfo = NULL;
|
||||
return HB_FAILURE;
|
||||
}
|
||||
|
||||
/* set end of fields marker */
|
||||
pThisField->bName[ 0 ] = '\r';
|
||||
|
||||
pArea->fShared = HB_FALSE; /* pCreateInfo->fShared */
|
||||
pArea->fReadonly = HB_FALSE; /* pCreateInfo->fReadonly */
|
||||
pArea->ulRecCount = 0;
|
||||
@@ -3543,13 +3552,6 @@ static HB_ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
}
|
||||
|
||||
/* Write fields and eof mark */
|
||||
if( pArea->bTableType == DB_DBF_VFP )
|
||||
pBuffer[ nSize - 1 ] = '\r';
|
||||
else
|
||||
{
|
||||
pBuffer[ nSize - 2 ] = '\r';
|
||||
pBuffer[ nSize - 1 ] = '\0';
|
||||
}
|
||||
pBuffer[ nSize ] = '\032';
|
||||
if( hb_fileWriteAt( pArea->pDataFile, pBuffer, nSize + 1,
|
||||
sizeof( DBFHEADER ) ) != nSize + 1 )
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
hb_threadWaitForAll() -> NIL
|
||||
hb_threadWait( <pThID> | <apThID>, [ <nTimeOut> ] [, <lAll> ] ) => <nThInd> | <nThCount> | 0
|
||||
hb_threadOnce( @<onceControl> [, <bAction> | <@sAction()> ] ) -> <lFirstCall>
|
||||
hb_threadOnceInit( @<item> <value> ) -> <lInitialized>
|
||||
hb_threadOnceInit( @<item>, <value> ) -> <lInitialized>
|
||||
hb_mutexCreate() -> <pMtx>
|
||||
hb_mutexLock( <pMtx> [, <nTimeOut> ] ) -> <lLocked>
|
||||
hb_mutexUnlock( <pMtx> ) -> <lOK>
|
||||
@@ -1616,7 +1616,7 @@ HB_FUNC( HB_THREADONCE )
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
/* hb_threadOnceInit( @<item> <value> ) -> <lInitialized>
|
||||
/* hb_threadOnceInit( @<item>, <value> ) -> <lInitialized>
|
||||
* assign <value> to @<item> only if <item> is NIL
|
||||
*/
|
||||
HB_FUNC( HB_THREADONCEINIT )
|
||||
|
||||
Reference in New Issue
Block a user