From 2617056df6d6e1d0f17031f0c9db09f9192cb0fa Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 17 Apr 2018 17:01:52 +0000 Subject: Add constants for PDF 1.7 spec, table 3.4. Add constants/stream_dict_common.h. The header lists all the constants in the table in the same order. Constants that are not used at all are commented out. BUG=pdfium:1049 Change-Id: I6539090e0ad56319ea628883e388aeacef044e52 Reviewed-on: https://pdfium-review.googlesource.com/29090 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/cpdfsdk_helpers.cpp | 4 +++- fpdfsdk/fpdf_attachment.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp index 16e7efc873..9cf4c44147 100644 --- a/fpdfsdk/cpdfsdk_helpers.cpp +++ b/fpdfsdk/cpdfsdk_helpers.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/cpdfsdk_helpers.h" +#include "constants/stream_dict_common.h" #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" @@ -350,7 +351,8 @@ unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream, uint32_t decoded_len = 0; ByteString dummy_last_decoder; CPDF_Dictionary* dummy_last_param; - if (PDF_DataDecode(data, len, dict, dict->GetIntegerFor("DL"), false, + if (PDF_DataDecode(data, len, dict, + dict->GetIntegerFor(pdfium::stream::kDL), false, &decoded_data, &decoded_len, &dummy_last_decoder, &dummy_last_param)) { if (buffer && buflen >= decoded_len) diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp index 0bb9364834..25957174bc 100644 --- a/fpdfsdk/fpdf_attachment.cpp +++ b/fpdfsdk/fpdf_attachment.cpp @@ -7,6 +7,7 @@ #include #include +#include "constants/stream_dict_common.h" #include "core/fdrm/crypto/fx_crypt.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" @@ -90,7 +91,7 @@ FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) { CPDF_Dictionary* pFile = pDoc->NewIndirect(); pFile->SetNewFor("Type", "Filespec"); pFile->SetNewFor("UF", wsName); - pFile->SetNewFor("F", wsName); + pFile->SetNewFor(pdfium::stream::kF, wsName); // Add the new attachment name and filespec into the document's EmbeddedFiles. CPDF_NameTree nameTree(pDoc, "EmbeddedFiles"); @@ -230,7 +231,8 @@ FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment, pFileStreamDict->SetNewFor("Params"); // Set the size of the new file in the dictionary. - pFileStreamDict->SetNewFor("DL", static_cast(len)); + pFileStreamDict->SetNewFor(pdfium::stream::kDL, + static_cast(len)); pParamsDict->SetNewFor("Size", static_cast(len)); // Set the creation date of the new attachment in the dictionary. -- cgit v1.2.3