From 337dbc392253af92b0577da062a5abc1d032b1ef Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 10 Jan 2023 14:30:37 +0100 Subject: Return std::string instead of dynamic allocations We mostly use classical C strings, but the memory management around them can get confusing and error prone. Let's use std::string for the cases where we need to return a newly allocated string. --- win/rfb_win32/RegConfig.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'win/rfb_win32/RegConfig.cxx') diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx index 73a9e699..38ca52f9 100644 --- a/win/rfb_win32/RegConfig.cxx +++ b/win/rfb_win32/RegConfig.cxx @@ -26,7 +26,6 @@ #include #include -#include //#include using namespace rfb; @@ -63,8 +62,8 @@ void RegConfig::loadRegistryConfig(RegKey& key) { while (1) { const char *name = key.getValueName(i++); if (!name) break; - CharArray value(key.getRepresentation(name)); - if (!value.buf || !Configuration::setParam(name, value.buf)) + std::string value = key.getRepresentation(name); + if (!Configuration::setParam(name, value.c_str())) vlog.info("unable to process %s", name); } } catch (rdr::SystemException& e) { -- cgit v1.2.3