LibGUI: Remove unnecessary type cast in JsonArrayModel.

Since TCP sequence numbers are randomly choosen 32-bit numbers, it often
happend that the most significant bit was set. The cast to a 32-bit
signed integer then made the number negative.

Thus TCP sequence were shown negative in the SystemMonitor every so
often.
This commit is contained in:
asynts 2020-09-20 21:01:08 +02:00 committed by Andreas Kling
parent 3ce97b9c0e
commit 03a27bc693
Notes: sideshowbarker 2024-07-19 02:19:13 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -107,7 +107,7 @@ Variant JsonArrayModel::data(const ModelIndex& index, ModelRole role) const
if (field_spec.massage_for_display)
return field_spec.massage_for_display(object);
if (data.is_number())
return data.to_i32();
return data;
return object.get(json_field_name).to_string();
}

View file

@ -64,7 +64,7 @@ public:
return adopt(*new JsonArrayModel(json_path, move(fields)));
}
virtual ~JsonArrayModel() override {}
virtual ~JsonArrayModel() override { }
virtual int row_count(const ModelIndex& = ModelIndex()) const override { return m_array.size(); }
virtual int column_count(const ModelIndex& = ModelIndex()) const override { return m_fields.size(); }