summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_name.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_name.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_name.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index 5be64d39d5..74c83b9d28 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -49,3 +49,16 @@ const CPDF_Name* CPDF_Name::AsName() const {
CFX_WideString CPDF_Name::GetUnicodeText() const {
return PDF_DecodeText(m_Name);
}
+
+bool CPDF_Name::WriteTo(CFX_FileBufferArchive* archive,
+ FX_FILESIZE* offset) const {
+ if (archive->AppendString("/") < 0)
+ return false;
+
+ CFX_ByteString str = GetString();
+ int32_t len = archive->AppendString(PDF_NameEncode(str).AsStringC());
+ if (len < 0)
+ return false;
+ *offset += len + 1;
+ return true;
+}