Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-01-21 22:30:35 +0300
committerShelley Vohr <shelley.vohr@gmail.com>2020-02-17 22:17:05 +0300
commit76aad0e5e1ada72ca39e1f73c31d7e81bc6e2dc0 (patch)
treeec06bb073dfeb3ce153bdc676880ba1342cd6707 /src/util.h
parenta685827a55a74427562fbe7255e78e5b9fba0d68 (diff)
src: use custom fprintf alike to write errors to stderr
This allows printing errors that contain nul characters, for example. Fixes: https://github.com/nodejs/node/issues/28761 Fixes: https://github.com/nodejs/node/issues/31218 PR-URL: https://github.com/nodejs/node/pull/31446 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 8e90a5ee74a..5eaa20b7601 100644
--- a/src/util.h
+++ b/src/util.h
@@ -480,6 +480,8 @@ class ArrayBufferViewContents {
class Utf8Value : public MaybeStackBuffer<char> {
public:
explicit Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> value);
+
+ inline std::string ToString() const { return std::string(out(), length()); }
};
class TwoByteValue : public MaybeStackBuffer<uint16_t> {
@@ -490,6 +492,8 @@ class TwoByteValue : public MaybeStackBuffer<uint16_t> {
class BufferValue : public MaybeStackBuffer<char> {
public:
explicit BufferValue(v8::Isolate* isolate, v8::Local<v8::Value> value);
+
+ inline std::string ToString() const { return std::string(out(), length()); }
};
#define SPREAD_BUFFER_ARG(val, name) \