summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index d22711c6e4..f61036aef6 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -21,7 +21,7 @@ CFDF_Document* CFDF_Document::CreateNewDoc() {
pDoc->m_pRootDict = new CPDF_Dictionary;
pDoc->AddIndirectObject(pDoc->m_pRootDict);
CPDF_Dictionary* pFDFDict = new CPDF_Dictionary;
- pDoc->m_pRootDict->SetAt(FX_BSTRC("FDF"), pFDFDict);
+ pDoc->m_pRootDict->SetAt("FDF", pFDFDict);
return pDoc;
}
CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
@@ -55,7 +55,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
break;
}
word = parser.GetNextWord(bNumber);
- if (word != FX_BSTRC("obj")) {
+ if (word != "obj") {
break;
}
CPDF_Object* pObj = parser.GetObject(this, objnum, 0, 0);
@@ -64,16 +64,16 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
InsertIndirectObject(objnum, pObj);
word = parser.GetNextWord(bNumber);
- if (word != FX_BSTRC("endobj")) {
+ if (word != "endobj") {
break;
}
} else {
- if (word != FX_BSTRC("trailer")) {
+ if (word != "trailer") {
break;
}
if (CPDF_Dictionary* pMainDict =
ToDictionary(parser.GetObject(this, 0, 0, 0))) {
- m_pRootDict = pMainDict->GetDict(FX_BSTRC("Root"));
+ m_pRootDict = pMainDict->GetDict("Root");
pMainDict->Release();
}
break;
@@ -84,27 +84,25 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
if (m_pRootDict == NULL) {
return FALSE;
}
- buf << FX_BSTRC("%FDF-1.2\r\n");
+ buf << "%FDF-1.2\r\n";
FX_POSITION pos = m_IndirectObjs.GetStartPosition();
while (pos) {
size_t objnum;
CPDF_Object* pObj;
m_IndirectObjs.GetNextAssoc(pos, (void*&)objnum, (void*&)pObj);
- buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj
- << FX_BSTRC("\r\nendobj\r\n\r\n");
+ buf << (FX_DWORD)objnum << " 0 obj\r\n" << pObj << "\r\nendobj\r\n\r\n";
}
- buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum()
- << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n");
+ buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
+ << " 0 R>>\r\n%%EOF\r\n";
return TRUE;
}
CFX_WideString CFDF_Document::GetWin32Path() const {
- CPDF_Dictionary* pDict =
- m_pRootDict ? m_pRootDict->GetDict(FX_BSTRC("FDF")) : NULL;
- CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue(FX_BSTRC("F")) : NULL;
+ CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDict("FDF") : NULL;
+ CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue("F") : NULL;
if (!pFileSpec)
return CFX_WideString();
if (pFileSpec->IsString())
- return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict(FX_BSTRC("FDF")));
+ return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict("FDF"));
return FPDF_FileSpec_GetWin32Path(pFileSpec);
}
static CFX_WideString ChangeSlash(const FX_WCHAR* str) {
@@ -141,9 +139,9 @@ void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec,
if (pFileSpec->IsString()) {
pFileSpec->SetString(CFX_ByteString::FromUnicode(result));
} else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) {
- pFileDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(result));
- pFileDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(result));
- pFileDict->RemoveAt(FX_BSTRC("FS"));
+ pFileDict->SetAtString("F", CFX_ByteString::FromUnicode(result));
+ pFileDict->SetAtString("UF", PDF_EncodeText(result));
+ pFileDict->RemoveAt("FS");
}
}
CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
@@ -151,15 +149,15 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
if (!pFileSpec) {
wsFileName = CFX_WideString();
} else if (const CPDF_Dictionary* pDict = pFileSpec->AsDictionary()) {
- wsFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
+ wsFileName = pDict->GetUnicodeText("UF");
if (wsFileName.IsEmpty()) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
+ wsFileName = CFX_WideString::FromLocal(pDict->GetString("F"));
}
- if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
+ if (pDict->GetString("FS") == "URL") {
return wsFileName;
}
- if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS")));
+ if (wsFileName.IsEmpty() && pDict->KeyExist("DOS")) {
+ wsFileName = CFX_WideString::FromLocal(pDict->GetString("DOS"));
}
} else {
wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());