mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 14:10:11 +01:00
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:
@@ -2,29 +2,29 @@
|
||||
#include "common/io.h"
|
||||
#include "common/stringUtils.h"
|
||||
|
||||
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
|
||||
{
|
||||
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */) {
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir("/sys/class/input/");
|
||||
if (dirp == NULL)
|
||||
if (dirp == NULL) {
|
||||
return "opendir(\"/sys/class/input/\") == NULL";
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/class/input/");
|
||||
uint32_t baseLen = path.length;
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dirp)) != NULL)
|
||||
{
|
||||
if (!ffStrStartsWith(entry->d_name, "mouse"))
|
||||
while ((entry = readdir(dirp)) != NULL) {
|
||||
if (!ffStrStartsWith(entry->d_name, "mouse")) {
|
||||
continue;
|
||||
if (!ffCharIsDigit(entry->d_name[strlen("mouse")]))
|
||||
}
|
||||
if (!ffCharIsDigit(entry->d_name[strlen("mouse")])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
ffStrbufAppendS(&path, "/device/name");
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
if (ffAppendFileBuffer(path.chars, &name))
|
||||
{
|
||||
if (ffAppendFileBuffer(path.chars, &name)) {
|
||||
ffStrbufTrimRightSpace(&name);
|
||||
ffStrbufSubstrBefore(&path, path.length - 4);
|
||||
|
||||
@@ -33,8 +33,9 @@ const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
|
||||
ffStrbufInit(&device->serial);
|
||||
|
||||
ffStrbufAppendS(&path, "uniq");
|
||||
if (ffAppendFileBuffer(path.chars, &device->serial))
|
||||
if (ffAppendFileBuffer(path.chars, &device->serial)) {
|
||||
ffStrbufTrimRightSpace(&device->serial);
|
||||
}
|
||||
}
|
||||
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
|
||||
Reference in New Issue
Block a user