From eda188dc3761addf121ecf1fd55eda820e40ec33 Mon Sep 17 00:00:00 2001 From: Songtronix Date: Fri, 18 Oct 2019 12:03:01 +0200 Subject: [PATCH] fix(crash): overflowing the stack --- client/src/lib.rs | 4 ++-- common/build.rs | 2 +- common/src/util/mod.rs | 12 ------------ voxygen/src/hud/mod.rs | 6 +++++- voxygen/src/menu/char_selection/ui.rs | 8 ++++++-- voxygen/src/menu/main/ui.rs | 6 +++++- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index 801b22a40c..f7dd86e9d7 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -82,8 +82,8 @@ impl Client { "Server is running {}[{}], you are running {}[{}], versions might be incompatible!", server_info.git_hash, server_info.git_date, - common::util::GIT_HASH, - common::util::GIT_DATE, + common::util::GIT_HASH.to_string(), + common::util::GIT_DATE.to_string(), ); } diff --git a/common/build.rs b/common/build.rs index 0420fa754a..2abf3b0af1 100644 --- a/common/build.rs +++ b/common/build.rs @@ -13,7 +13,7 @@ fn main() { "log", "-n", "1", - "--pretty=format:%h %cd", + "--pretty=format:%h/%cd", "--date=format:%Y-%m-%d-%H:%M", ]) .output() diff --git a/common/src/util/mod.rs b/common/src/util/mod.rs index 7765411473..85c761eed6 100644 --- a/common/src/util/mod.rs +++ b/common/src/util/mod.rs @@ -5,18 +5,6 @@ lazy_static::lazy_static! { pub static ref GIT_DATE: &'static str = include_str!(concat!(env!("OUT_DIR"), "/githash")).split(" ").nth(1).unwrap(); } -impl std::fmt::Display for GIT_HASH { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.to_string()) - } -} - -impl std::fmt::Display for GIT_DATE { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.to_string()) - } -} - use vek::{Mat3, Rgb, Rgba, Vec3}; /// This is a fast approximation of powf. This should only be used when minor accuracy loss is acceptable. diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 4b02ecdb05..6dd7c4bde3 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -452,7 +452,11 @@ impl Hud { let mut events = Vec::new(); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); - let version = format!("{}-{}", env!("CARGO_PKG_VERSION"), common::util::GIT_HASH); + let version = format!( + "{}-{}", + env!("CARGO_PKG_VERSION"), + common::util::GIT_VERSION.to_string() + ); if self.show.ingame { // Crosshair diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index 1ed5049bd2..9a805b5130 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -288,7 +288,11 @@ impl CharSelectionUi { fn update_layout(&mut self, client: &Client) -> Vec { let mut events = Vec::new(); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); - let version = env!("CARGO_PKG_VERSION"); + let version = format!( + "{}-{}", + env!("CARGO_PKG_VERSION"), + common::util::GIT_VERSION.to_string() + ); // Tooltip let tooltip_human = Tooltip::new({ // Edge images [t, b, r, l] @@ -469,7 +473,7 @@ impl CharSelectionUi { } // Alpha Version - Text::new(version) + Text::new(&version) .top_right_with_margins_on(ui_widgets.window, 5.0, 5.0) .font_size(14) .font_id(self.fonts.cyri) diff --git a/voxygen/src/menu/main/ui.rs b/voxygen/src/menu/main/ui.rs index 3882952679..72ee215e5b 100644 --- a/voxygen/src/menu/main/ui.rs +++ b/voxygen/src/menu/main/ui.rs @@ -179,7 +179,11 @@ impl MainMenuUi { fn update_layout(&mut self, global_state: &mut GlobalState) -> Vec { let mut events = Vec::new(); let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets(); - let version = format!("{}-{}/{}", env!("CARGO_PKG_VERSION"), common::util::GIT_HASH, common::util::GIT_DATE); + let version = format!( + "{}-{}", + env!("CARGO_PKG_VERSION"), + common::util::GIT_VERSION.to_string() + ); const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0); const TEXT_COLOR_2: Color = Color::Rgba(1.0, 1.0, 1.0, 0.2);