summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-01 17:19:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-01 17:19:56 +0000
commit48ce3d08faa51bf00edaa3ae0afda9bf86e14a39 (patch)
treeeae58a710e2c8ba883368ecacbeb31b00a4b6db2
parent842c26506fae8852299b498bdd00365e561ef7e2 (diff)
downloadpdfium-48ce3d08faa51bf00edaa3ae0afda9bf86e14a39.tar.xz
Use size_t and FX_ArraySize() for some arrays.
Change-Id: Ib8caef1f46478e9bf1c0e717997accb71000124a Reviewed-on: https://pdfium-review.googlesource.com/43192 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp5
-rw-r--r--xfa/fxfa/parser/xfa_basic_data.h6
-rw-r--r--xfa/fxfa/parser/xfa_basic_data_element_script.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_basic_data_enum.cpp3
4 files changed, 10 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 7d707d0baa..603473c61c 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -552,11 +552,12 @@ Optional<XFA_AttributeEnum> CXFA_Node::NameToAttributeEnum(
if (name.IsEmpty())
return {};
- auto* it = std::lower_bound(g_XFAEnumData, g_XFAEnumData + g_iXFAEnumCount,
+ static const auto* kXFAEnumDataEnd = g_XFAEnumData + g_szXFAEnumCount;
+ auto* it = std::lower_bound(g_XFAEnumData, kXFAEnumDataEnd,
FX_HashCode_GetW(name, false),
[](const XFA_AttributeEnumInfo& arg,
uint32_t hash) { return arg.uHash < hash; });
- if (it != g_XFAEnumData + g_iXFAEnumCount && name == it->pName)
+ if (it != kXFAEnumDataEnd && name == it->pName)
return {it->eName};
return {};
}
diff --git a/xfa/fxfa/parser/xfa_basic_data.h b/xfa/fxfa/parser/xfa_basic_data.h
index 0ce59ff119..1e69c0af29 100644
--- a/xfa/fxfa/parser/xfa_basic_data.h
+++ b/xfa/fxfa/parser/xfa_basic_data.h
@@ -10,12 +10,12 @@
#include "xfa/fxfa/fxfa_basic.h"
extern const XFA_AttributeEnumInfo g_XFAEnumData[];
-extern const int32_t g_iXFAEnumCount;
+extern const size_t g_szXFAEnumCount;
extern const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[];
-extern const int32_t g_iScriptIndexCount;
+extern const size_t g_szScriptIndexCount;
extern const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[];
-extern const int32_t g_iSomAttributeCount;
+extern const size_t g_szSomAttributeCount;
#endif // XFA_FXFA_PARSER_XFA_BASIC_DATA_H_
diff --git a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
index 3dd179e825..e15aedd70e 100644
--- a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
+++ b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
@@ -471,8 +471,8 @@ const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = {
{/* */ 1072, 0, 316},
{/* */ 1072, 2, 316},
{/* */ 1074, 2, 316}};
-const int32_t g_iScriptIndexCount =
- sizeof(g_XFAScriptIndex) / sizeof(XFA_SCRIPTHIERARCHY);
+const size_t g_szScriptIndexCount = FX_ArraySize(g_XFAScriptIndex);
+
const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = {
/* ps */
{0xbe52dfbf, L"desc",
@@ -3807,4 +3807,4 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = {
(XFA_ATTRIBUTE_CALLBACK)&CJX_Object::Script_Som_DefaultValue,
XFA_Attribute::Unknown, XFA_ScriptType::Basic},
};
-const int32_t g_iSomAttributeCount = FX_ArraySize(g_SomAttributeData);
+const size_t g_szSomAttributeCount = FX_ArraySize(g_SomAttributeData);
diff --git a/xfa/fxfa/parser/xfa_basic_data_enum.cpp b/xfa/fxfa/parser/xfa_basic_data_enum.cpp
index 33c5cf444e..e2c589c31d 100644
--- a/xfa/fxfa/parser/xfa_basic_data_enum.cpp
+++ b/xfa/fxfa/parser/xfa_basic_data_enum.cpp
@@ -277,5 +277,4 @@ const XFA_AttributeEnumInfo g_XFAEnumData[] = {
{0xfefc4885, L"urlencoded", XFA_AttributeEnum::Urlencoded},
{0xff795ad2, L"lowered", XFA_AttributeEnum::Lowered},
};
-const int32_t g_iXFAEnumCount =
- sizeof(g_XFAEnumData) / sizeof(XFA_AttributeEnumInfo);
+const size_t g_szXFAEnumCount = FX_ArraySize(g_XFAEnumData);