summaryrefslogtreecommitdiff
path: root/src/class_linker.cc
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-04-13 15:59:59 -0700
committer Elliott Hughes <enh@google.com> 2012-04-14 11:44:21 -0700
commita0e180632411f7fe0edf454e571c42209ee7b540 (patch)
tree97dc85e76c5449ec1a901226c44e0f68fec89870 /src/class_linker.cc
parente5eb1914de86129d78e965fb9f2e1bfb2aa68640 (diff)
Add a SafeMap equivalent to std::map but without the error-prone operator[].
Change-Id: Iae5ba2091c55a34dbd1005cf3d25fce2a8d5c1f9
Diffstat (limited to 'src/class_linker.cc')
-rw-r--r--src/class_linker.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 567415c431..423bd72a5e 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -2674,12 +2674,12 @@ bool ClassLinker::EnsureInitialized(Class* c, bool can_run_clinit, bool can_init
}
void ClassLinker::ConstructFieldMap(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def,
- Class* c, std::map<uint32_t, Field*>& field_map) {
+ Class* c, SafeMap<uint32_t, Field*>& field_map) {
const ClassLoader* cl = c->GetClassLoader();
const byte* class_data = dex_file.GetClassData(dex_class_def);
ClassDataItemIterator it(dex_file, class_data);
for (size_t i = 0; it.HasNextStaticField(); i++, it.Next()) {
- field_map[i] = ResolveField(dex_file, it.GetMemberIndex(), c->GetDexCache(), cl, true);
+ field_map.Put(i, ResolveField(dex_file, it.GetMemberIndex(), c->GetDexCache(), cl, true));
}
}
@@ -2701,10 +2701,10 @@ bool ClassLinker::InitializeStaticFields(Class* klass) {
if (it.HasNext()) {
// We reordered the fields, so we need to be able to map the field indexes to the right fields.
- std::map<uint32_t, Field*> field_map;
+ SafeMap<uint32_t, Field*> field_map;
ConstructFieldMap(dex_file, *dex_class_def, klass, field_map);
for (size_t i = 0; it.HasNext(); i++, it.Next()) {
- it.ReadValueToField(field_map[i]);
+ it.ReadValueToField(field_map.Get(i));
}
return true;
}