Lines Matching refs:error_msg

53 static int OpenAndReadMagic(const char* filename, uint32_t* magic, std::string* error_msg) {  in OpenAndReadMagic()  argument
57 *error_msg = StringPrintf("Unable to open '%s' : %s", filename, strerror(errno)); in OpenAndReadMagic()
62 *error_msg = StringPrintf("Failed to find magic in '%s'", filename); in OpenAndReadMagic()
66 *error_msg = StringPrintf("Failed to seek to beginning of file '%s' : %s", filename, in OpenAndReadMagic()
73 bool DexFile::GetChecksum(const char* filename, uint32_t* checksum, std::string* error_msg) { in GetChecksum() argument
89 ScopedFd fd(OpenAndReadMagic(file_part, &magic, error_msg)); in GetChecksum()
91 DCHECK(!error_msg->empty()); in GetChecksum()
95 …std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd.release(), filename, error_msg)); in GetChecksum()
97 *error_msg = StringPrintf("Failed to open zip archive '%s'", file_part); in GetChecksum()
100 std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find(zip_entry_name, error_msg)); in GetChecksum()
102 *error_msg = StringPrintf("Zip archive '%s' doesn't contain %s (error msg: %s)", file_part, in GetChecksum()
103 zip_entry_name, error_msg->c_str()); in GetChecksum()
110 …d::unique_ptr<const DexFile> dex_file(DexFile::OpenFile(fd.release(), filename, false, error_msg)); in GetChecksum()
117 *error_msg = StringPrintf("Expected valid zip or dex file: '%s'", filename); in GetChecksum()
121 bool DexFile::Open(const char* filename, const char* location, std::string* error_msg, in Open() argument
124 ScopedFd fd(OpenAndReadMagic(filename, &magic, error_msg)); in Open()
126 DCHECK(!error_msg->empty()); in Open()
130 return DexFile::OpenZip(fd.release(), location, error_msg, dex_files); in Open()
134 error_msg)); in Open()
142 *error_msg = StringPrintf("Expected valid zip or dex file: '%s'", filename); in Open()
177 std::string* error_msg) { in OpenFile() argument
185 *error_msg = StringPrintf("DexFile: fstat '%s' failed: %s", location, strerror(errno)); in OpenFile()
189 *error_msg = StringPrintf("Attempt to mmap directory '%s'", location); in OpenFile()
193 map.reset(MemMap::MapFile(length, PROT_READ, MAP_PRIVATE, fd, 0, location, error_msg)); in OpenFile()
195 DCHECK(!error_msg->empty()); in OpenFile()
201 *error_msg = StringPrintf( in OpenFile()
208 const DexFile* dex_file = OpenMemory(location, dex_header->checksum_, map.release(), error_msg); in OpenFile()
210 *error_msg = StringPrintf("Failed to open dex file '%s' from memory: %s", location, in OpenFile()
211 error_msg->c_str()); in OpenFile()
216 error_msg)) { in OpenFile()
225 bool DexFile::OpenZip(int fd, const std::string& location, std::string* error_msg, in OpenZip() argument
227 std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd, location.c_str(), error_msg)); in OpenZip()
229 DCHECK(!error_msg->empty()); in OpenZip()
232 return DexFile::OpenFromZip(*zip_archive, location, error_msg, dex_files); in OpenZip()
238 std::string* error_msg) { in OpenMemory() argument
245 error_msg); in OpenMemory()
249 const std::string& location, std::string* error_msg, in Open() argument
252 std::unique_ptr<ZipEntry> zip_entry(zip_archive.Find(entry_name, error_msg)); in Open()
257 std::unique_ptr<MemMap> map(zip_entry->ExtractToMemMap(location.c_str(), entry_name, error_msg)); in Open()
259 *error_msg = StringPrintf("Failed to extract '%s' from '%s': %s", entry_name, location.c_str(), in Open()
260 error_msg->c_str()); in Open()
265 error_msg)); in Open()
267 *error_msg = StringPrintf("Failed to open dex file '%s' from memory: %s", location.c_str(), in Open()
268 error_msg->c_str()); in Open()
273 *error_msg = StringPrintf("Failed to make dex file '%s' read only", location.c_str()); in Open()
279 location.c_str(), error_msg)) { in Open()
288 std::string* error_msg, std::vector<const DexFile*>* dex_files) { in OpenFromZip() argument
290 std::unique_ptr<const DexFile> dex_file(Open(zip_archive, kClassesDex, location, error_msg, in OpenFromZip()
308 error_msg, &error_code)); in OpenFromZip()
311 LOG(WARNING) << error_msg; in OpenFromZip()
332 std::string* error_msg) { in OpenMemory() argument
336 if (!dex_file->Init(error_msg)) { in OpenMemory()
377 bool DexFile::Init(std::string* error_msg) { in Init() argument
378 if (!CheckMagicAndVersion(error_msg)) { in Init()
384 bool DexFile::CheckMagicAndVersion(std::string* error_msg) const { in CheckMagicAndVersion()
392 *error_msg = oss.str(); in CheckMagicAndVersion()
402 *error_msg = oss.str(); in CheckMagicAndVersion()