* Opens a compressed log with contents created by Encoder. * * \param filename * Compressed log file to open * \return * True if success, false if the log file is not valid or cannot be opened */
| 1072 | * True if success, false if the log file is not valid or cannot be opened |
| 1073 | */ |
| 1074 | bool |
| 1075 | Log::Decoder::open(const char *filename) { |
| 1076 | inputFd = fopen(filename, "rb"); |
| 1077 | good = false; |
| 1078 | |
| 1079 | if (!inputFd) |
| 1080 | return false; |
| 1081 | |
| 1082 | if(!readDictionary(inputFd, true)) { |
| 1083 | fclose(inputFd); |
| 1084 | inputFd = nullptr; |
| 1085 | return false; |
| 1086 | } |
| 1087 | |
| 1088 | this->filename = std::string(filename); |
| 1089 | numBufferFragmentsRead = 0; |
| 1090 | numCheckpointsRead = 1; |
| 1091 | logMsgsPrinted = 0; |
| 1092 | good = true; |
| 1093 | return true; |
| 1094 | } |
| 1095 | /** |
| 1096 | * Decoder destructor |
| 1097 | */ |
no outgoing calls