Browse Source

Use correct type for comparisons

`_write()` actually returns `int` type.

And fix wrong function parameters.

Closes #16938.
Closes #16944.
adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
59e37210f3
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 15
      src/app/main.cpp

15
src/app/main.cpp

@ -32,6 +32,7 @@
#include <csignal> #include <csignal>
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
#include <tuple>
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
#include <sys/resource.h> #include <sys/resource.h>
@ -318,17 +319,13 @@ int main(int argc, char *argv[])
void reportToUser(const char *str) void reportToUser(const char *str)
{ {
const size_t strLen = strlen(str); const size_t strLen = strlen(str);
#ifndef Q_OS_WIN #ifdef Q_OS_WIN
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen)) if (_write(_fileno(stderr), str, strLen) < static_cast<int>(strLen))
{ std::ignore = _write(_fileno(stdout), str, strLen);
const auto dummy = write(STDOUT_FILENO, str, strLen);
#else #else
if (_write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen)) if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen))
{ std::ignore = write(STDOUT_FILENO, str, strLen);
const auto dummy = _write(STDOUT_FILENO, str, strLen);
#endif #endif
Q_UNUSED(dummy);
}
} }
#endif #endif

Loading…
Cancel
Save