From 57044ef3b1fa2d452354c4a096d055cf2b48ec29 Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Sat, 31 Jan 2015 09:35:22 -0800 Subject: [PATCH] Update table version to 4, read either 3 or 4 version tables --- src/cpp/TableFileReader.cpp | 2 +- src/cpp/TableFileWriter.cpp | 2 +- src/cpp/test/TableFileWriterTest.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/TableFileReader.cpp b/src/cpp/TableFileReader.cpp index 34c9af5..fc2abe5 100644 --- a/src/cpp/TableFileReader.cpp +++ b/src/cpp/TableFileReader.cpp @@ -19,7 +19,7 @@ void TableFileReader::read(PropertySymbolTable* table, istream& s) { //@TODO work rom tablefile int version = readUInt8(s); - if(version != 3) throw string("Can not read table file, it has an unsupported version"); + if(version < 3 || version > 4) throw string("Can not read table file, it has an unsupported version"); table->classname = readString(s); table->abstract = readUInt8(s); unsigned char tag; diff --git a/src/cpp/TableFileWriter.cpp b/src/cpp/TableFileWriter.cpp index 5910898..b2d8653 100644 --- a/src/cpp/TableFileWriter.cpp +++ b/src/cpp/TableFileWriter.cpp @@ -17,7 +17,7 @@ void TableFileWriter::write(ostream& out, PropertySymbolTable* table) { char* dataptr = (char*) malloc(1); - dataptr[0] = (char) 3; //version + dataptr[0] = (char) 4; //version out.write(dataptr, 1); dataptr[0] = (char) table->classname.size(); diff --git a/src/cpp/test/TableFileWriterTest.cpp b/src/cpp/test/TableFileWriterTest.cpp index f44edbe..bb4c60d 100644 --- a/src/cpp/test/TableFileWriterTest.cpp +++ b/src/cpp/test/TableFileWriterTest.cpp @@ -22,7 +22,7 @@ #define ASSERTCHAR(v) BOOST_CHECK_MESSAGE(dataptr[i++] == v, "Expected " #v " in stream at pos " + boost::lexical_cast(i) + " got " + string(1, (unsigned char) dataptr[i])); #define ASSERTLENGTH(l) char* dataptr = (char*) malloc(l); out.read(dataptr, l); BOOST_CHECK_MESSAGE(!out.eof(), "too short"); out.peek(); BOOST_CHECK_MESSAGE(out.eof(), "too long"); int i = 0; -#define TABLE_FILE_VERSION 3 +#define TABLE_FILE_VERSION 4 BOOST_AUTO_TEST_SUITE(TableFileWriterTest)