From 01e4513b8eadb540ad7fd08ae169b2a4ff71a8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gallou?= Date: Wed, 8 Jan 2025 13:05:11 +0100 Subject: [PATCH] Try to fix build --- .../StreamDeck/linux/DeviceManagerHelper.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sources/plugins/StreamDeck/linux/DeviceManagerHelper.cpp b/sources/plugins/StreamDeck/linux/DeviceManagerHelper.cpp index d4cd69c37..77e6772a6 100644 --- a/sources/plugins/StreamDeck/linux/DeviceManagerHelper.cpp +++ b/sources/plugins/StreamDeck/linux/DeviceManagerHelper.cpp @@ -1,6 +1,7 @@ #include "DeviceManagerHelper.h" -#include -#include +#include +#include +#include #include const uint16_t CDeviceManagerHelper::StreamDeckVendorId = 0x0fd9; @@ -18,19 +19,15 @@ std::vector CDeviceManagerHelper::splitStringToVectorOfString(const return split(words, wordToSplit, boost::is_any_of(separator), boost::token_compress_on); } -uint16_t CDeviceManagerHelper::decimalToHex(const std::string& decimalValue) +uint16_t CDeviceManagerHelper::decimalToHex(std::string decimalValue) { uint16_t result; std::stringstream ss; - // Configure le stream pour lire un nombre décimal ss << std::dec << decimalValue; - // Convertir la chaîne en uint16_t if (!(ss >> result)) - { throw std::invalid_argument("Invalid decimal value: " + decimalValue); - } return result; } @@ -141,8 +138,14 @@ boost::shared_ptr CDeviceManagerHelper::getDeviceInformat unsigned char CDeviceManagerHelper::integerToHex(int& value) { - boost::cnv::cstream converter; - return boost::convert(std::to_string(value), converter(std::showbase)(std::uppercase)(std::dec), 0); + std::stringstream ss; + ss << std::uppercase << std::showbase << std::hex << value; + std::string hexStr = ss.str(); + + if (hexStr.size() > 1) + return static_cast(std::stoi(hexStr.substr(2), nullptr, 16)); // ignore "0x" + + return static_cast(value); } int CDeviceManagerHelper::getKeyIndex(std::string& key)