mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Resolve conversion from int to unsigned and back
This commit is contained in:
parent
ba1549f99b
commit
1e9b184367
7
Meter.c
7
Meter.c
@ -51,7 +51,7 @@ Meter* Meter_new(const struct ProcessList_* pl, int param, const MeterClass* typ
|
||||
int Meter_humanUnit(char* buffer, unsigned long int value, int size) {
|
||||
const char* prefix = "KMGTPEZY";
|
||||
unsigned long int powi = 1;
|
||||
unsigned int written, powj = 1, precision = 2;
|
||||
unsigned int powj = 1, precision = 2;
|
||||
|
||||
for (;;) {
|
||||
if (value / 1024 < powi)
|
||||
@ -73,10 +73,7 @@ int Meter_humanUnit(char* buffer, unsigned long int value, int size) {
|
||||
break;
|
||||
}
|
||||
|
||||
written = snprintf(buffer, size, "%.*f%c",
|
||||
precision, (double) value / powi, *prefix);
|
||||
|
||||
return written;
|
||||
return snprintf(buffer, size, "%.*f%c", precision, (double) value / powi, *prefix);
|
||||
}
|
||||
|
||||
void Meter_delete(Object* cast) {
|
||||
|
Loading…
Reference in New Issue
Block a user