summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-11-24 18:37:13 +0100
committerBenny Baumann <BenBE@geshi.org>2020-12-06 16:03:44 +0100
commit77ec86aff4314afd893baed0d16d7bd52c387fd4 (patch)
tree64a92b2b520192d00de88cea6b0195a32530f968
parente1ce141bc3123c1dea7eb2ef908c8ebce945c72a (diff)
Use size_t as type for buffer length in Process
-rw-r--r--Process.c6
-rw-r--r--Process.h2
-rw-r--r--linux/LinuxProcess.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/Process.c b/Process.c
index 7ea2c4af..8245f86d 100644
--- a/Process.c
+++ b/Process.c
@@ -223,7 +223,7 @@ static inline void Process_writeCommand(const Process* this, int attr, int basea
}
}
-void Process_outputRate(RichString* str, char* buffer, int n, double rate, int coloring) {
+void Process_outputRate(RichString* str, char* buffer, size_t n, double rate, int coloring) {
int largeNumberColor = CRT_colors[LARGE_NUMBER];
int processMegabytesColor = CRT_colors[PROCESS_MEGABYTES];
int processColor = CRT_colors[PROCESS];
@@ -258,7 +258,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
char buffer[256]; buffer[255] = '\0';
int attr = CRT_colors[DEFAULT_COLOR];
int baseattr = CRT_colors[PROCESS_BASENAME];
- int n = sizeof(buffer) - 1;
+ size_t n = sizeof(buffer) - 1;
bool coloring = this->settings->highlightMegabytes;
switch (field) {
@@ -312,7 +312,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
} else {
ret = snprintf(buf, n, " ");
}
- if (ret < 0 || ret >= n) {
+ if (ret < 0 || (size_t)ret >= n) {
written = n;
} else {
written = ret;
diff --git a/Process.h b/Process.h
index 7a68c69f..48e31b1d 100644
--- a/Process.h
+++ b/Process.h
@@ -176,7 +176,7 @@ void Process_printTime(RichString* str, unsigned long long totalHundredths);
void Process_fillStarttimeBuffer(Process* this);
-void Process_outputRate(RichString* str, char* buffer, int n, double rate, int coloring);
+void Process_outputRate(RichString* str, char* buffer, size_t n, double rate, int coloring);
void Process_display(const Object* cast, RichString* out);
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index f51cf1e3..8298000a 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -618,7 +618,7 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces
bool coloring = this->settings->highlightMegabytes;
char buffer[256]; buffer[255] = '\0';
int attr = CRT_colors[DEFAULT_COLOR];
- int n = sizeof(buffer) - 1;
+ size_t n = sizeof(buffer) - 1;
switch ((int)field) {
case TTY_NR: {
if (lp->ttyDevice) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy