| 1091 | } |
| 1092 | |
| 1093 | const char* ErrorCodeString(int32_t error_code) { |
| 1094 | // Make sure that the number of entries in kErrorMessages and ErrorCodes |
| 1095 | // match. |
| 1096 | static_assert((-kLastErrorCode + 1) == arraysize(kErrorMessages), |
| 1097 | "(-kLastErrorCode + 1) != arraysize(kErrorMessages)"); |
| 1098 | |
| 1099 | const uint32_t idx = -error_code; |
| 1100 | if (idx < arraysize(kErrorMessages)) { |
| 1101 | return kErrorMessages[idx]; |
| 1102 | } |
| 1103 | |
| 1104 | return "Unknown return code"; |
| 1105 | } |
| 1106 | |
| 1107 | int GetFileDescriptor(const ZipArchiveHandle handle) { |
| 1108 | return reinterpret_cast<ZipArchive*>(handle)->mapped_zip.GetFileDescriptor(); |