mirror of
https://github.com/hyprwm/aquamarine.git
synced 2025-12-20 02:30:02 +01:00
atomic: fix compiler warning with string (#164)
the compiler tries to optimize this and inlines the +=, which might involve raw memcpy operations, and in doing so, it thinks there is a chance that the internal buffer doesnt have enough space. use ostringstream instead, and return the string from that.
This commit is contained in:
parent
1d2dbd72c2
commit
c8282f4982
1 changed files with 9 additions and 8 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <xf86drm.h>
|
||||
#include <xf86drmMode.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sstream>
|
||||
#include "Shared.hpp"
|
||||
#include "aquamarine/output/Output.hpp"
|
||||
|
||||
|
|
@ -223,20 +224,20 @@ void Aquamarine::CDRMAtomicRequest::addConnectorCursor(Hyprutils::Memory::CShare
|
|||
|
||||
bool Aquamarine::CDRMAtomicRequest::commit(uint32_t flagssss) {
|
||||
static auto flagsToStr = [](uint32_t flags) {
|
||||
std::string result;
|
||||
std::ostringstream result;
|
||||
if (flags & DRM_MODE_ATOMIC_ALLOW_MODESET)
|
||||
result += "ATOMIC_ALLOW_MODESET ";
|
||||
result << "ATOMIC_ALLOW_MODESET ";
|
||||
if (flags & DRM_MODE_ATOMIC_NONBLOCK)
|
||||
result += "ATOMIC_NONBLOCK ";
|
||||
result << "ATOMIC_NONBLOCK ";
|
||||
if (flags & DRM_MODE_ATOMIC_TEST_ONLY)
|
||||
result += "ATOMIC_TEST_ONLY ";
|
||||
result << "ATOMIC_TEST_ONLY ";
|
||||
if (flags & DRM_MODE_PAGE_FLIP_EVENT)
|
||||
result += "PAGE_FLIP_EVENT ";
|
||||
result << "PAGE_FLIP_EVENT ";
|
||||
if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
|
||||
result += "PAGE_FLIP_ASYNC ";
|
||||
result << "PAGE_FLIP_ASYNC ";
|
||||
if (flags & (~DRM_MODE_ATOMIC_FLAGS))
|
||||
result += " + invalid...";
|
||||
return result;
|
||||
result << " + invalid...";
|
||||
return result.str();
|
||||
};
|
||||
|
||||
if (failed) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue