mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Use size_t as len type for Meter_UpdateValues
Most of the time the parameter is passed to snprintf type functions
This commit is contained in:

committed by
Benny Baumann

parent
d9224c66a4
commit
e1ce141bc3
@ -25,7 +25,7 @@ static const int PressureStallMeter_attributes[] = {
|
||||
PRESSURE_STALL_THREEHUNDRED
|
||||
};
|
||||
|
||||
static void PressureStallMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||
static void PressureStallMeter_updateValues(Meter* this, char* buffer, size_t len) {
|
||||
const char* file;
|
||||
if (strstr(Meter_name(this), "CPU")) {
|
||||
file = "cpu";
|
||||
|
@ -70,7 +70,7 @@ static bool isSelinuxEnforcing(void) {
|
||||
return !!enforce;
|
||||
}
|
||||
|
||||
static void SELinuxMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, int len) {
|
||||
static void SELinuxMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t len) {
|
||||
enabled = isSelinuxEnabled();
|
||||
enforcing = isSelinuxEnforcing();
|
||||
|
||||
|
@ -229,7 +229,7 @@ static void updateViaExec(void) {
|
||||
fclose(commandOutput);
|
||||
}
|
||||
|
||||
static void SystemdMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, int size) {
|
||||
static void SystemdMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t size) {
|
||||
free(systemState);
|
||||
systemState = NULL;
|
||||
nFailedUnits = nInstalledJobs = nNames = nJobs = INVALID_VALUE;
|
||||
|
@ -11,7 +11,7 @@ static const int ZramMeter_attributes[] = {
|
||||
ZRAM
|
||||
};
|
||||
|
||||
static void ZramMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||
static void ZramMeter_updateValues(Meter* this, char* buffer, size_t size) {
|
||||
int written;
|
||||
|
||||
Platform_setZramValues(this);
|
||||
@ -38,11 +38,15 @@ static void ZramMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||
}
|
||||
*buffer++ = ')';
|
||||
size--;
|
||||
if ((size -= written) > 0) {
|
||||
*buffer++ = '/';
|
||||
size--;
|
||||
Meter_humanUnit(buffer, this->total, size);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
*buffer++ = '/';
|
||||
size--;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
Meter_humanUnit(buffer, this->total, size);
|
||||
}
|
||||
|
||||
static void ZramMeter_display(const Object* cast, RichString* out) {
|
||||
|
Reference in New Issue
Block a user