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
+19 -12
View File
@@ -4,12 +4,12 @@
#include <inttypes.h>
const char* ffDetectMemory(FFMemoryResult* ram)
{
const char* ffDetectMemory(FFMemoryResult* ram) {
char buf[PROC_FILE_BUFFSIZ];
ssize_t nRead = ffReadFileData("/proc/meminfo", ARRAY_SIZE(buf) - 1, buf);
if(nRead < 0)
if (nRead < 0) {
return "ffReadFileData(\"/proc/meminfo\", ARRAY_SIZE(buf)-1, buf)";
}
buf[nRead] = '\0';
uint64_t memTotal = 0,
@@ -20,30 +20,37 @@ const char* ffDetectMemory(FFMemoryResult* ram)
cached = 0,
sReclaimable = 0;
char *token = NULL;
if((token = strstr(buf, "MemTotal:")) != NULL)
char* token = NULL;
if ((token = strstr(buf, "MemTotal:")) != NULL) {
memTotal = strtoul(token + strlen("MemTotal:"), NULL, 10);
else
} else {
return "MemTotal not found in /proc/meminfo";
}
if((token = strstr(buf, "MemAvailable:")) != NULL)
if ((token = strstr(buf, "MemAvailable:")) != NULL) {
memAvailable = strtoul(token + strlen("MemAvailable:"), NULL, 10);
}
if (memAvailable == 0 || memAvailable >= memTotal) // MemAvailable can be unreasonable. #1988
{
if((token = strstr(buf, "MemFree:")) != NULL)
if ((token = strstr(buf, "MemFree:")) != NULL) {
memFree = strtoul(token + strlen("MemFree:"), NULL, 10);
}
if((token = strstr(buf, "Buffers:")) != NULL)
if ((token = strstr(buf, "Buffers:")) != NULL) {
buffers = strtoul(token + strlen("Buffers:"), NULL, 10);
}
if((token = strstr(buf, "Cached:")) != NULL)
if ((token = strstr(buf, "Cached:")) != NULL) {
cached = strtoul(token + strlen("Cached:"), NULL, 10);
}
if((token = strstr(buf, "Shmem:")) != NULL)
if ((token = strstr(buf, "Shmem:")) != NULL) {
shmem = strtoul(token + strlen("Shmem:"), NULL, 10);
}
if((token = strstr(buf, "SReclaimable:")) != NULL)
if ((token = strstr(buf, "SReclaimable:")) != NULL) {
sReclaimable = strtoul(token + strlen("SReclaimable:"), NULL, 10);
}
memAvailable = memFree + buffers + cached + sReclaimable - shmem;
}