From 0055356fbcd29feeb3f0e3faf73d41aff4838625 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 7 May 2025 13:22:47 +0300 Subject: [PATCH] cli : avoid std::exchange ggml-ci --- examples/cli/cli.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/cli/cli.cpp b/examples/cli/cli.cpp index f202ebd5..fccfd13e 100644 --- a/examples/cli/cli.cpp +++ b/examples/cli/cli.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -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};