[v0.96] Print "Unknown" string when manufacturing process is unkown

This commit is contained in:
Dr-Noob
2021-04-08 10:12:01 +02:00
parent 9aef2d8493
commit a67a605fb5

View File

@@ -38,6 +38,8 @@
typedef uint32_t MICROARCH; typedef uint32_t MICROARCH;
#define STRING_UNKNOWN "Unknown"
// Data not available // Data not available
#define NA -1 #define NA -1
@@ -398,14 +400,19 @@ char* get_str_uarch(struct cpuInfo* cpu) {
} }
char* get_str_process(struct cpuInfo* cpu) { char* get_str_process(struct cpuInfo* cpu) {
char* str = malloc(sizeof(char) * (4+2+1)); char* str = malloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
uint32_t process = cpu->arch->process; int32_t process = cpu->arch->process;
if(process > 100) if(process == UNK) {
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
}
else if(process > 100) {
sprintf(str, "%.2fum", (double)process/100); sprintf(str, "%.2fum", (double)process/100);
else }
else {
sprintf(str, "%dnm", process); sprintf(str, "%dnm", process);
}
return str; return str;
} }