static TLineReader * OpenMapTextFile(const TCHAR *in_map_file, ConvertLineReader::charset cs) { assert(in_map_file != NULL); TCHAR path[MAX_PATH]; if (!Profile::GetPath(ProfileKeys::MapFile, path)) return NULL; _tcscat(path, _T("/")); _tcscat(path, in_map_file); ZipLineReader *reader = new ZipLineReader(path, cs); if (reader == NULL) return NULL; if (reader->error()) { delete reader; return NULL; } return reader; }
static TLineReader * OpenMapTextFile(const char *in_map_file, Charset cs) { assert(in_map_file != nullptr); auto dir = OpenMapFile(); if (dir == nullptr) return nullptr; Error error; ZipLineReader *reader = new ZipLineReader(dir, in_map_file, error, cs); zzip_dir_close(dir); if (reader == nullptr) { LogError(error); return nullptr; } if (reader->error()) { delete reader; return nullptr; } return reader; }