Fix nits in FPDFAnnot_SetAP
- Use pdfium::annotation::kType instead of "Type"
- Use pdfium::annotation::kSubtype instead of "Subtype"
Change-Id: I9d3835b005acc8cecdb6210defee3d6ac3f5645d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62190
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 16ae2cd..b1d2279 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -791,8 +791,8 @@
pNewIndirectStream->SetData(newAPStream.raw_span());
CPDF_Dictionary* pStreamDict = pNewIndirectStream->GetDict();
- pStreamDict->SetNewFor<CPDF_Name>("Type", "XObject");
- pStreamDict->SetNewFor<CPDF_Name>("Subtype", "Form");
+ pStreamDict->SetNewFor<CPDF_Name>(pdfium::annotation::kType, "XObject");
+ pStreamDict->SetNewFor<CPDF_Name>(pdfium::annotation::kSubtype, "Form");
pStreamDict->SetRectFor("BBox", rect);
// Storing reference to indirect object in annotation's AP
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index 44518d2..967f488 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -1712,7 +1712,7 @@
{
ScopedFPDFAnnotation annot(FPDFPage_CreateAnnot(page, FPDF_ANNOT_STAMP));
ASSERT_TRUE(annot);
- FS_RECTF bounding_rect{206.0f, 753.0f, 339.0f, 709.0f};
+ const FS_RECTF bounding_rect{206.0f, 753.0f, 339.0f, 709.0f};
EXPECT_TRUE(FPDFAnnot_SetRect(annot.get(), &bounding_rect));
EXPECT_EQ(2, FPDFPage_GetAnnotCount(page));
EXPECT_EQ(FPDF_ANNOT_STAMP, FPDFAnnot_GetSubtype(annot.get()));
diff --git a/fpdfsdk/fpdf_annot_unittest.cpp b/fpdfsdk/fpdf_annot_unittest.cpp
index c804562..8acae3d 100644
--- a/fpdfsdk/fpdf_annot_unittest.cpp
+++ b/fpdfsdk/fpdf_annot_unittest.cpp
@@ -44,7 +44,7 @@
EXPECT_FALSE(FPDFAnnot_SetAP(annot.get(), FPDF_ANNOT_APPEARANCEMODE_NORMAL,
ap_stream.get()));
- FS_RECTF bounding_rect{206.f, 753.f, 339.f, 709.f};
+ const FS_RECTF bounding_rect{206.0f, 753.0f, 339.0f, 709.0f};
EXPECT_TRUE(FPDFAnnot_SetRect(annot.get(), &bounding_rect));
EXPECT_TRUE(FPDFAnnot_SetAP(annot.get(), FPDF_ANNOT_APPEARANCEMODE_NORMAL,
@@ -59,9 +59,9 @@
ASSERT_TRUE(ap_dict);
CPDF_Dictionary* stream_dict = ap_dict->GetDictFor("N");
ASSERT_TRUE(stream_dict);
- ByteString type = stream_dict->GetStringFor("Type");
+ ByteString type = stream_dict->GetStringFor(pdfium::annotation::kType);
EXPECT_EQ("XObject", type);
- ByteString sub_type = stream_dict->GetStringFor("Subtype");
+ ByteString sub_type = stream_dict->GetStringFor(pdfium::annotation::kSubtype);
EXPECT_EQ("Form", sub_type);
// Check that the appearance stream is same as we just set.