diff --git a/ChangeLog.txt b/ChangeLog.txt index aaff07266d..5c45b28657 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,16 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2022-11-11 20:47 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/hbapi.h + * src/common/hbver.c + * src/main/harbour.c + * src/pp/hbpp.c + * src/rtl/version.c + * src/vm/cmdarg.c + ! fixed integer overflow in revision number calculated from + the last ChangeLog entry date + 2022-11-07 09:24 UTC+0100 Aleksander Czajczynski (hb fki.pl) * contrib/hbcurl/core.c ! CURLOPT_MAXLIFETIME_CONN is available in curl 7.80.0, diff --git a/include/hbapi.h b/include/hbapi.h index 5b7154acf2..37680cdbc8 100644 --- a/include/hbapi.h +++ b/include/hbapi.h @@ -1189,7 +1189,7 @@ extern HB_EXPORT char * hb_verHarbour( void ); /* retrieves a newl extern HB_EXPORT char * hb_verPCode( void ); /* retrieves a newly allocated buffer containing PCode version */ extern HB_EXPORT char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */ extern HB_EXPORT void hb_verBuildInfo( void ); /* display harbour, compiler, and platform versions to standard console */ -extern HB_EXPORT int hb_verRevision( void ); /* retrieves source repository revision number */ +extern HB_EXPORT HB_MAXINT hb_verRevision( void ); /* retrieves source repository revision number */ extern HB_EXPORT const char * hb_verChangeLogID( void ); /* retrieves a static buffer containing ChangeLog ID string */ extern HB_EXPORT const char * hb_verChangeLogLastEntry( void ); /* retrieves a static buffer containing ChangeLog last entry string */ #if defined( HB_LEGACY_LEVEL4 ) diff --git a/src/common/hbver.c b/src/common/hbver.c index ce58898694..9f5bc71172 100644 --- a/src/common/hbver.c +++ b/src/common/hbver.c @@ -1338,7 +1338,7 @@ char * hb_verHarbour( void ) HB_TRACE( HB_TR_DEBUG, ( "hb_verHarbour()" ) ); pszVersion = ( char * ) hb_xgrab( 80 ); - hb_snprintf( pszVersion, 80, "Harbour %d.%d.%d%s (r%d)", + hb_snprintf( pszVersion, 80, "Harbour %d.%d.%d%s (r%" PFHL "u)", HB_VER_MAJOR, HB_VER_MINOR, HB_VER_RELEASE, HB_VER_STATUS, hb_verRevision() ); diff --git a/src/main/harbour.c b/src/main/harbour.c index 4612135d0e..4d8c98d9f8 100644 --- a/src/main/harbour.c +++ b/src/main/harbour.c @@ -48,7 +48,7 @@ #include "hbverbld.h" /* Source repository revision number */ -int hb_verRevision( void ) +HB_MAXINT hb_verRevision( void ) { return HB_VER_REVID; } diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c index 773ef4105a..62e5d899ce 100644 --- a/src/pp/hbpp.c +++ b/src/pp/hbpp.c @@ -50,7 +50,7 @@ #define _DEFAULT_ORIGIN_URL "https://harbour.github.io/" -int hb_verRevision( void ) +HB_MAXINT hb_verRevision( void ) { return 0; } @@ -321,7 +321,7 @@ static char * hb_pp_escapeString( char * szString ) } static int hb_pp_generateVerInfo( char * szVerFile, - int iRevID, + HB_MAXINT nRevID, char * szChangeLogID, char * szLastEntry ) { @@ -350,7 +350,7 @@ static int hb_pp_generateVerInfo( char * szVerFile, " * and is covered by the same license as Harbour PP\n" " */\n\n" ); - fprintf( fout, "#define HB_VER_REVID %d\n", iRevID ); + fprintf( fout, "#define HB_VER_REVID %" PFHL "u\n", nRevID ); if( szChangeLogID ) { @@ -436,7 +436,7 @@ static char * hb_fsFileFind( const char * pszFileMask ) } static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName, - int iQuiet, int * piRevID, + int iQuiet, HB_MAXINT * pnRevID, char ** pszChangeLogID, char ** pszLastEntry ) { char * pszFree = NULL; @@ -638,7 +638,7 @@ static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName, else szRevID[ 0 ] = '\0'; - *piRevID = ( int ) hb_strValInt( szRevID, &iLen ); + *pnRevID = hb_strValInt( szRevID, &iLen ); hb_pp_addDefine( pState, "HB_VER_REVID", szRevID ); #ifdef HB_LEGACY_LEVEL4 @@ -679,7 +679,8 @@ int main( int argc, char * argv[] ) char * szStdCh = NULL, * szLogFile = NULL, * szInclude; HB_BOOL fWrite = HB_FALSE, fChgLog = HB_FALSE; char * szChangeLogID = NULL, * szLastEntry = NULL; - int iRevID = 0, iResult = 0, iQuiet = 0, i; + int iResult = 0, iQuiet = 0, i; + HB_MAXINT nRevID = 0; char * szPPRuleFuncName = NULL; PHB_PP_STATE pState; @@ -829,13 +830,13 @@ int main( int argc, char * argv[] ) if( fChgLog ) iResult = hb_pp_parseChangelog( pState, szLogFile, iQuiet, - &iRevID, &szChangeLogID, &szLastEntry ); + &nRevID, &szChangeLogID, &szLastEntry ); if( iResult == 0 ) iResult = hb_pp_preprocesfile( pState, szRuleFile, szPPRuleFuncName ); if( iResult == 0 && szVerFile ) - iResult = hb_pp_generateVerInfo( szVerFile, iRevID, + iResult = hb_pp_generateVerInfo( szVerFile, nRevID, szChangeLogID, szLastEntry ); if( iResult == 0 && hb_pp_errorCount( pState ) > 0 ) iResult = 1; diff --git a/src/rtl/version.c b/src/rtl/version.c index 21b8b47a27..39fce93131 100644 --- a/src/rtl/version.c +++ b/src/rtl/version.c @@ -72,7 +72,7 @@ HB_FUNC( HB_VERSION ) case HB_VERSION_MINOR: hb_retni( HB_VER_MINOR ); break; case HB_VERSION_RELEASE: hb_retni( HB_VER_RELEASE ); break; case HB_VERSION_STATUS: hb_retc_const( HB_VER_STATUS ); break; - case HB_VERSION_REVISION: hb_retni( hb_verRevision() ); break; + case HB_VERSION_REVISION: hb_retnint( hb_verRevision() ); break; case HB_VERSION_CHANGELOG_LAST: hb_retc_const( hb_verChangeLogLastEntry() ); break; case HB_VERSION_CHANGELOG_ID: hb_retc_const( hb_verChangeLogID() ); break; case HB_VERSION_PCODE_VER: hb_retni( HB_PCODE_VER ); break; diff --git a/src/vm/cmdarg.c b/src/vm/cmdarg.c index 8628514b4e..bf03d5d5c1 100644 --- a/src/vm/cmdarg.c +++ b/src/vm/cmdarg.c @@ -875,7 +875,7 @@ void hb_cmdargProcess( void ) } /* Source repository revision number */ -int hb_verRevision( void ) +HB_MAXINT hb_verRevision( void ) { return HB_VER_REVID; }