Tue, 06 Aug 2013 13:52:32 +0300
corrected problems with the version string
src/common.h | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions |
--- a/src/common.h Tue Aug 06 13:32:07 2013 +0300 +++ b/src/common.h Tue Aug 06 13:52:32 2013 +0300 @@ -45,8 +45,11 @@ #define BUILD_RC 3 #define BUILD_RELEASE 4 +// RC Number for BUILD_RC +#define RC_NUMBER 0 + // Uncomment for portable build... maybe it's time to move to cmake? -#define PORTABLE +// #define PORTABLE // ============================================= #if (BUILD_ID != BUILD_INTERNAL) @@ -64,11 +67,6 @@ void doDevf (const char* func, const char* fmtstr, ...); -// Version string identifier -const char* versionString(); -const char* versionMoniker(); -const char* fullVersionString(); - // Null pointer static const std::nullptr_t null = nullptr; @@ -166,8 +164,13 @@ void assertionFailure (const char* file, const ulong line, const char* funcname, const char* expr); void fatalError (const char* file, const ulong line, const char* funcname, str errmsg); +// Version string identifier +str versionString(); +str versionMoniker(); +str fullVersionString(); + #define assert(N) \ - (N) ? ((void)(0)) : assertionFailure(__FILE__, __LINE__, FUNCNAME, #N) + ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)) #define fatal(MSG) \ fatalError (__FILE__, __LINE__, FUNCNAME, MSG)
--- a/src/main.cpp Tue Aug 06 13:32:07 2013 +0300 +++ b/src/main.cpp Tue Aug 06 13:52:32 2013 +0300 @@ -96,7 +96,7 @@ va_end (va); } -const char* versionString() { +str versionString() { if (g_versionString.length() == 0) { #if VERSION_PATCH == 0 g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR); @@ -105,28 +105,25 @@ #endif // VERSION_PATCH } - return g_versionString.toStdString().c_str(); + return g_versionString; } -const char* versionMoniker() { +str versionMoniker() { #if BUILD_ID == BUILD_INTERNAL - return " Internal"; + return "Internal"; #elif BUILD_ID == BUILD_ALPHA - return " Alpha"; + return "Alpha"; #elif BUILD_ID == BUILD_BETA - return " Beta"; + return "Beta"; #elif BUILD_ID == BUILD_RC - return " RC"; + return fmt ("RC %1", RC_NUMBER); #else return ""; #endif // BUILD_ID } -const char* fullVersionString() { - if (g_fullVersionString.length() == 0) - g_fullVersionString = fmt ("v%1%2", versionString(), versionMoniker()); - - return g_fullVersionString.toStdString().c_str(); +str fullVersionString() { + return fmt ("v%1 %2", versionString(), versionMoniker()); } static void bombBox (str msg) {