Browse Source

bump KMELEON_VERSION, also port commit bd6ba759d4 and cc030e6cb7 to km74

km74 v74g-20180718
roytam1 4 years ago
parent
commit
a5a18a6c3f
  1. 54
      k-meleon/KMeleonConst.h
  2. 42
      k-meleon/KmAppInfo.cpp

54
k-meleon/KMeleonConst.h

@ -16,9 +16,57 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define KMELEON_VERSION 0x02000012
#define MOZILLA_BUILDID 20140105
/**/
// From https://stackoverflow.com/a/16472369
// Example of __DATE__ string: "Jul 27 2012"
// 01234567890
#define BUILD_YEAR_CH0 (__DATE__[ 7])
#define BUILD_YEAR_CH1 (__DATE__[ 8])
#define BUILD_YEAR_CH2 (__DATE__[ 9])
#define BUILD_YEAR_CH3 (__DATE__[10])
#define BUILD_MONTH_IS_JAN (__DATE__[0] == 'J' && __DATE__[1] == 'a' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_FEB (__DATE__[0] == 'F')
#define BUILD_MONTH_IS_MAR (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r')
#define BUILD_MONTH_IS_APR (__DATE__[0] == 'A' && __DATE__[1] == 'p')
#define BUILD_MONTH_IS_MAY (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y')
#define BUILD_MONTH_IS_JUN (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_JUL (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l')
#define BUILD_MONTH_IS_AUG (__DATE__[0] == 'A' && __DATE__[1] == 'u')
#define BUILD_MONTH_IS_SEP (__DATE__[0] == 'S')
#define BUILD_MONTH_IS_OCT (__DATE__[0] == 'O')
#define BUILD_MONTH_IS_NOV (__DATE__[0] == 'N')
#define BUILD_MONTH_IS_DEC (__DATE__[0] == 'D')
#define BUILD_MONTH_CH0 \
((BUILD_MONTH_IS_OCT || BUILD_MONTH_IS_NOV || BUILD_MONTH_IS_DEC) ? '1' : '0')
#define BUILD_MONTH_CH1 \
( \
(BUILD_MONTH_IS_JAN) ? '1' : \
(BUILD_MONTH_IS_FEB) ? '2' : \
(BUILD_MONTH_IS_MAR) ? '3' : \
(BUILD_MONTH_IS_APR) ? '4' : \
(BUILD_MONTH_IS_MAY) ? '5' : \
(BUILD_MONTH_IS_JUN) ? '6' : \
(BUILD_MONTH_IS_JUL) ? '7' : \
(BUILD_MONTH_IS_AUG) ? '8' : \
(BUILD_MONTH_IS_SEP) ? '9' : \
(BUILD_MONTH_IS_OCT) ? '0' : \
(BUILD_MONTH_IS_NOV) ? '1' : \
(BUILD_MONTH_IS_DEC) ? '2' : \
/* error default */ '?' \
)
#define BUILD_DAY_CH0 ((__DATE__[4] >= '0') ? (__DATE__[4]) : '0')
#define BUILD_DAY_CH1 (__DATE__[ 5])
/**/
#define KMELEON_VERSION 0x02000013
//#define MOZILLA_BUILDID 20140105 // Not used now, use mozilla_buildid[]
#define KMELEON_BUILDID 7400
#define KMELEON_UVERSION 74.0
#define KMELEON_UUID {944df56f-c0ec-4d7b-94b6-f625c8cc96ea}

42
k-meleon/KmAppInfo.cpp

@ -22,9 +22,18 @@
#include "KmAppInfo.h"
#include "KMeleonConst.h"
#include "MfcEmbed.h"
#include "nsIPrefService.h"
NS_IMPL_ISUPPORTS3(KmAppInfo, nsIXULAppInfo, nsIXULRuntime, nsIAppStartup)
const unsigned char mozilla_buildid[] =
{
BUILD_YEAR_CH0, BUILD_YEAR_CH1, BUILD_YEAR_CH2, BUILD_YEAR_CH3,
BUILD_MONTH_CH0, BUILD_MONTH_CH1,
BUILD_DAY_CH0, BUILD_DAY_CH1,
'\0'
};
/* readonly attribute ACString vendor; */
NS_IMETHODIMP KmAppInfo::GetVendor(nsACString & aVendor)
{
@ -58,6 +67,7 @@ NS_IMETHODIMP KmAppInfo::GetID(nsACString & aID)
/* readonly attribute ACString version; */
NS_IMETHODIMP KmAppInfo::GetVersion(nsACString & aVersion)
{
#if 0
bool ff = false;
nsCOMPtr<nsIPrefService> m_prefservice = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (m_prefservice) {
@ -68,7 +78,10 @@ NS_IMETHODIMP KmAppInfo::GetVersion(nsACString & aVersion)
}
}
aVersion = !ff ? NS_STRINGIFY(KMELEON_UVERSION) : MOZILLA_VERSION;
return NS_OK;
#else
aVersion = NS_STRINGIFY(KMELEON_UVERSION);
#endif
return NS_OK;
}
/* readonly attribute ACString appBuildID; */
@ -81,14 +94,37 @@ NS_IMETHODIMP KmAppInfo::GetAppBuildID(nsACString & aAppBuildID)
/* readonly attribute ACString platformVersion; */
NS_IMETHODIMP KmAppInfo::GetPlatformVersion(nsACString & aPlatformVersion)
{
aPlatformVersion = NS_STRINGIFY(MOZILLA_VERSION);
#if 0
aPlatformVersion = NS_STRINGIFY(MOZILLA_VERSION_U);
#else
aPlatformVersion = NS_STRINGIFY(KMELEON_UVERSION);
#endif
return NS_OK;
}
/* readonly attribute ACString platformBuildID; */
NS_IMETHODIMP KmAppInfo::GetPlatformBuildID(nsACString & aPlatformBuildID)
{
aPlatformBuildID = NS_STRINGIFY(MOZILLA_BUILDID);
nsCString string;
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs;
if (!prefService) goto _pbid_fallback;
prefService->GetBranch("", getter_AddRefs(prefs));
if (!prefs || !NS_SUCCEEDED(prefs->GetCharPref("platform.buildid", getter_Copies(string))))
goto _pbid_fallback;
if (string.Length() < 8)
goto _pbid_fallback;
string.Cut(9, 0); // remove everything after yyyymmdd
aPlatformBuildID = string;
return NS_OK;
_pbid_fallback:
// aPlatformBuildID = NS_STRINGIFY(MOZILLA_BUILDID);
// for fallback
aPlatformBuildID.AssignASCII((char*)&mozilla_buildid[0]);
return NS_OK;
}

Loading…
Cancel
Save