From bdfca5893f437ad464b44c918c76588c72be970b Mon Sep 17 00:00:00 2001 From: Deamon Date: Tue, 19 Mar 2024 03:08:47 +0200 Subject: [PATCH] fix importing for newer versions --- fileReaders/WDC3/DB2Ver3.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fileReaders/WDC3/DB2Ver3.cpp b/fileReaders/WDC3/DB2Ver3.cpp index 25fd180..5122668 100644 --- a/fileReaders/WDC3/DB2Ver3.cpp +++ b/fileReaders/WDC3/DB2Ver3.cpp @@ -79,7 +79,6 @@ void DB2Ver3::process(HFileContent db2File, const std::string &fileName) { } } } -// readValues(common_data, ); //Read section sections.resize(headerContent->section_count); @@ -292,7 +291,12 @@ std::shared_ptr DB2Ver3::getSparseRecord(int recordIn auto §ionContent = sections[sectionIndex]; auto §ionHeader = section_headers[sectionIndex]; - int recordId = sectionContent.offset_map_id_list[indexWithinSection]; + bool useOffsetMapId = (this->headerContent->flags.flag0x2 == 0) && sectionHeader.offset_map_id_count > 0; + + int recordId = useOffsetMapId ? + sectionContent.offset_map_id_list[indexWithinSection] : + sectionContent.id_list[indexWithinSection]; + unsigned char *recordPointer = sectionContent.variable_record_data + sectionContent.offset_map[indexWithinSection].offset @@ -380,7 +384,7 @@ DB2Ver3::WDC3Record::WDC3Record(std::shared_ptr db2Class, int rec recordPointer(recordPointer), sectionIndex(sectionIndex) { if (!db2Class->getWDCHeader()->flags.hasNonInlineId) { - auto result = getField(db2Class->getWDCHeader()->id_index, 0, 0); + auto result = getField(db2Class->getWDCHeader()->id_index, -1, -1); this->recordId = result[0].v32s; }