* @brief Selects the checksum algorithm, caching the function and its output length so the * per-frame validation never repeats the by-name map lookup. */
| 205 | * per-frame validation never repeats the by-name map lookup. |
| 206 | */ |
| 207 | void IO::FrameReader::setChecksum(const QString& checksum) |
| 208 | { |
| 209 | m_checksum = checksum; |
| 210 | const auto& map = IO::checksumFunctionMap(); |
| 211 | const auto it = map.find(m_checksum); |
| 212 | if (it != map.end()) { |
| 213 | m_checksumFunc = it.value(); |
| 214 | m_checksumLength = m_checksumFunc("", 0).size(); |
| 215 | } else { |
| 216 | m_checksumFunc = ChecksumFunc(); |
| 217 | m_checksumLength = 0; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * @brief Configures the frame start delimiters and precomputes their KMP tables. |
no test coverage detected