mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-24 23:40:39 +01:00
[v0.94] Fix compilation issues
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
|||||||
CXX=gcc
|
CXX=gcc
|
||||||
|
|
||||||
CXXFLAGS=-Wall -Wextra -Werror -pedantic -fstack-protector-all -pedantic -std=c99
|
CXXFLAGS=-Wall -Wextra -Werror -pedantic -fstack-protector-all -pedantic -std=c99
|
||||||
SANITY_FLAGS=-Wfloat-equal -Wshadow -Wpointer-arith
|
SANITY_FLAGS=-Wfloat-equal -Wshadow -Wpointer-arith -Wno-stringop-truncation
|
||||||
|
|
||||||
SRC_COMMON=src/common/
|
SRC_COMMON=src/common/
|
||||||
|
|
||||||
|
|||||||
@@ -125,10 +125,12 @@ void init_cpu_info(struct cpuInfo* cpu) {
|
|||||||
// We assume all cpus share the same hardware
|
// We assume all cpus share the same hardware
|
||||||
// capabilities but I'm not sure it is always
|
// capabilities but I'm not sure it is always
|
||||||
// true...
|
// true...
|
||||||
|
// ARM32 https://elixir.bootlin.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h
|
||||||
|
// ARM64 https://elixir.bootlin.com/linux/latest/source/arch/arm64/include/uapi/asm/hwcap.h
|
||||||
struct features* get_features_info() {
|
struct features* get_features_info() {
|
||||||
struct features* feat = malloc(sizeof(struct features));
|
struct features* feat = malloc(sizeof(struct features));
|
||||||
bool *ptr = &(feat->AES);
|
bool *ptr = &(feat->AES);
|
||||||
for(int i = 0; i < sizeof(struct features)/sizeof(bool); i++, *ptr++) {
|
for(uint32_t i = 0; i < sizeof(struct features)/sizeof(bool); i++, ptr++) {
|
||||||
*ptr = false;
|
*ptr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ char* get_str_freq(struct frequency* freq) {
|
|||||||
char* string = malloc(sizeof(char)*size);
|
char* string = malloc(sizeof(char)*size);
|
||||||
memset(string, 0, sizeof(char)*size);
|
memset(string, 0, sizeof(char)*size);
|
||||||
|
|
||||||
if(freq->max == UNKNOWN_FREQ)
|
if(freq->max == UNKNOWN_FREQ || freq->max < 0)
|
||||||
snprintf(string,strlen(STRING_UNKNOWN)+1,STRING_UNKNOWN);
|
snprintf(string,strlen(STRING_UNKNOWN)+1,STRING_UNKNOWN);
|
||||||
else if(freq->max >= 1000)
|
else if(freq->max >= 1000)
|
||||||
snprintf(string,size,"%.2f"STRING_GIGAHERZ,(float)(freq->max)/1000);
|
snprintf(string,size,"%.2f"STRING_GIGAHERZ,(float)(freq->max)/1000);
|
||||||
|
|||||||
@@ -172,6 +172,10 @@ struct ascii* set_ascii(VENDOR vendor, STYLE style, struct colors* cs) {
|
|||||||
COL_FANCY_4 = COLOR_FG_GREEN;
|
COL_FANCY_4 = COLOR_FG_GREEN;
|
||||||
art->ascii_chars[0] = '@';
|
art->ascii_chars[0] = '@';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
printBug("Invalid CPU vendor in set_ascii (%d)", art->vendor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#elif ARCH_ARM
|
#elif ARCH_ARM
|
||||||
if(art->vendor == SOC_SNAPDRAGON) {
|
if(art->vendor == SOC_SNAPDRAGON) {
|
||||||
COL_FANCY_1 = COLOR_BG_RED;
|
COL_FANCY_1 = COLOR_BG_RED;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ struct cpuInfo* get_cpu_info() {
|
|||||||
cpu->feat = feat;
|
cpu->feat = feat;
|
||||||
|
|
||||||
bool *ptr = &(feat->AES);
|
bool *ptr = &(feat->AES);
|
||||||
for(int i = 0; i < sizeof(struct features)/sizeof(bool); i++, *ptr++) {
|
for(uint32_t i = 0; i < sizeof(struct features)/sizeof(bool); i++, ptr++) {
|
||||||
*ptr = false;
|
*ptr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user