* Do something of which I have no idea what it is :P * @param proc The callback procedure that is called * @param arg The variable that will be used for the callback procedure */
| 2099 | * @param arg The variable that will be used for the callback procedure |
| 2100 | */ |
| 2101 | void SlAutolength(AutolengthProc *proc, int arg) |
| 2102 | { |
| 2103 | assert(_sl.action == SLA_SAVE); |
| 2104 | |
| 2105 | /* Tell it to calculate the length */ |
| 2106 | _sl.need_length = NL_CALCLENGTH; |
| 2107 | _sl.obj_len = 0; |
| 2108 | proc(arg); |
| 2109 | |
| 2110 | /* Setup length */ |
| 2111 | _sl.need_length = NL_WANTLENGTH; |
| 2112 | SlSetLength(_sl.obj_len); |
| 2113 | |
| 2114 | size_t start_pos = _sl.dumper->GetSize(); |
| 2115 | size_t expected_offs = start_pos + _sl.obj_len; |
| 2116 | |
| 2117 | /* And write the stuff */ |
| 2118 | proc(arg); |
| 2119 | |
| 2120 | if (expected_offs != _sl.dumper->GetSize()) { |
| 2121 | SlErrorCorruptFmt("Invalid chunk size when writing autolength block, expected {}, got {}", _sl.obj_len, _sl.dumper->GetSize() - start_pos); |
| 2122 | } |
| 2123 | } |
| 2124 | |
| 2125 | void ChunkHandler::LoadCheck(size_t len) const |
| 2126 | { |
no test coverage detected