mirror of https://github.com/xzeldon/htop.git
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); ^
This commit is contained in:
parent
6a03cd237a
commit
18b1e9fba9
4
Action.c
4
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);
|
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);
|
ScreenManager_add(scr, (Panel*) panelCategories, 16);
|
||||||
CategoriesPanel_makeMetersPage(panelCategories);
|
CategoriesPanel_makeMetersPage(panelCategories);
|
||||||
Panel* panelFocus;
|
Panel* panelFocus;
|
||||||
|
|
|
@ -19,8 +19,8 @@ in the source distribution for its full text.
|
||||||
|
|
||||||
typedef struct MaskItem_ {
|
typedef struct MaskItem_ {
|
||||||
Object super;
|
Object super;
|
||||||
const char* text;
|
char* text;
|
||||||
const char* indent; /* used also as an condition whether this is a tree node */
|
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 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 */
|
int sub_tree; /* tri-state: 0 - no sub-tree, 1 - open sub-tree, 2 - closed sub-tree */
|
||||||
Vector *children;
|
Vector *children;
|
||||||
|
@ -34,9 +34,8 @@ typedef struct MaskItem_ {
|
||||||
|
|
||||||
static void MaskItem_delete(Object* cast) {
|
static void MaskItem_delete(Object* cast) {
|
||||||
MaskItem* this = (MaskItem*) cast;
|
MaskItem* this = (MaskItem*) cast;
|
||||||
free((void*)this->text);
|
free(this->text);
|
||||||
if (this->indent)
|
free(this->indent);
|
||||||
free((void*)this->indent);
|
|
||||||
Vector_delete(this->children);
|
Vector_delete(this->children);
|
||||||
#ifdef HAVE_LIBHWLOC
|
#ifdef HAVE_LIBHWLOC
|
||||||
if (this->ownCpuset)
|
if (this->ownCpuset)
|
||||||
|
|
|
@ -43,9 +43,9 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
|
||||||
|
|
||||||
if (result == HANDLED) {
|
if (result == HANDLED) {
|
||||||
this->settings->changed = true;
|
this->settings->changed = true;
|
||||||
const Header* header = this->scr->header;
|
Header* header = this->scr->header;
|
||||||
Header_calculateHeight((Header*) header);
|
Header_calculateHeight(header);
|
||||||
Header_reinit((Header*) header);
|
Header_reinit(header);
|
||||||
Header_draw(header);
|
Header_draw(header);
|
||||||
ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2);
|
ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ const char* ListItem_getRef(ListItem* this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
long ListItem_compare(const void* cast1, const void* cast2) {
|
long ListItem_compare(const void* cast1, const void* cast2) {
|
||||||
ListItem* obj1 = (ListItem*) cast1;
|
const ListItem* obj1 = (const ListItem*) cast1;
|
||||||
ListItem* obj2 = (ListItem*) cast2;
|
const ListItem* obj2 = (const ListItem*) cast2;
|
||||||
return strcmp(obj1->value, obj2->value);
|
return strcmp(obj1->value, obj2->value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == HANDLED || sideMove) {
|
if (result == HANDLED || sideMove) {
|
||||||
Header* header = (Header*) this->scr->header;
|
Header* header = this->scr->header;
|
||||||
this->settings->changed = true;
|
this->settings->changed = true;
|
||||||
Header_calculateHeight(header);
|
Header_calculateHeight(header);
|
||||||
Header_draw(header);
|
Header_draw(header);
|
||||||
|
|
16
Process.c
16
Process.c
|
@ -431,20 +431,20 @@ bool Process_sendSignal(Process* this, Arg sgn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
long Process_pidCompare(const void* v1, const void* v2) {
|
long Process_pidCompare(const void* v1, const void* v2) {
|
||||||
Process* p1 = (Process*)v1;
|
const Process* p1 = (const Process*)v1;
|
||||||
Process* p2 = (Process*)v2;
|
const Process* p2 = (const Process*)v2;
|
||||||
return (p1->pid - p2->pid);
|
return (p1->pid - p2->pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
long Process_compare(const void* v1, const void* v2) {
|
long Process_compare(const void* v1, const void* v2) {
|
||||||
Process *p1, *p2;
|
const Process *p1, *p2;
|
||||||
Settings *settings = ((Process*)v1)->settings;
|
const Settings *settings = ((const Process*)v1)->settings;
|
||||||
if (settings->direction == 1) {
|
if (settings->direction == 1) {
|
||||||
p1 = (Process*)v1;
|
p1 = (const Process*)v1;
|
||||||
p2 = (Process*)v2;
|
p2 = (const Process*)v2;
|
||||||
} else {
|
} else {
|
||||||
p2 = (Process*)v1;
|
p2 = (const Process*)v1;
|
||||||
p1 = (Process*)v2;
|
p1 = (const Process*)v2;
|
||||||
}
|
}
|
||||||
switch (settings->sortKey) {
|
switch (settings->sortKey) {
|
||||||
case PERCENT_CPU:
|
case PERCENT_CPU:
|
||||||
|
|
|
@ -17,7 +17,7 @@ in the source distribution for its full text.
|
||||||
#include <stdbool.h>
|
#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;
|
ScreenManager* this;
|
||||||
this = xMalloc(sizeof(ScreenManager));
|
this = xMalloc(sizeof(ScreenManager));
|
||||||
this->x1 = x1;
|
this->x1 = x1;
|
||||||
|
|
|
@ -25,13 +25,13 @@ typedef struct ScreenManager_ {
|
||||||
Orientation orientation;
|
Orientation orientation;
|
||||||
Vector* panels;
|
Vector* panels;
|
||||||
int panelCount;
|
int panelCount;
|
||||||
const Header* header;
|
Header* header;
|
||||||
const Settings* settings;
|
const Settings* settings;
|
||||||
bool owner;
|
bool owner;
|
||||||
bool allowFocusChange;
|
bool allowFocusChange;
|
||||||
} ScreenManager;
|
} 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);
|
void ScreenManager_delete(ScreenManager* this);
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ static ACPresence procAcpiCheck(void) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
if (!line) continue;
|
if (!line) continue;
|
||||||
|
|
||||||
const char *isOnline = String_getToken(line, 2);
|
char *isOnline = String_getToken(line, 2);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
if (strcmp(isOnline, "on-line") == 0) {
|
if (strcmp(isOnline, "on-line") == 0) {
|
||||||
|
@ -128,7 +128,7 @@ static ACPresence procAcpiCheck(void) {
|
||||||
} else {
|
} else {
|
||||||
isOn = AC_ABSENT;
|
isOn = AC_ABSENT;
|
||||||
}
|
}
|
||||||
free((char *) isOnline);
|
free(isOnline);
|
||||||
if (isOn == AC_PRESENT) {
|
if (isOn == AC_PRESENT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -193,9 +193,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
if (!dirEntry)
|
if (!dirEntry)
|
||||||
break;
|
break;
|
||||||
char* entryName = (char *) dirEntry->d_name;
|
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);
|
int fd1 = open(filePath, O_RDONLY);
|
||||||
if (fd1 == -1)
|
if (fd1 == -1)
|
||||||
continue;
|
continue;
|
||||||
|
@ -207,7 +207,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (type[0] == 'B' && type[1] == 'a' && type[2] == 't') {
|
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);
|
int fd2 = open(filePath, O_RDONLY);
|
||||||
if (fd2 == -1) {
|
if (fd2 == -1) {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
@ -260,7 +260,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
continue;
|
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);
|
int fd3 = open(filePath, O_RDONLY);
|
||||||
if (fd3 == -1) {
|
if (fd3 == -1) {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
|
@ -297,14 +297,14 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
|
||||||
}
|
}
|
||||||
|
|
||||||
long LinuxProcess_compare(const void* v1, const void* v2) {
|
long LinuxProcess_compare(const void* v1, const void* v2) {
|
||||||
LinuxProcess *p1, *p2;
|
const LinuxProcess *p1, *p2;
|
||||||
Settings *settings = ((Process*)v1)->settings;
|
const Settings *settings = ((const Process*)v1)->settings;
|
||||||
if (settings->direction == 1) {
|
if (settings->direction == 1) {
|
||||||
p1 = (LinuxProcess*)v1;
|
p1 = (const LinuxProcess*)v1;
|
||||||
p2 = (LinuxProcess*)v2;
|
p2 = (const LinuxProcess*)v2;
|
||||||
} else {
|
} else {
|
||||||
p2 = (LinuxProcess*)v1;
|
p2 = (const LinuxProcess*)v1;
|
||||||
p1 = (LinuxProcess*)v2;
|
p1 = (const LinuxProcess*)v2;
|
||||||
}
|
}
|
||||||
long long diff;
|
long long diff;
|
||||||
switch ((int)settings->sortKey) {
|
switch ((int)settings->sortKey) {
|
||||||
|
|
|
@ -59,8 +59,8 @@ static ssize_t xread(int fd, void *buf, size_t count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sortTtyDrivers(const void* va, const void* vb) {
|
static int sortTtyDrivers(const void* va, const void* vb) {
|
||||||
TtyDriver* a = (TtyDriver*) va;
|
const TtyDriver* a = (const TtyDriver*) va;
|
||||||
TtyDriver* b = (TtyDriver*) vb;
|
const TtyDriver* b = (const TtyDriver*) vb;
|
||||||
return (a->major == b->major) ? ((int)a->minorFrom - (int)b->minorFrom) : ((int)a->major - (int)b->major);
|
return (a->major == b->major) ? ((int)a->minorFrom - (int)b->minorFrom) : ((int)a->major - (int)b->major);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue