summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-29 18:03:40 -0800
committerLei Zhang <thestig@chromium.org>2016-01-29 18:03:40 -0800
commitaa23e7043863904ace627ce6fa470b79ebd1dbc7 (patch)
treeef8e9cd2daf9eabb94d7ef9091ec4be1843dffb9 /core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
parente5fbd7a170257b455f6ea8c94f71e827e6c3bb8d (diff)
downloadpdfium-aa23e7043863904ace627ce6fa470b79ebd1dbc7.tar.xz
Another round of cleanup in CPDF_Parser and friends.
- Remove dead code. - Add more public methods and remove friends. TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1566133002 . (cherry picked from commit 9e8185948f7631515951770ca8778f42cc9fd2fc) Review URL: https://codereview.chromium.org/1649233002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index f5701fefff..b80568b63c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -94,84 +94,3 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
<< " 0 R>>\r\n%%EOF\r\n";
return TRUE;
}
-CFX_WideString CFDF_Document::GetWin32Path() const {
- CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDictBy("FDF") : NULL;
- CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue("F") : NULL;
- if (!pFileSpec)
- return CFX_WideString();
- if (pFileSpec->IsString())
- return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDictBy("FDF"));
- return FPDF_FileSpec_GetWin32Path(pFileSpec);
-}
-static CFX_WideString ChangeSlash(const FX_WCHAR* str) {
- CFX_WideString result;
- while (*str) {
- if (*str == '\\') {
- result += '/';
- } else if (*str == '/') {
- result += '\\';
- } else {
- result += *str;
- }
- str++;
- }
- return result;
-}
-void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec,
- const CFX_WideString& filepath) {
- CFX_WideString result;
- if (filepath.GetLength() > 1 && filepath[1] == ':') {
- result = L"/";
- result += filepath[0];
- if (filepath[2] != '\\') {
- result += '/';
- }
- result += ChangeSlash(filepath.c_str() + 2);
- } else if (filepath.GetLength() > 1 && filepath[0] == '\\' &&
- filepath[1] == '\\') {
- result = ChangeSlash(filepath.c_str() + 1);
- } else {
- result = ChangeSlash(filepath.c_str());
- }
-
- if (pFileSpec->IsString()) {
- pFileSpec->SetString(CFX_ByteString::FromUnicode(result));
- } else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) {
- 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) {
- CFX_WideString wsFileName;
- if (!pFileSpec) {
- wsFileName = CFX_WideString();
- } else if (const CPDF_Dictionary* pDict = pFileSpec->AsDictionary()) {
- wsFileName = pDict->GetUnicodeTextBy("UF");
- if (wsFileName.IsEmpty()) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F"));
- }
- if (pDict->GetStringBy("FS") == "URL") {
- return wsFileName;
- }
- if (wsFileName.IsEmpty() && pDict->KeyExist("DOS")) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS"));
- }
- } else {
- wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());
- }
- if (wsFileName[0] != '/') {
- return ChangeSlash(wsFileName.c_str());
- }
- if (wsFileName[2] == '/') {
- CFX_WideString result;
- result += wsFileName[1];
- result += ':';
- result += ChangeSlash(wsFileName.c_str() + 2);
- return result;
- }
- CFX_WideString result;
- result += '\\';
- result += ChangeSlash(wsFileName.c_str());
- return result;
-}