From bb9d85f0fc4609d2e5c04e3b4c3ee18e5eef7dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Tue, 4 Mar 2014 00:08:07 +0100 Subject: [PATCH] 2014-03-04 00:08 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/vm/set.c ! added missing FXO_APPEND flag. It should fix #54. * src/vm/asort.c ! respect milliseconds part when timestamp values are compared in ASORT() Note: ASORT() does not use exact comparison so when mixed date and timestamp values are used only date is significant. Just like in: ASort( aValue, {|x, y| x < y } ) * src/rtl/filebuf.c ! fixed C&P typo. It should fix problem with SET PRINTER TO reported by Rolf. * src/rtl/hbgtcore.c ! added missing break after HB_GTI_VERSION --- ChangeLog.txt | 18 ++++++++++++++++++ src/rtl/filebuf.c | 4 ++-- src/rtl/hbgtcore.c | 1 + src/vm/asort.c | 8 ++++++++ src/vm/set.c | 2 +- 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f00aaccb44..6738c41b88 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,24 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-03-04 00:08 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/vm/set.c + ! added missing FXO_APPEND flag. + It should fix #54. + + * src/vm/asort.c + ! respect milliseconds part when timestamp values are compared in ASORT() + Note: ASORT() does not use exact comparison so when mixed date and + timestamp values are used only date is significant. Just like in: + ASort( aValue, {|x, y| x < y } ) + + * src/rtl/filebuf.c + ! fixed C&P typo. + It should fix problem with SET PRINTER TO reported by Rolf. + + * src/rtl/hbgtcore.c + ! added missing break after HB_GTI_VERSION + 2014-02-26 23:56 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/filebuf.c ! use hb_fsReadLarge()/hb_fsWriteLarge() instead of diff --git a/src/rtl/filebuf.c b/src/rtl/filebuf.c index 0e2790e77e..0eb139b8f8 100644 --- a/src/rtl/filebuf.c +++ b/src/rtl/filebuf.c @@ -795,7 +795,7 @@ static HB_FOFFSET s_fileposSeek( PHB_FILE pFilePos, HB_FOFFSET nOffset, HB_USHORT uiFlags ) { if( uiFlags & FS_END ) - nOffset += pFilePos->pFuncs->Size( _PHB_FILE ); + nOffset += pFilePos->pFuncs->Size( pFilePos ); else if( uiFlags & FS_RELATIVE ) nOffset += _PHB_FILEPOS->seek_pos; /* else FS_SET */ @@ -818,7 +818,7 @@ static HB_FOFFSET s_fileposSize( PHB_FILE pFilePos ) static HB_BOOL s_fileposEof( PHB_FILE pFilePos ) { - return _PHB_FILEPOS->seek_pos >= _PHB_FILE->pFuncs->Size( _PHB_FILE ); + return _PHB_FILEPOS->seek_pos >= pFilePos->pFuncs->Size( pFilePos ); } static void s_fileposFlush( PHB_FILE pFilePos, HB_BOOL fDirty ) diff --git a/src/rtl/hbgtcore.c b/src/rtl/hbgtcore.c index 5581d0086e..03718a0fc7 100644 --- a/src/rtl/hbgtcore.c +++ b/src/rtl/hbgtcore.c @@ -1972,6 +1972,7 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_VERSION: pInfo->pResult = hb_itemPutC( pInfo->pResult, HB_GTSELF_VERSION( pGT, hb_itemGetNI( pInfo->pNewVal ) ) ); + break; default: return HB_FALSE; diff --git a/src/vm/asort.c b/src/vm/asort.c index 2f9030ac9e..fb4bbebe84 100644 --- a/src/vm/asort.c +++ b/src/vm/asort.c @@ -96,6 +96,14 @@ static HB_BOOL hb_itemIsLess( PHB_ITEM pItem1, PHB_ITEM pItem2, PHB_ITEM pBlock, return hb_itemGetNInt( pItem1 ) < hb_itemGetNInt( pItem2 ); else if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) ) return hb_itemGetND( pItem1 ) < hb_itemGetND( pItem2 ); + else if( HB_IS_TIMESTAMP( pItem1 ) && HB_IS_TIMESTAMP( pItem2 ) ) + { + long lDate1, lTime1, lDate2, lTime2; + + hb_itemGetTDT( pItem1, &lDate1, &lTime1 ); + hb_itemGetTDT( pItem2, &lDate2, &lTime2 ); + return lDate1 == lDate2 ? lTime1 < lTime2 : lDate1 < lDate2; + } else if( HB_IS_DATETIME( pItem1 ) && HB_IS_DATETIME( pItem2 ) ) /* it's not exact comparison, compare only julian date */ return hb_itemGetDL( pItem1 ) < hb_itemGetDL( pItem2 ); diff --git a/src/vm/set.c b/src/vm/set.c index 3690e67395..792a4aa202 100644 --- a/src/vm/set.c +++ b/src/vm/set.c @@ -332,7 +332,7 @@ static void open_handle( PHB_SET_STRUCT pSet, const char * file_name, handle = hb_fileExtOpen( szFileName, hb_stackSetStruct()->HB_SET_DEFEXTENSIONS ? def_ext : NULL, FO_READWRITE | FO_READWRITE | FXO_SHARELOCK | - ( bAppend ? 0 : FXO_TRUNCATE ) | + ( bAppend ? FXO_APPEND : FXO_TRUNCATE ) | ( szDevice ? 0 : FXO_DEFAULTS ), NULL, pError );