summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-23 14:15:51 +0200
committercgzones <cgzones@googlemail.com>2020-09-24 20:14:17 +0200
commit18b1e9fba95ce50d47c2199920f6727f26de4063 (patch)
tree16055d1227ac67b0bbd61de7787b6739b3cc3bec
parent6a03cd237a2e85600275a358430ea544f53aba3e (diff)
Do not drop qualifier in cast
ListItem.c:73:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual] ListItem* obj1 = (ListItem*) cast1; ^ ListItem.c:74:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual] ListItem* obj2 = (ListItem*) cast2; ^ Process.c:434:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Process* p1 = (Process*)v1; ^ Process.c:435:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Process* p2 = (Process*)v2; ^ Process.c:441:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Settings *settings = ((Process*)v1)->settings; ^ Process.c:443:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p1 = (Process*)v1; ^ Process.c:444:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p2 = (Process*)v2; ^ Process.c:446:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p2 = (Process*)v1; ^ Process.c:447:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p1 = (Process*)v2; ^ AffinityPanel.c:37:16: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual] free((void*)this->text); ^ AffinityPanel.c:39:19: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual] free((void*)this->indent); ^ linux/LinuxProcess.c:294:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Settings *settings = ((Process*)v1)->settings; ^ linux/LinuxProcess.c:296:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p1 = (LinuxProcess*)v1; ^ linux/LinuxProcess.c:297:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p2 = (LinuxProcess*)v2; ^ linux/LinuxProcess.c:299:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p2 = (LinuxProcess*)v1; ^ linux/LinuxProcess.c:300:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p1 = (LinuxProcess*)v2; ^ linux/LinuxProcessList.c:62:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual] TtyDriver* a = (TtyDriver*) va; ^ linux/LinuxProcessList.c:63:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual] TtyDriver* b = (TtyDriver*) vb; ^ linux/Battery.c:130:21: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] free((char *) isOnline); ^ linux/Battery.c:197:26: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName); ^ linux/Battery.c:209:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName); ^ linux/Battery.c:262:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName); ^
-rw-r--r--Action.c4
-rw-r--r--AffinityPanel.c9
-rw-r--r--DisplayOptionsPanel.c6
-rw-r--r--ListItem.c4
-rw-r--r--MetersPanel.c2
-rw-r--r--Process.c16
-rw-r--r--ScreenManager.c2
-rw-r--r--ScreenManager.h4
-rw-r--r--linux/Battery.c12
-rw-r--r--linux/LinuxProcess.c12
-rw-r--r--linux/LinuxProcessList.c4
11 files changed, 37 insertions, 38 deletions
diff --git a/Action.c b/Action.c
index f36e0bd2..62266084 100644
--- a/Action.c
+++ b/Action.c
@@ -73,9 +73,9 @@ Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess)
// ----------------------------------------
-static void Action_runSetup(Settings* settings, const Header* header, ProcessList* pl) {
+static void Action_runSetup(Settings* settings, Header* header, ProcessList* pl) {
ScreenManager* scr = ScreenManager_new(0, header->height, 0, -1, HORIZONTAL, header, settings, true);
- CategoriesPanel* panelCategories = CategoriesPanel_new(scr, settings, (Header*) header, pl);
+ CategoriesPanel* panelCategories = CategoriesPanel_new(scr, settings, header, pl);
ScreenManager_add(scr, (Panel*) panelCategories, 16);
CategoriesPanel_makeMetersPage(panelCategories);
Panel* panelFocus;
diff --git a/AffinityPanel.c b/AffinityPanel.c
index 57e889aa..1cae4ee4 100644
--- a/AffinityPanel.c
+++ b/AffinityPanel.c
@@ -19,8 +19,8 @@ in the source distribution for its full text.
typedef struct MaskItem_ {
Object super;
- const char* text;
- const char* indent; /* used also as an condition whether this is a tree node */
+ char* text;
+ char* indent; /* used also as an condition whether this is a tree node */
int value; /* tri-state: 0 - off, 1 - some set, 2 - all set */
int sub_tree; /* tri-state: 0 - no sub-tree, 1 - open sub-tree, 2 - closed sub-tree */
Vector *children;
@@ -34,9 +34,8 @@ typedef struct MaskItem_ {
static void MaskItem_delete(Object* cast) {
MaskItem* this = (MaskItem*) cast;
- free((void*)this->text);
- if (this->indent)
- free((void*)this->indent);
+ free(this->text);
+ free(this->indent);
Vector_delete(this->children);
#ifdef HAVE_LIBHWLOC
if (this->ownCpuset)
diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c
index 6978e238..37b5bcd0 100644
--- a/DisplayOptionsPanel.c
+++ b/DisplayOptionsPanel.c
@@ -43,9 +43,9 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
if (result == HANDLED) {
this->settings->changed = true;
- const Header* header = this->scr->header;
- Header_calculateHeight((Header*) header);
- Header_reinit((Header*) header);
+ Header* header = this->scr->header;
+ Header_calculateHeight(header);
+ Header_reinit(header);
Header_draw(header);
ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2);
}
diff --git a/ListItem.c b/ListItem.c
index 73129fa9..8d26d7f0 100644
--- a/ListItem.c
+++ b/ListItem.c
@@ -70,7 +70,7 @@ const char* ListItem_getRef(ListItem* this) {
}
long ListItem_compare(const void* cast1, const void* cast2) {
- ListItem* obj1 = (ListItem*) cast1;
- ListItem* obj2 = (ListItem*) cast2;
+ const ListItem* obj1 = (const ListItem*) cast1;
+ const ListItem* obj2 = (const ListItem*) cast2;
return strcmp(obj1->value, obj2->value);
}
diff --git a/MetersPanel.c b/MetersPanel.c
index 1e0afcdc..c82ba48b 100644
--- a/MetersPanel.c
+++ b/MetersPanel.c
@@ -177,7 +177,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
}
}
if (result == HANDLED || sideMove) {
- Header* header = (Header*) this->scr->header;
+ Header* header = this->scr->header;
this->settings->changed = true;
Header_calculateHeight(header);
Header_draw(header);
diff --git a/Process.c b/Process.c
index 839db8d7..3c404db3 100644
--- a/Process.c
+++ b/Process.c
@@ -431,20 +431,20 @@ bool Process_sendSignal(Process* this, Arg sgn) {
}
long Process_pidCompare(const void* v1, const void* v2) {
- Process* p1 = (Process*)v1;
- Process* p2 = (Process*)v2;
+ const Process* p1 = (const Process*)v1;
+ const Process* p2 = (const Process*)v2;
return (p1->pid - p2->pid);
}
long Process_compare(const void* v1, const void* v2) {
- Process *p1, *p2;
- Settings *settings = ((Process*)v1)->settings;
+ const Process *p1, *p2;
+ const Settings *settings = ((const Process*)v1)->settings;
if (settings->direction == 1) {
- p1 = (Process*)v1;
- p2 = (Process*)v2;
+ p1 = (const Process*)v1;
+ p2 = (const Process*)v2;
} else {
- p2 = (Process*)v1;
- p1 = (Process*)v2;
+ p2 = (const Process*)v1;
+ p1 = (const Process*)v2;
}
switch (settings->sortKey) {
case PERCENT_CPU:
diff --git a/ScreenManager.c b/ScreenManager.c
index 92e792b4..2a2cb1d0 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -17,7 +17,7 @@ in the source distribution for its full text.
#include <stdbool.h>
-ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, const Header* header, const Settings* settings, bool owner) {
+ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, Header* header, const Settings* settings, bool owner) {
ScreenManager* this;
this = xMalloc(sizeof(ScreenManager));
this->x1 = x1;
diff --git a/ScreenManager.h b/ScreenManager.h
index 3c19a05d..6f19ab8f 100644
--- a/ScreenManager.h
+++ b/ScreenManager.h
@@ -25,13 +25,13 @@ typedef struct ScreenManager_ {
Orientation orientation;
Vector* panels;
int panelCount;
- const Header* header;
+ Header* header;
const Settings* settings;
bool owner;
bool allowFocusChange;
} ScreenManager;
-ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, const Header* header, const Settings* settings, bool owner);
+ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, Header* header, const Settings* settings, bool owner);
void ScreenManager_delete(ScreenManager* this);
diff --git a/linux/Battery.c b/linux/Battery.c
index 6ea48c45..a0a0e58e 100644
--- a/linux/Battery.c
+++ b/linux/Battery.c
@@ -120,7 +120,7 @@ static ACPresence procAcpiCheck(void) {
fclose(file);
if (!line) continue;
- const char *isOnline = String_getToken(line, 2);
+ char *isOnline = String_getToken(line, 2);
free(line);
if (strcmp(isOnline, "on-line") == 0) {
@@ -128,7 +128,7 @@ static ACPresence procAcpiCheck(void) {
} else {
isOn = AC_ABSENT;
}
- free((char *) isOnline);
+ free(isOnline);
if (isOn == AC_PRESENT) {
break;
}
@@ -193,9 +193,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
if (!dirEntry)
break;
char* entryName = (char *) dirEntry->d_name;
- const char filePath[256];
+ char filePath[256];
- xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
+ xSnprintf(filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
int fd1 = open(filePath, O_RDONLY);
if (fd1 == -1)
continue;
@@ -207,7 +207,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
continue;
if (type[0] == 'B' && type[1] == 'a' && type[2] == 't') {
- xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
+ xSnprintf(filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
int fd2 = open(filePath, O_RDONLY);
if (fd2 == -1) {
closedir(dir);
@@ -260,7 +260,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
continue;
}
- xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
+ xSnprintf(filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
int fd3 = open(filePath, O_RDONLY);
if (fd3 == -1) {
closedir(dir);
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index a589d62e..41404de1 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -297,14 +297,14 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
}
long LinuxProcess_compare(const void* v1, const void* v2) {
- LinuxProcess *p1, *p2;
- Settings *settings = ((Process*)v1)->settings;
+ const LinuxProcess *p1, *p2;
+ const Settings *settings = ((const Process*)v1)->settings;
if (settings->direction == 1) {
- p1 = (LinuxProcess*)v1;
- p2 = (LinuxProcess*)v2;
+ p1 = (const LinuxProcess*)v1;
+ p2 = (const LinuxProcess*)v2;
} else {
- p2 = (LinuxProcess*)v1;
- p1 = (LinuxProcess*)v2;
+ p2 = (const LinuxProcess*)v1;
+ p1 = (const LinuxProcess*)v2;
}
long long diff;
switch ((int)settings->sortKey) {
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 807cc8a6..76f2a423 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -59,8 +59,8 @@ static ssize_t xread(int fd, void *buf, size_t count) {
}
static int sortTtyDrivers(const void* va, const void* vb) {
- TtyDriver* a = (TtyDriver*) va;
- TtyDriver* b = (TtyDriver*) vb;
+ const TtyDriver* a = (const TtyDriver*) va;
+ const TtyDriver* b = (const TtyDriver*) vb;
return (a->major == b->major) ? ((int)a->minorFrom - (int)b->minorFrom) : ((int)a->major - (int)b->major);
}

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