| 148 | } |
| 149 | |
| 150 | bool DexFile::CheckMagicAndVersion(std::string* error_msg) const { |
| 151 | if (!IsMagicValid()) { |
| 152 | std::ostringstream oss; |
| 153 | oss << "Unrecognized magic number in " << GetLocation() << ":" |
| 154 | << " " << header_->magic_[0] |
| 155 | << " " << header_->magic_[1] |
| 156 | << " " << header_->magic_[2] |
| 157 | << " " << header_->magic_[3]; |
| 158 | *error_msg = oss.str(); |
| 159 | return false; |
| 160 | } |
| 161 | if (!IsVersionValid()) { |
| 162 | std::ostringstream oss; |
| 163 | oss << "Unrecognized version number in " << GetLocation() << ":" |
| 164 | << " " << header_->magic_[4] |
| 165 | << " " << header_->magic_[5] |
| 166 | << " " << header_->magic_[6] |
| 167 | << " " << header_->magic_[7]; |
| 168 | *error_msg = oss.str(); |
| 169 | return false; |
| 170 | } |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | void DexFile::InitializeSectionsFromMapList() { |
| 175 | const MapList* map_list = reinterpret_cast<const MapList*>(DataBegin() + header_->map_off_); |