1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

SystemMonitor: Use u64 for all GraphWidget values

Turns out size_t is not guaranteed to be 64-bit on i686 and trying to
set the max value using a u64 caused a narrowing conversion.
This commit is contained in:
sin-ack 2021-10-06 22:32:56 +00:00 committed by Andreas Kling
parent 4444bcabde
commit c330ad27b6
3 changed files with 24 additions and 24 deletions

View file

@ -15,10 +15,10 @@ class GraphWidget final : public GUI::Frame {
public:
virtual ~GraphWidget() override;
void set_max(size_t max) { m_max = max; }
size_t max() const { return m_max; }
void set_max(u64 max) { m_max = max; }
u64 max() const { return m_max; }
void add_value(Vector<size_t, 1>&&);
void add_value(Vector<u64, 1>&&);
struct ValueFormat {
Gfx::ColorRole graph_color_role { Gfx::ColorRole::Base };
@ -38,9 +38,9 @@ private:
virtual void paint_event(GUI::PaintEvent&) override;
size_t m_max { 100 };
u64 m_max { 100 };
Vector<ValueFormat, 1> m_value_format;
CircularQueue<Vector<size_t, 1>, 4000> m_values;
CircularQueue<Vector<u64, 1>, 4000> m_values;
bool m_stack_values { false };
Vector<Gfx::IntPoint, 1> m_calculated_points;