| 183 | } |
| 184 | |
| 185 | void CInifile::Load(IReader* F, LPCSTR path, BOOL allow_dup_sections, const CInifile* override, bool root_level, LPCSTR current_file) |
| 186 | { |
| 187 | R_ASSERT(F); |
| 188 | |
| 189 | string4096 str; |
| 190 | string4096 str2; |
| 191 | |
| 192 | auto AddOrOverride = [&]() { |
| 193 | auto I = DATA.find(Current->Name); |
| 194 | if (I != DATA.end()) |
| 195 | { |
| 196 | if (allow_dup_sections) |
| 197 | { |
| 198 | Sect* existing = (I->second); |
| 199 | for (auto& it : Current->Ordered_Data) |
| 200 | { |
| 201 | Item I = {it.first, it.second}; |
| 202 | insert_item(existing, I); |
| 203 | } |
| 204 | } |
| 205 | else |
| 206 | { |
| 207 | FATAL("Duplicate section '%s' found.", Current->Name.c_str()); |
| 208 | } |
| 209 | |
| 210 | xr_delete(Current); |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | if (override) |
| 215 | { |
| 216 | auto O = override->DATA.find(Current->Name); |
| 217 | if (O != override->DATA.end()) |
| 218 | { |
| 219 | Msg("~ Override section [%s]", Current->Name.c_str()); |
| 220 | |
| 221 | Sect* override = (O->second); |
| 222 | for (auto& it : override->Ordered_Data) |
| 223 | { |
| 224 | Item v = {it.first, it.second}; |
| 225 | insert_item(Current, v); |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | Current->Index = DATA.size(); |
| 231 | DATA.emplace(Current->Name, Current); |
| 232 | Ordered_DATA.emplace_back(Current->Name, Current); |
| 233 | } |
| 234 | }; |
| 235 | |
| 236 | while (!F->eof()) |
| 237 | { |
| 238 | F->r_string(str, sizeof(str)); |
| 239 | _Trim(str); |
| 240 | LPSTR semi = strchr(str, ';'); |
| 241 | LPSTR semi_1 = strchr(str, '/'); |
| 242 |
nothing calls this directly
no test coverage detected