[client,sdl] use WITH_WINPR_JSON instead of WINPR_JSON_FOUND

The WINPR_JSON_FOUND macro is never defined currently. Consequently,
the SDL prefs always use the fallback implementation. Let's use the
WITH_WINPR_JSON instead to really parse the sdl-freerdp.json file.
This commit is contained in:
Ondrej Holy 2024-05-15 15:23:08 +02:00 committed by akallabeth
parent e197d27c8d
commit 945c496812
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -35,7 +35,7 @@ namespace fs = std::experimental::filesystem;
#include <freerdp/version.h>
#include <winpr/json.h>
#if defined(WINPR_JSON_FOUND)
#if defined(WITH_WINPR_JSON)
using WINPR_JSONPtr = std::unique_ptr<WINPR_JSON, decltype(&WINPR_JSON_Delete)>;
static WINPR_JSONPtr get()
@ -70,7 +70,7 @@ static std::string item_to_str(WINPR_JSON* item, const std::string& fallback = "
std::string sdl_get_pref_string(const std::string& key, const std::string& fallback)
{
#if defined(WINPR_JSON_FOUND)
#if defined(WITH_WINPR_JSON)
auto item = get_item(key);
return item_to_str(item, fallback);
#else
@ -80,7 +80,7 @@ std::string sdl_get_pref_string(const std::string& key, const std::string& fallb
bool sdl_get_pref_bool(const std::string& key, bool fallback)
{
#if defined(WINPR_JSON_FOUND)
#if defined(WITH_WINPR_JSON)
auto item = get_item(key);
if (!item || !WINPR_JSON_IsBool(item))
return fallback;
@ -92,7 +92,7 @@ bool sdl_get_pref_bool(const std::string& key, bool fallback)
int64_t sdl_get_pref_int(const std::string& key, int64_t fallback)
{
#if defined(WINPR_JSON_FOUND)
#if defined(WITH_WINPR_JSON)
auto item = get_item(key);
if (!item || !WINPR_JSON_IsNumber(item))
return fallback;
@ -106,7 +106,7 @@ int64_t sdl_get_pref_int(const std::string& key, int64_t fallback)
std::vector<std::string> sdl_get_pref_array(const std::string& key,
const std::vector<std::string>& fallback)
{
#if defined(WINPR_JSON_FOUND)
#if defined(WITH_WINPR_JSON)
auto item = get_item(key);
if (!item || !WINPR_JSON_IsArray(item))
return fallback;