Chore: runs clang-format

This commit is contained in:
李通洲
2026-04-28 19:45:19 +08:00
parent 594c73461e
commit 55e4896524
7 changed files with 24 additions and 16 deletions
+4 -4
View File
@@ -790,9 +790,9 @@ bool ffStrbufMatchSeparatedNS(const FFstrbuf* strbuf, uint32_t compLength, const
}
for (const char* p = comp; p < comp + compLength;) {
const char* colon = memchr(p, separator, (size_t)(comp + compLength - p));
const char* colon = memchr(p, separator, (size_t) (comp + compLength - p));
if (colon == NULL) {
uint32_t remainingLen = (uint32_t)(comp + compLength - p);
uint32_t remainingLen = (uint32_t) (comp + compLength - p);
return strbuf->length == remainingLen && memcmp(strbuf->chars, p, remainingLen) == 0;
}
@@ -818,9 +818,9 @@ bool ffStrbufMatchSeparatedIgnCaseNS(const FFstrbuf* strbuf, uint32_t compLength
}
for (const char* p = comp; p < comp + compLength;) {
const char* colon = memchr(p, separator, (size_t)(comp + compLength - p));
const char* colon = memchr(p, separator, (size_t) (comp + compLength - p));
if (colon == NULL) {
uint32_t remainingLen = (uint32_t)(comp + compLength - p);
uint32_t remainingLen = (uint32_t) (comp + compLength - p);
return strbuf->length == remainingLen && strncasecmp(strbuf->chars, p, remainingLen) == 0;
}
+1 -1
View File
@@ -441,7 +441,7 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char*
while (true) {
DWORD bytes = 0;
if (!ReadFile(hInput, buffer + bytesRead, (DWORD)(sizeof(buffer) - 1 - bytesRead), &bytes, NULL) || bytes == 0) {
if (!ReadFile(hInput, buffer + bytesRead, (DWORD) (sizeof(buffer) - 1 - bytesRead), &bytes, NULL) || bytes == 0) {
va_end(args);
return "ReadFile() failed";
}
+6 -2
View File
@@ -110,7 +110,9 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) {
&& sdl->sdl_len
#endif
) {
if (sdl->sdl_nlen > IF_NAMESIZE) return false;
if (sdl->sdl_nlen > IF_NAMESIZE) {
return false;
}
memcpy(result->ifName, sdl->sdl_data, sdl->sdl_nlen);
result->ifName[sdl->sdl_nlen] = '\0';
result->ifIndex = sdl->sdl_index;
@@ -183,7 +185,9 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) {
&& sdl->sdl_len
#endif
) {
if (sdl->sdl_nlen > IF_NAMESIZE) return false;
if (sdl->sdl_nlen > IF_NAMESIZE) {
return false;
}
memcpy(result->ifName, sdl->sdl_data, sdl->sdl_nlen);
result->ifName[sdl->sdl_nlen] = '\0';
result->ifIndex = sdl->sdl_index;
+6 -2
View File
@@ -65,7 +65,9 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) {
if ((rtm->rtm_flags & RTF_GATEWAY) && !(rtm->rtm_flags & RTF_REJECT) && (sa->sa_family == AF_INET)) {
struct sockaddr_dl* sdl = (struct sockaddr_dl*) get_rt_address(rtm, RTA_IFP);
if (sdl && sdl->sdl_family == AF_LINK) {
if (sdl->sdl_nlen > IF_NAMESIZE) continue;
if (sdl->sdl_nlen > IF_NAMESIZE) {
continue;
}
memcpy(result->ifName, sdl->sdl_data, sdl->sdl_nlen);
result->ifName[sdl->sdl_nlen] = '\0';
result->ifIndex = sdl->sdl_index;
@@ -106,7 +108,9 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) {
if ((rtm->rtm_flags & RTF_GATEWAY) && !(rtm->rtm_flags & RTF_REJECT) && (sa->sa_family == AF_INET6)) {
struct sockaddr_dl* sdl = (struct sockaddr_dl*) get_rt_address(rtm, RTA_IFP);
if (sdl && sdl->sdl_family == AF_LINK) {
if (sdl->sdl_nlen > IF_NAMESIZE) continue;
if (sdl->sdl_nlen > IF_NAMESIZE) {
continue;
}
memcpy(result->ifName, sdl->sdl_data, sdl->sdl_nlen);
result->ifName[sdl->sdl_nlen] = '\0';
result->ifIndex = sdl->sdl_index;
-1
View File
@@ -67,7 +67,6 @@ const char* ffDetectHost(FFHostResult* host) {
if (ffStrbufStartsWithS(&host->name, "Standard PC")) {
ffStrbufPrependS(&host->name, "KVM/QEMU ");
}
#if __aarch64__
else if (host->family.length == 0 && ffStrbufEqualS(&host->vendor, "Apple Inc.") && ffStrbufStartsWithS(&host->name, "Mac")) {
// Hack for Asahi Linux
@@ -163,9 +163,10 @@ static bool detectDefaultTerminal(FFTerminalResult* result) {
FF_AUTO_CLOSE_FD HANDLE hkcu = NULL;
if (ffRegOpenKeyForRead(HKEY_CURRENT_USER, L"Console\\%%Startup", &hkcu, NULL) &&
ffRegReadData(hkcu, L"DelegationTerminal", &(FFArgBuffer) {
.data = uuid,
.length = (uint32_t) (sizeof(regPath) - (size_t) (uuid - regPath) * sizeof(wchar_t)),
}, NULL)) {
.data = uuid,
.length = (uint32_t) (sizeof(regPath) - (size_t) (uuid - regPath) * sizeof(wchar_t)),
},
NULL)) {
if (wcscmp(uuid, L"{00000000-0000-0000-0000-000000000000}") == 0 || // Let Windows decide
wcscmp(uuid, L"{B23D10C0-E52E-411E-9D5B-C09FDF709C7D}") == 0) // Conhost
{
+3 -3
View File
@@ -1563,7 +1563,7 @@ static const FFlogo E[] = {
},
// EN-OS
{
.names = {"ENOS"},
.names = { "ENOS" },
.lines = FASTFETCH_DATATEXT_LOGO_ENOS,
.colors = {
FF_COLOR_FG_LIGHT_BLUE,
@@ -2665,7 +2665,7 @@ static const FFlogo L[] = {
},
// LimeOS
{
.names = {"LimeOS"},
.names = { "LimeOS" },
.lines = FASTFETCH_DATATEXT_LOGO_LIMEOS,
.colors = {
FF_COLOR_FG_DEFAULT,
@@ -4264,7 +4264,7 @@ static const FFlogo R[] = {
},
// Redrose
{
.names = {"Redrose"},
.names = { "Redrose" },
.lines = FASTFETCH_DATATEXT_LOGO_REDROSE,
.colors = {
FF_COLOR_FG_RED,