Chore: run clang-format

```bash
find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i
```
This commit is contained in:
李通洲
2026-03-29 09:28:49 +08:00
parent cdd4cee968
commit e0eba8ce21
690 changed files with 28093 additions and 30062 deletions
+13 -16
View File
@@ -5,32 +5,29 @@
#include <stdio.h>
#include <inttypes.h>
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
{
const char* ffGetCpuUsageInfo(FFlist* cpuTimes) {
char buf[PROC_FILE_BUFFSIZ];
ssize_t nRead = ffReadFileData("/proc/stat", ARRAY_SIZE(buf) - 1, buf);
if(nRead < 0)
{
#ifdef __ANDROID__
if (nRead < 0) {
#ifdef __ANDROID__
return "Accessing \"/proc/stat\" is restricted on Android O+";
#else
#else
return "ffReadFileData(\"/proc/stat\", ARRAY_SIZE(buf) - 1, buf) failed";
#endif
#endif
}
buf[nRead] = '\0';
// Skip first line
char *start = NULL;
if((start = strchr(buf, '\n')) == NULL)
char* start = NULL;
if ((start = strchr(buf, '\n')) == NULL) {
return "skip first line failed";
}
++start;
uint64_t user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0;
char *token = NULL;
while ((token = strchr(start, '\n')))
{
if(sscanf(start, "cpu%*d%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%*[^\n]\n", &user, &nice, &system, &idle, &iowait, &irq, &softirq) == 7)
{
char* token = NULL;
while ((token = strchr(start, '\n'))) {
if (sscanf(start, "cpu%*d%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%" PRIu64 "%*[^\n]\n", &user, &nice, &system, &idle, &iowait, &irq, &softirq) == 7) {
uint64_t inUse = user + nice + system + irq + softirq;
uint64_t total = inUse + idle + iowait;
@@ -39,9 +36,9 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
.inUseAll = inUse,
.totalAll = total,
};
}
else
} else {
break;
}
start = token + 1;
}