mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Battery (Linux): code refactor, support serial number detection
This commit is contained in:
@@ -470,6 +470,13 @@ uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue)
|
||||
return str_end == strbuf->chars ? defaultValue : (uint64_t)result;
|
||||
}
|
||||
|
||||
int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue)
|
||||
{
|
||||
char* str_end;
|
||||
long long result = strtoll(strbuf->chars, &str_end, 10);
|
||||
return str_end == strbuf->chars ? defaultValue : (int64_t)result;
|
||||
}
|
||||
|
||||
void ffStrbufUpperCase(FFstrbuf* strbuf)
|
||||
{
|
||||
for (uint32_t i = 0; i < strbuf->length; ++i)
|
||||
|
||||
@@ -83,6 +83,7 @@ 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 int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue);
|
||||
FF_C_NODISCARD uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue);
|
||||
|
||||
void ffStrbufUpperCase(FFstrbuf* strbuf);
|
||||
|
||||
Reference in New Issue
Block a user