aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Nettle <nettle.paul@gmail.com>2017-08-29 08:20:02 -0500
committerPaul Nettle <nettle.paul@gmail.com>2017-08-29 08:20:02 -0500
commit62b15b8646b62dec73a6f9f11f8350ce6aacccd4 (patch)
tree6de6c24e32cdab6d612d5b5a867d4276445e4417
parentThe intro paragraph is now a bit more consumable. (diff)
downloadgobbledegook-62b15b8646b62dec73a6f9f11f8350ce6aacccd4.tar.gz
gobbledegook-62b15b8646b62dec73a6f9f11f8350ce6aacccd4.tar.bz2
gobbledegook-62b15b8646b62dec73a6f9f11f8350ce6aacccd4.zip
Removed null-terminators from strings being built into Variants as byte arrays.
-rw-r--r--src/Utils.cpp4
1 files 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<const guint8 *>(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<const guint8 *>(str.c_str()), str.length());
}
// Returns an array of bytes ("ay") with the contents of the input array of unsigned 8-bit values