summaryrefslogtreecommitdiff
path: root/runtime/oat.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/oat.cc')
-rw-r--r--runtime/oat.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/runtime/oat.cc b/runtime/oat.cc
index d14b399a9a..21e20e9b74 100644
--- a/runtime/oat.cc
+++ b/runtime/oat.cc
@@ -23,6 +23,7 @@
#include "arch/instruction_set_features.h"
#include "base/bit_utils.h"
+#include "base/strlcpy.h"
namespace art {
@@ -71,6 +72,7 @@ OatHeader::OatHeader(InstructionSet instruction_set,
instruction_set_(instruction_set),
instruction_set_features_bitmap_(instruction_set_features->AsBitmap()),
dex_file_count_(dex_file_count),
+ oat_dex_files_offset_(0),
executable_offset_(0),
interpreter_to_interpreter_bridge_offset_(0),
interpreter_to_compiled_code_bridge_offset_(0),
@@ -203,6 +205,20 @@ uint32_t OatHeader::GetInstructionSetFeaturesBitmap() const {
return instruction_set_features_bitmap_;
}
+uint32_t OatHeader::GetOatDexFilesOffset() const {
+ DCHECK(IsValid());
+ DCHECK_GT(oat_dex_files_offset_, sizeof(OatHeader));
+ return oat_dex_files_offset_;
+}
+
+void OatHeader::SetOatDexFilesOffset(uint32_t oat_dex_files_offset) {
+ DCHECK_GT(oat_dex_files_offset, sizeof(OatHeader));
+ DCHECK(IsValid());
+ DCHECK_EQ(oat_dex_files_offset_, 0u);
+
+ oat_dex_files_offset_ = oat_dex_files_offset;
+}
+
uint32_t OatHeader::GetExecutableOffset() const {
DCHECK(IsValid());
DCHECK_ALIGNED(executable_offset_, kPageSize);
@@ -505,9 +521,9 @@ void OatHeader::Flatten(const SafeMap<std::string, std::string>* key_value_store
SafeMap<std::string, std::string>::const_iterator it = key_value_store->begin();
SafeMap<std::string, std::string>::const_iterator end = key_value_store->end();
for ( ; it != end; ++it) {
- strcpy(data_ptr, it->first.c_str());
+ strlcpy(data_ptr, it->first.c_str(), it->first.length() + 1);
data_ptr += it->first.length() + 1;
- strcpy(data_ptr, it->second.c_str());
+ strlcpy(data_ptr, it->second.c_str(), it->second.length() + 1);
data_ptr += it->second.length() + 1;
}
}