mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 14:40:10 +01:00
Global: fixes -ffast-math compatibility
Unifies unset double handling using `-DBL_MAX` sentinel Fixes #1894
This commit is contained in:
+2
-2
@@ -521,11 +521,11 @@ void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file)
|
||||
fputc('\n', file);
|
||||
}
|
||||
|
||||
double ffStrbufToDouble(const FFstrbuf* strbuf)
|
||||
double ffStrbufToDouble(const FFstrbuf* strbuf, double defaultValue)
|
||||
{
|
||||
char* str_end;
|
||||
double result = strtod(strbuf->chars, &str_end);
|
||||
return str_end == strbuf->chars ? 0.0/0.0 : result;
|
||||
return str_end == strbuf->chars ? defaultValue : result;
|
||||
}
|
||||
|
||||
uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue)
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ bool ffStrbufEnsureEndsWithC(FFstrbuf* strbuf, char c);
|
||||
void ffStrbufWriteTo(const FFstrbuf* strbuf, FILE* file);
|
||||
void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file);
|
||||
|
||||
FF_C_NODISCARD double ffStrbufToDouble(const FFstrbuf* strbuf);
|
||||
FF_C_NODISCARD double ffStrbufToDouble(const FFstrbuf* strbuf, double defaultValue);
|
||||
FF_C_NODISCARD int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue);
|
||||
FF_C_NODISCARD uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue);
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ bool FFWmiRecord::getReal(const wchar_t* key, double* real)
|
||||
case VT_R4: *real = vtProp.fltVal; break;
|
||||
case VT_R8: *real = vtProp.dblVal; break;
|
||||
case VT_BOOL: *real = vtProp.boolVal != VARIANT_FALSE; break;
|
||||
default: *real = NAN; result = false;
|
||||
default: *real = -DBL_MAX; result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user