Skip to content

Commit

Permalink
fix sign for 16-bit values
Browse files Browse the repository at this point in the history
  • Loading branch information
Deamon87 committed Apr 24, 2024
1 parent bdfca58 commit b237414
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fileReaders/WDC3/DB2Ver3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions importers/CImporterClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileContent>(fileSize);
cache_file.read((char *) &(*vec.get())[0], fileSize);
Expand Down
6 changes: 6 additions & 0 deletions importers/WDC3/WDC3Importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b237414

Please sign in to comment.