summaryrefslogtreecommitdiff
path: root/gjs
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2022-02-12 13:14:22 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2022-03-03 22:21:15 -0800
commit5145abf522facafdc36f7b3f08526fa8ab272bf7 (patch)
treee07c8295a6d4c3d7c6efe5ea1f4639be5629b1c8 /gjs
parent4545bcae67bd4679b97196a86c7d616cc39e16cc (diff)
downloadgjs-5145abf522facafdc36f7b3f08526fa8ab272bf7.tar.gz
jsapi-util: Fix non-flat string message
Bizarrely, if we construct ostringstream with a string already in it, the default behaviour is to start overwriting characters at the start when later inserting more text into the stream. If we don't want that, we have to construct it with the 'advance to end' flag.
Diffstat (limited to 'gjs')
-rw-r--r--gjs/jsapi-util-string.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 2b880e6f..c78069a8 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -538,7 +538,8 @@ gjs_debug_string(JSString *str)
if (!str)
return "<null string>";
if (!JS_StringIsLinear(str)) {
- std::ostringstream out("<non-flat string of length ");
+ std::ostringstream out("<non-flat string of length ",
+ std::ios_base::ate);
out << JS_GetStringLength(str) << '>';
return out.str();
}