summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_ext.cpp
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-31 06:49:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-31 06:49:27 -0700
commit956553e715787cfc4dd8423d5e9a04a0131878c3 (patch)
tree08622d504322d5dae37b5bb5025a90c81ebdee6b /fpdfsdk/fpdf_ext.cpp
parent87dffc0315477150c9c1964913b65bc97bdf654f (diff)
downloadpdfium-956553e715787cfc4dd8423d5e9a04a0131878c3.tar.xz
Use enum class for subtypes of CPDF_Annot.
Comparing CFX_ByteString for annotation subtypes is inefficient and error-prone. This CL uses enum class to compare annotation subtypes. Also, remove unused IPDFSDK_AnnotHandler::GetType() and FSDK_XFAWIDGET_TYPENAME. Review-Url: https://codereview.chromium.org/2295953002
Diffstat (limited to 'fpdfsdk/fpdf_ext.cpp')
-rw-r--r--fpdfsdk/fpdf_ext.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index d03b4383ca..46bc7e57a4 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -46,33 +46,31 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
}
void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
- CFX_ByteString cbSubType = pPDFAnnot->GetSubtype();
- if (cbSubType.Compare("3D") == 0) {
+ CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype();
+ if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
- } else if (cbSubType.Compare("Screen") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
if (pAnnotDict->KeyExist("IT"))
cbString = pAnnotDict->GetStringBy("IT");
if (cbString.Compare("Img") != 0)
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA);
- } else if (cbSubType.Compare("Movie") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::MOVIE) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE);
- } else if (cbSubType.Compare("Sound") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::SOUND) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND);
- } else if (cbSubType.Compare("RichMedia") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::RICHMEDIA) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA);
- } else if (cbSubType.Compare("FileAttachment") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::FILEATTACHMENT) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
- } else if (cbSubType.Compare("Widget") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
- if (pAnnotDict->KeyExist("FT")) {
+ if (pAnnotDict->KeyExist("FT"))
cbString = pAnnotDict->GetStringBy("FT");
- }
- if (cbString.Compare("Sig") == 0) {
+ if (cbString.Compare("Sig") == 0)
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
- }
}
}