From 2ee50d030178cede83eb9d0005fbc19f819d30fe Mon Sep 17 00:00:00 2001 From: Graham Inggs Date: Mon, 5 Feb 2018 14:48:51 +0200 Subject: Imported Upstream version 2.1.0 --- LoadAverageMeter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'LoadAverageMeter.c') diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c index 54e517a..e29433f 100644 --- a/LoadAverageMeter.c +++ b/LoadAverageMeter.c @@ -22,17 +22,17 @@ int LoadMeter_attributes[] = { LOAD }; static void LoadAverageMeter_updateValues(Meter* this, char* buffer, int size) { Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]); - snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]); + xSnprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]); } static void LoadAverageMeter_display(Object* cast, RichString* out) { Meter* this = (Meter*)cast; char buffer[20]; - sprintf(buffer, "%.2f ", this->values[0]); + xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[0]); RichString_write(out, CRT_colors[LOAD_AVERAGE_ONE], buffer); - sprintf(buffer, "%.2f ", this->values[1]); + xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[1]); RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer); - sprintf(buffer, "%.2f ", this->values[2]); + xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[2]); RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer); } @@ -42,13 +42,13 @@ static void LoadMeter_updateValues(Meter* this, char* buffer, int size) { if (this->values[0] > this->total) { this->total = this->values[0]; } - snprintf(buffer, size, "%.2f", this->values[0]); + xSnprintf(buffer, size, "%.2f", this->values[0]); } static void LoadMeter_display(Object* cast, RichString* out) { Meter* this = (Meter*)cast; char buffer[20]; - sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]); + xSnprintf(buffer, sizeof(buffer), "%.2f ", ((Meter*)this)->values[0]); RichString_write(out, CRT_colors[LOAD], buffer); } -- cgit v1.2.3