Global: replaces NULL to nullptr

This commit is contained in:
李通洲
2026-07-10 18:08:04 +08:00
parent 873454191f
commit ba18705d2e
387 changed files with 2411 additions and 2411 deletions
+27 -27
View File
@@ -52,7 +52,7 @@ static const char* getHyprland(FFstrbuf* result) {
ffStrbufSubstrBeforeFirstC(result, '"');
ffStrbufTrimLeft(result, 'v');
FF_DEBUG("Extracted version from version.h: %s", result->chars);
return NULL;
return nullptr;
}
FF_DEBUG("Failed to extract version from version.h");
ffStrbufClear(result);
@@ -70,11 +70,11 @@ static const char* getHyprland(FFstrbuf* result) {
ffBinaryExtractStrings(buffer.chars, extractHyprlandVersion, result, (uint32_t) strlen("v0.0.0"));
if (result->length > 0) {
FF_DEBUG("Extracted version from binary strings: %s", result->chars);
return NULL;
return nullptr;
}
FF_DEBUG("Failed to extract version from binary strings, trying --version option");
if (ffProcessAppendStdOut(result, (char* const[]) { buffer.chars, "--version", NULL }) == NULL) {
if (ffProcessAppendStdOut(result, (char* const[]) { buffer.chars, "--version", nullptr }) == nullptr) {
// Hyprland 0.48.1 built from branch at commit 29e2e59...
// Date: ...
// Tag: v0.48.1, commits: 5937
@@ -90,7 +90,7 @@ static const char* getHyprland(FFstrbuf* result) {
ffStrbufSubstrBeforeFirstC(result, ' ');
FF_DEBUG("Extracted version from output: %s", result->chars);
}
return NULL;
return nullptr;
}
FF_DEBUG("Failed to run Hyprland --version command");
@@ -126,12 +126,12 @@ static const char* getSway(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractSwayVersion, result, (uint32_t) strlen("sway version 0.0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
if (ffProcessAppendStdOut(&buffer, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // sway version 1.10
return extractSwayVersion(buffer.chars, buffer.length, result) ? "Failed to parse sway version output" : NULL;
if (ffProcessAppendStdOut(&buffer, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // sway version 1.10
return extractSwayVersion(buffer.chars, buffer.length, result) ? "Failed to parse sway version output" : nullptr;
}
return "Failed to run command `sway --version`";
@@ -146,24 +146,24 @@ static const char* getLabwc(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // labwc 0.9.0 (+xwayland +nls +rsvg +libsfdo)
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // labwc 0.9.0 (+xwayland +nls +rsvg +libsfdo)
ffStrbufSubstrAfterFirstC(result, ' ');
ffStrbufSubstrBeforeFirstC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `labwc --version`";
}
static const char* getNiri(FFstrbuf* result) {
if (ffProcessAppendStdOut(result, (char* const[]) { "niri", "--version", NULL }) == NULL) { // niri 25.11 (commit b35bcae)
if (ffProcessAppendStdOut(result, (char* const[]) { "niri", "--version", nullptr }) == nullptr) { // niri 25.11 (commit b35bcae)
ffStrbufSubstrAfterFirstC(result, ' ');
ffStrbufSubstrBeforeLastC(result, '(');
ffStrbufTrimRightSpace(result);
return NULL;
return nullptr;
}
return "Failed to run command `niri --version`";
@@ -176,10 +176,10 @@ static const char* getWeston(FFstrbuf* result) {
return "Failed to find weston executable path";
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // weston 8.0.0\n...
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // weston 8.0.0\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `weston --version`";
@@ -204,7 +204,7 @@ static const char* getWslg(FFstrbuf* result) {
return "Failed to parse WSLg version from /mnt/wslg/versions.txt";
}
return NULL;
return nullptr;
}
#endif
@@ -230,13 +230,13 @@ static const char* getI3(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractI3Version, result, (uint32_t) strlen("0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // i3 version 1.10 C 2009...
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // i3 version 1.10 C 2009...
ffStrbufSubstrAfterFirstS(result, "version ");
ffStrbufSubstrBeforeFirstC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `i3 --version`";
@@ -251,13 +251,13 @@ static const char* getCtwm(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // ctwm version 4.0.1\n...
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // ctwm version 4.0.1\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `ctwm --version`";
@@ -272,13 +272,13 @@ static const char* getFvwm(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "-version", NULL }) == NULL) { // [FVWM][main]: fvwm Version 2.2.5\n...
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "-version", nullptr }) == nullptr) { // [FVWM][main]: fvwm Version 2.2.5\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `fvwm -version`";
@@ -293,13 +293,13 @@ static const char* getOpenbox(FFstrbuf* result) {
ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0"));
if (result->length > 0) {
return NULL;
return nullptr;
}
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // Openbox 3.6.1\n...
if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", nullptr }) == nullptr) { // Openbox 3.6.1\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
return nullptr;
}
return "Failed to run command `openbox --version`";