summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp7
2 files changed, 7 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index a13fb5021d..da1355724f 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -271,18 +271,18 @@ int CPDF_StreamContentParser::GetNextParamPos() {
}
void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) {
+ CFX_ByteStringC bsName(name, len);
int index = GetNextParamPos();
if (len > 32) {
m_ParamBuf[index].m_Type = ContentParam::OBJECT;
- m_ParamBuf[index].m_pObject =
- new CPDF_Name(PDF_NameDecode(CFX_ByteStringC(name, len)));
+ m_ParamBuf[index].m_pObject = new CPDF_Name(PDF_NameDecode(bsName));
} else {
m_ParamBuf[index].m_Type = ContentParam::NAME;
- if (!FXSYS_memchr(name, '#', len)) {
+ if (bsName.Find('#') == -1) {
FXSYS_memcpy(m_ParamBuf[index].m_Name.m_Buffer, name, len);
m_ParamBuf[index].m_Name.m_Len = len;
} else {
- CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len));
+ CFX_ByteString str = PDF_NameDecode(bsName);
FXSYS_memcpy(m_ParamBuf[index].m_Name.m_Buffer, str.c_str(),
str.GetLength());
m_ParamBuf[index].m_Name.m_Len = str.GetLength();
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 466ccaffa5..03975149b0 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -89,9 +89,9 @@ int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) {
CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
int size = bstr.GetLength();
const FX_CHAR* pSrc = bstr.c_str();
- if (!FXSYS_memchr(pSrc, '#', size)) {
+ if (bstr.Find('#') == -1)
return bstr;
- }
+
CFX_ByteString result;
FX_CHAR* pDestStart = result.GetBuffer(size);
FX_CHAR* pDest = pDestStart;
@@ -109,9 +109,8 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
}
CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) {
- if (!FXSYS_memchr(orig.c_str(), '#', orig.GetLength())) {
+ if (orig.Find('#') == -1)
return orig;
- }
return PDF_NameDecode(orig.AsStringC());
}