Skip to content

Commit

Permalink
Update table version to 4, read either 3 or 4 version tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Fairhurst committed Jan 31, 2015
1 parent 4401093 commit 57044ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cpp/TableFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/TableFileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/test/TableFileWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define ASSERTCHAR(v) BOOST_CHECK_MESSAGE(dataptr[i++] == v, "Expected " #v " in stream at pos " + boost::lexical_cast<string>(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)

Expand Down

0 comments on commit 57044ef

Please sign in to comment.