Use sf::err() for error logging

This commit is contained in:
Lukas Dürrenberger 2024-05-25 00:34:44 +02:00 committed by Chris Thrasher
parent 06946793b4
commit 658176879a
2 changed files with 8 additions and 6 deletions

View File

@ -26,6 +26,7 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/Unix/ThreadImpl.hpp> #include <SFML/System/Unix/ThreadImpl.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/Thread.hpp> #include <SFML/System/Thread.hpp>
#include <iostream> #include <iostream>
#include <cassert> #include <cassert>
@ -42,7 +43,7 @@ m_isActive(true)
m_isActive = pthread_create(&m_thread, NULL, &ThreadImpl::entryPoint, owner) == 0; m_isActive = pthread_create(&m_thread, NULL, &ThreadImpl::entryPoint, owner) == 0;
if (!m_isActive) if (!m_isActive)
std::cerr << "Failed to create thread" << std::endl; err() << "Failed to create thread" << std::endl;
} }

View File

@ -26,6 +26,7 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Win32/ClipboardImpl.hpp> #include <SFML/Window/Win32/ClipboardImpl.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp> #include <SFML/System/String.hpp>
#include <iostream> #include <iostream>
#include <windows.h> #include <windows.h>
@ -42,13 +43,13 @@ String ClipboardImpl::getString()
if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
{ {
std::cerr << "Failed to get the clipboard data in Unicode format." << std::endl; err() << "Failed to get the clipboard data in Unicode format." << std::endl;
return text; return text;
} }
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
{ {
std::cerr << "Failed to open the Win32 clipboard." << std::endl; err() << "Failed to open the Win32 clipboard." << std::endl;
return text; return text;
} }
@ -56,7 +57,7 @@ String ClipboardImpl::getString()
if (!clipboard_handle) if (!clipboard_handle)
{ {
std::cerr << "Failed to get Win32 handle for clipboard content." << std::endl; err() << "Failed to get Win32 handle for clipboard content." << std::endl;
CloseClipboard(); CloseClipboard();
return text; return text;
} }
@ -74,13 +75,13 @@ void ClipboardImpl::setString(const String& text)
{ {
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
{ {
std::cerr << "Failed to open the Win32 clipboard." << std::endl; err() << "Failed to open the Win32 clipboard." << std::endl;
return; return;
} }
if (!EmptyClipboard()) if (!EmptyClipboard())
{ {
std::cerr << "Failed to empty the Win32 clipboard." << std::endl; err() << "Failed to empty the Win32 clipboard." << std::endl;
CloseClipboard(); CloseClipboard();
return; return;
} }