diff options
-rw-r--r-- | core/fpdfdoc/cpdf_aaction.cpp | 56 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_action.cpp | 31 |
2 files changed, 46 insertions, 41 deletions
diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp index c50171e21..fa8681410 100644 --- a/core/fpdfdoc/cpdf_aaction.cpp +++ b/core/fpdfdoc/cpdf_aaction.cpp @@ -4,13 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#if defined(UNSAFE_BUFFERS_BUILD) -// TODO(crbug.com/pdfium/2153): resolve buffer safety issues. -#pragma allow_unsafe_buffers -#endif - #include "core/fpdfdoc/cpdf_aaction.h" +#include <array> #include <iterator> #include <utility> @@ -18,34 +14,32 @@ namespace { -constexpr const char* kAATypes[] = { - "E", // kCursorEnter - "X", // kCursorExit - "D", // kButtonDown - "U", // kButtonUp - "Fo", // kGetFocus - "Bl", // kLoseFocus - "PO", // kPageOpen - "PC", // kPageClose - "PV", // kPageVisible - "PI", // kPageInvisible - "O", // kOpenPage - "C", // kClosePage - "K", // kKeyStroke - "F", // kFormat - "V", // kValidate - "C", // kCalculate - "WC", // kCloseDocument - "WS", // kSaveDocument - "DS", // kDocumentSaved - "WP", // kPrintDocument - "DP", // kDocumentPrinted -}; - // |kAATypes| should have one less element than enum AActionType due to // |kDocumentOpen|, which is an artificial type. -static_assert(std::size(kAATypes) == CPDF_AAction::kNumberOfActions - 1, - "kAATypes count mismatch"); +constexpr const std::array<const char*, CPDF_AAction::kNumberOfActions - 1> + kAATypes = {{ + "E", // kCursorEnter + "X", // kCursorExit + "D", // kButtonDown + "U", // kButtonUp + "Fo", // kGetFocus + "Bl", // kLoseFocus + "PO", // kPageOpen + "PC", // kPageClose + "PV", // kPageVisible + "PI", // kPageInvisible + "O", // kOpenPage + "C", // kClosePage + "K", // kKeyStroke + "F", // kFormat + "V", // kValidate + "C", // kCalculate + "WC", // kCloseDocument + "WS", // kSaveDocument + "DS", // kDocumentSaved + "WP", // kPrintDocument + "DP", // kDocumentPrinted + }}; } // namespace diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp index 66b735ecb..1f5f0d313 100644 --- a/core/fpdfdoc/cpdf_action.cpp +++ b/core/fpdfdoc/cpdf_action.cpp @@ -4,13 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#if defined(UNSAFE_BUFFERS_BUILD) -// TODO(crbug.com/pdfium/2153): resolve buffer safety issues. -#pragma allow_unsafe_buffers -#endif - #include "core/fpdfdoc/cpdf_action.h" +#include <array> #include <iterator> #include <utility> @@ -24,11 +20,26 @@ namespace { -const char* const kActionTypeStrings[] = { - "GoTo", "GoToR", "GoToE", "Launch", "Thread", - "URI", "Sound", "Movie", "Hide", "Named", - "SubmitForm", "ResetForm", "ImportData", "JavaScript", "SetOCGState", - "Rendition", "Trans", "GoTo3DView"}; +const std::array<const char*, 18> kActionTypeStrings = {{ + "GoTo", + "GoToR", + "GoToE", + "Launch", + "Thread", + "URI", + "Sound", + "Movie", + "Hide", + "Named", + "SubmitForm", + "ResetForm", + "ImportData", + "JavaScript", + "SetOCGState", + "Rendition", + "Trans", + "GoTo3DView", +}}; } // namespace |