]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
cli : avoid std::exchange
authorGeorgi Gerganov <redacted>
Wed, 7 May 2025 10:22:47 +0000 (13:22 +0300)
committerGeorgi Gerganov <redacted>
Wed, 7 May 2025 12:39:32 +0000 (15:39 +0300)
ggml-ci

examples/cli/cli.cpp

index f202ebd52595266e84918fb70bcaaca6b8986e81..fccfd13eb0da8a05c1c4e7fb637486011da5a5e5 100644 (file)
@@ -9,7 +9,6 @@
 #include <cstdio>
 #include <string>
 #include <thread>
-#include <utility>
 #include <vector>
 #include <cstring>
 
@@ -1019,10 +1018,12 @@ int main(int argc, char ** argv) {
 
             bool open(const char * ext, const char * function) {
                 if (is_stdout) {
-                    if (std::exchange(used_stdout, true)) {
+                    if (used_stdout) {
                         fprintf(stderr, "warning: Not appending multiple file formats to stdout\n");
                         return false;
                     }
+
+                    used_stdout = true;
 #ifdef _WIN32
                     fout = std::ofstream{"CON"};
 #else
@@ -1032,6 +1033,7 @@ int main(int argc, char ** argv) {
                     // Also assuming /dev is mounted
                     return true;
                 }
+
                 fname_out.resize(basename_length);
                 fname_out += ext;
                 fout = std::ofstream{fname_out};