| 198 | } |
| 199 | |
| 200 | ZipInnerFileData* ZipReader::GetInnterFileData(const char *innerFile) |
| 201 | { |
| 202 | char *metafile = NULL; |
| 203 | char szFilePath[15]; |
| 204 | unz_file_info64 fileInfo; |
| 205 | |
| 206 | if (m_archive == NULL){ |
| 207 | return NULL; |
| 208 | } |
| 209 | |
| 210 | // inner file not exists |
| 211 | if (unzLocateFile(m_archive, innerFile, 0) != UNZ_OK){ |
| 212 | return NULL; |
| 213 | } |
| 214 | |
| 215 | if (unzGetCurrentFileInfo64(m_archive, &fileInfo, szFilePath, |
| 216 | sizeof(szFilePath), NULL, 0, NULL, 0) != UNZ_OK) |
| 217 | { |
| 218 | return NULL; |
| 219 | } |
| 220 | |
| 221 | if (unzOpenCurrentFile(m_archive) != UNZ_OK) |
| 222 | { |
| 223 | return NULL; |
| 224 | } |
| 225 | |
| 226 | if (fileInfo.uncompressed_size > 0 && (metafile = (char *)malloc(fileInfo.uncompressed_size))) |
| 227 | { |
| 228 | unzReadCurrentFile(m_archive, metafile, fileInfo.uncompressed_size); |
| 229 | unzCloseCurrentFile(m_archive); |
| 230 | |
| 231 | ZipInnerFileData *data = new ZipInnerFileData(metafile, fileInfo.uncompressed_size); |
| 232 | return data; |
| 233 | } |
| 234 | |
| 235 | return NULL; |
| 236 | } |
| 237 | |
| 238 | void ZipReader::ReleaseInnerFileData(ZipInnerFileData *data) |
| 239 | { |
no test coverage detected