Semver fixes, misc fixes
This commit is contained in:
parent
12b3132b1a
commit
b030791384
@ -5,7 +5,7 @@
|
||||
name = Bar Baz
|
||||
# Configuration version of this file. Config file will only be installed, if the config_version differs.
|
||||
# This means, the server may force the Slic3r configuration to be downgraded.
|
||||
config_version = 0.1
|
||||
config_version = 0.1.0
|
||||
# Where to get the updates from?
|
||||
config_update_url = https://example.com
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
name = Foo Bar
|
||||
# Configuration version of this file. Config file will only be installed, if the config_version differs.
|
||||
# This means, the server may force the Slic3r configuration to be downgraded.
|
||||
config_version = 0.1
|
||||
config_version = 0.1.0
|
||||
# Where to get the updates from?
|
||||
config_update_url = https://example.com
|
||||
|
||||
|
@ -615,3 +615,21 @@ semver_numeric (semver_t *x) {
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static char *semver_strdup(const char *src) {
|
||||
if (src == NULL) return NULL;
|
||||
size_t len = strlen(src) + 1;
|
||||
char *res = malloc(len);
|
||||
return res != NULL ? (char *) memcpy(res, src, len) : NULL;
|
||||
}
|
||||
|
||||
semver_t
|
||||
semver_copy(const semver_t *ver) {
|
||||
semver_t res = *ver;
|
||||
if (ver->metadata != NULL) {
|
||||
res.metadata = strdup(ver->metadata);
|
||||
}
|
||||
if (ver->prerelease != NULL) {
|
||||
res.prerelease = strdup(ver->prerelease);
|
||||
}
|
||||
}
|
@ -98,6 +98,9 @@ semver_is_valid (const char *s);
|
||||
int
|
||||
semver_clean (char *s);
|
||||
|
||||
semver_t
|
||||
semver_copy(const semver_t *ver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ AboutDialog::AboutDialog()
|
||||
|
||||
// version
|
||||
{
|
||||
std::string version_string = _(L("Version ")) + std::string(SLIC3R_VERSION);
|
||||
auto version_string = _(L("Version ")) + std::string(SLIC3R_VERSION);
|
||||
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
|
||||
wxFont version_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
#ifdef __WXMSW__
|
||||
|
@ -352,11 +352,11 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
|
||||
|
||||
// A different naming convention is used for the Wizard on Windows vs. OSX & GTK.
|
||||
#if WIN32
|
||||
std::string config_wizard_menu = _(L("Configuration Wizard"));
|
||||
std::string config_wizard_tooltip = _(L("Run configuration wizard"));
|
||||
auto config_wizard_menu = _(L("Configuration Wizard"));
|
||||
auto config_wizard_tooltip = _(L("Run configuration wizard"));
|
||||
#else
|
||||
std::string config_wizard_menu = _(L("Configuration Assistant"));
|
||||
std::string config_wizard_tooltip = _(L("Run configuration Assistant"));
|
||||
auto config_wizard_menu = _(L("Configuration Assistant"));
|
||||
auto config_wizard_tooltip = _(L("Run configuration Assistant"));
|
||||
#endif
|
||||
// Cmd+, is standard on OS X - what about other operating systems?
|
||||
local_menu->Append(config_id_base + ConfigMenuWizard, config_wizard_menu + "\u2026", config_wizard_tooltip);
|
||||
|
@ -43,11 +43,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static const Semver zero()
|
||||
{
|
||||
static semver_t ver = { 0, 0, 0, nullptr, nullptr };
|
||||
return Semver(ver);
|
||||
}
|
||||
static const Semver zero() { return Semver(semver_zero()); }
|
||||
|
||||
static const Semver inf()
|
||||
{
|
||||
@ -61,37 +57,21 @@ public:
|
||||
return Semver(ver);
|
||||
}
|
||||
|
||||
Semver(Semver &&other) : ver(other.ver)
|
||||
{
|
||||
other.ver.major = other.ver.minor = other.ver.patch = 0;
|
||||
other.ver.metadata = other.ver.prerelease = nullptr;
|
||||
}
|
||||
|
||||
Semver(const Semver &other) : ver(other.ver)
|
||||
{
|
||||
if (other.ver.metadata != nullptr)
|
||||
ver.metadata = strdup(other.ver.metadata);
|
||||
if (other.ver.prerelease != nullptr)
|
||||
ver.prerelease = strdup(other.ver.prerelease);
|
||||
}
|
||||
Semver(Semver &&other) : ver(other.ver) { other.ver = semver_zero(); }
|
||||
Semver(const Semver &other) : ver(::semver_copy(&other.ver)) {}
|
||||
|
||||
Semver &operator=(Semver &&other)
|
||||
{
|
||||
::semver_free(&ver);
|
||||
ver = other.ver;
|
||||
other.ver.major = other.ver.minor = other.ver.patch = 0;
|
||||
other.ver.metadata = other.ver.prerelease = nullptr;
|
||||
other.ver = semver_zero();
|
||||
return *this;
|
||||
}
|
||||
|
||||
Semver &operator=(const Semver &other)
|
||||
{
|
||||
::semver_free(&ver);
|
||||
ver = other.ver;
|
||||
if (other.ver.metadata != nullptr)
|
||||
ver.metadata = strdup(other.ver.metadata);
|
||||
if (other.ver.prerelease != nullptr)
|
||||
ver.prerelease = strdup(other.ver.prerelease);
|
||||
ver = ::semver_copy(&other.ver);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,8 @@ time_t get_current_time_utc()
|
||||
tm.tm_isdst = -1;
|
||||
return mktime(&tm);
|
||||
#else
|
||||
return gmtime();
|
||||
const time_t current_local = time(nullptr);
|
||||
return mktime(gmtime(¤t_local));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user