Skip to content

Commit

Permalink
bump KMELEON_VERSION, also port commit bd6ba75 and cc030e6 to km74
Browse files Browse the repository at this point in the history
  • Loading branch information
roytam1 committed May 13, 2018
1 parent 93af664 commit a5a18a6
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 6 deletions.
54 changes: 51 additions & 3 deletions k-meleon/KMeleonConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
42 changes: 39 additions & 3 deletions k-meleon/KmAppInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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; */
Expand All @@ -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;
}

Expand Down

0 comments on commit a5a18a6

Please sign in to comment.