From b237414045d180dc68e817d9709b75c13150f548 Mon Sep 17 00:00:00 2001 From: Deamon Date: Wed, 24 Apr 2024 03:49:13 +0300 Subject: [PATCH] fix sign for 16-bit values --- fileReaders/WDC3/DB2Ver3.h | 2 ++ importers/CImporterClass.cpp | 1 + importers/WDC3/WDC3Importer.cpp | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/fileReaders/WDC3/DB2Ver3.h b/fileReaders/WDC3/DB2Ver3.h index 8882855..5e4ed09 100644 --- a/fileReaders/WDC3/DB2Ver3.h +++ b/fileReaders/WDC3/DB2Ver3.h @@ -235,6 +235,8 @@ namespace WDC3 { int64_t v64s; uint32_t v32; int32_t v32s; + uint16_t v16; + int16_t v16s; float v_f; }; protected: diff --git a/importers/CImporterClass.cpp b/importers/CImporterClass.cpp index 10b5893..1e3d3ec 100644 --- a/importers/CImporterClass.cpp +++ b/importers/CImporterClass.cpp @@ -30,6 +30,7 @@ void CImporterClass::addTable(std::string &tableName, fileSize = cache_file.tellg(); cache_file.seekg(0, std::ios::beg); +// std::cout << "DB2 File opened " << "lol" << std::endl; vec = std::make_shared(fileSize); cache_file.read((char *) &(*vec.get())[0], fileSize); diff --git a/importers/WDC3/WDC3Importer.cpp b/importers/WDC3/WDC3Importer.cpp index e4e7919..7468059 100644 --- a/importers/WDC3/WDC3Importer.cpp +++ b/importers/WDC3/WDC3Importer.cpp @@ -332,6 +332,12 @@ bool WDC3Importer::readWDC3Record(const int recordIndex, } else { fieldValues[db2FieldIndexToSQLIndex[i] + j] = std::to_string(valueVector[j].v64); } + } else if (dbdBuildColumnDef->bitSize == 16) { + if (dbdBuildColumnDef->isSigned) { + fieldValues[db2FieldIndexToSQLIndex[i] + j] = std::to_string(valueVector[j].v16s); + } else { + fieldValues[db2FieldIndexToSQLIndex[i] + j] = std::to_string(valueVector[j].v16); + } } else { if (dbdBuildColumnDef->isSigned) { fieldValues[db2FieldIndexToSQLIndex[i] + j] = std::to_string(valueVector[j].v32s);