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

Loading…
Cancel
Save