From 62b15b8646b62dec73a6f9f11f8350ce6aacccd4 Mon Sep 17 00:00:00 2001 From: Paul Nettle Date: Tue, 29 Aug 2017 08:20:02 -0500 Subject: Removed null-terminators from strings being built into Variants as byte arrays. --- src/Utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 655bd84..eaeb703 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -349,13 +349,13 @@ GVariant *Utils::gvariantFromByteArray(const char *pStr) return g_variant_new("ay", nullptr); } - return g_variant_new_bytestring(pStr); + return gvariantFromByteArray(reinterpret_cast(pStr), strlen(pStr)); } // Returns an array of bytes ("ay") with the contents of the input string GVariant *Utils::gvariantFromByteArray(const std::string &str) { - return gvariantFromByteArray(str.c_str()); + return gvariantFromByteArray(reinterpret_cast(str.c_str()), str.length()); } // Returns an array of bytes ("ay") with the contents of the input array of unsigned 8-bit values -- cgit v1.2.3