summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp15
-rw-r--r--fpdfsdk/src/fpdfview.cpp6
2 files changed, 7 insertions, 14 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index 41f5c8a1bb..e1ed3bcbfa 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -53,14 +53,12 @@ DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void*
return 0;
CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict);
CFX_WideString title = bookmark.GetTitle();
- CFX_ByteString encodedTitle = title.UTF16LE_Encode(FALSE);
+ CFX_ByteString encodedTitle = title.UTF16LE_Encode();
unsigned long len = encodedTitle.GetLength();
- if (buffer && buflen >= len + 2) {
+ if (buffer && buflen >= len) {
FXSYS_memcpy(buffer, encodedTitle.c_str(), len);
- ((FX_BYTE*)buffer)[len] = 0;
- ((FX_BYTE*)buffer)[len + 1] = 0;
}
- return len + 2;
+ return len;
}
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title)
@@ -292,11 +290,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR
// Use UTF-16LE encoding
CFX_ByteString encodedText = text.UTF16LE_Encode();
unsigned long len = encodedText.GetLength();
- if (buffer && buflen >= len + 2) {
+ if (buffer && buflen >= len) {
FXSYS_memcpy(buffer, encodedText.c_str(), len);
- // use double zero as trailer
- ((FX_BYTE*)buffer)[len] = 0;
- ((FX_BYTE*)buffer)[len + 1] = 0;
}
- return len+2;
+ return len;
}
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 43feaf4d5a..87ef3ee5b2 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -855,11 +855,9 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
unsigned int len = utf16Name.GetLength();
if (!buffer) {
- buflen = len + 2;
- } else if (buflen >= len + 2) {
+ buflen = len;
+ } else if (buflen >= len) {
memcpy(buffer, utf16Name.c_str(), len);
- ((FX_BYTE*)buffer)[len] = 0;
- ((FX_BYTE*)buffer)[len + 1] = 0;
} else {
len = -1;
}