| 296 | } |
| 297 | |
| 298 | Result<void> BuildBlockViewTree(BlockViewTree& node, BufferView blockBuffer, std::optional<uint32_t> maxDepth = {}) |
| 299 | { |
| 300 | if (maxDepth.has_value()) |
| 301 | { |
| 302 | if (*maxDepth == 0) |
| 303 | { |
| 304 | Log::Critical("PeVersionInfo: BuildBlockViewTree: maximum recursion depth reached"); |
| 305 | return std::errc::bad_message; |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | maxDepth.value()--; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | auto block = Parse(blockBuffer); |
| 314 | if (!block) |
| 315 | { |
| 316 | return block.error(); |
| 317 | } |
| 318 | |
| 319 | node.block = std::move(*block); |
| 320 | for (auto& childBuffer : node.block.rawChilds) |
| 321 | { |
| 322 | BlockViewTree childNode; |
| 323 | auto rv = BuildBlockViewTree(childNode, childBuffer, maxDepth); |
| 324 | if (rv.has_error()) |
| 325 | { |
| 326 | continue; |
| 327 | } |
| 328 | |
| 329 | node.childNodes.emplace_back(std::move(childNode)); |
| 330 | } |
| 331 | |
| 332 | return Orc::Success<void>(); |
| 333 | } |
| 334 | |
| 335 | bool IsPreferredLanguage(uint16_t lang, uint16_t codepage) |
| 336 | { |
no test coverage detected