From 91abf6957855bb023bf1c527c3aff3e0037da0b1 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 11 Jun 2014 06:24:23 +0000 Subject: [PATCH] plugin/dbf: Version handling improved (thanks zsolt) git-svn-id: svn://ultimatepp.org/upp/trunk@7439 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/plugin/dbf/dbf.cpp | 11 ++++++++--- uppsrc/plugin/dbf/dbf.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/uppsrc/plugin/dbf/dbf.cpp b/uppsrc/plugin/dbf/dbf.cpp index f54c3c78c..49c541bf0 100644 --- a/uppsrc/plugin/dbf/dbf.cpp +++ b/uppsrc/plugin/dbf/dbf.cpp @@ -304,10 +304,12 @@ void DbfStream::Field::Serialize(Stream& stream) DbfStream::DbfStream() { + version = 0x03; } DbfStream::DbfStream(const char *_file, bool write, byte _charset, bool _delete_share) { + version = 0x03; Open(_file, write, _charset, _delete_share); } @@ -362,14 +364,17 @@ bool DbfStream::StreamHeader(bool full) data_offset = 32 + fields.GetCount() * 32 + 1; if(dbf.IsStoring()) { ASSERT(!IsReadOnly()); - dbf.Put(0x03); // #0: version number - 03 without a DBT file + dbf.Put(version); // #0: version number - 03 without a DBT file Date date = GetSysDate(); dbf.Put(date.year - 1900); // #1 - 3: date of last update dbf.Put(date.month); dbf.Put(date.day); } - else - dbf.Get32le(); + else { + version = dbf.Get8(); + dbf.Get8(); + dbf.Get16(); + } sStreamIL(dbf, rows); if(!full) return true; diff --git a/uppsrc/plugin/dbf/dbf.h b/uppsrc/plugin/dbf/dbf.h index 5a0e11b1a..3bd2a9e9e 100644 --- a/uppsrc/plugin/dbf/dbf.h +++ b/uppsrc/plugin/dbf/dbf.h @@ -144,6 +144,7 @@ protected: bool dirty; bool dirty_header; bool has_memo; + byte version; }; END_UPP_NAMESPACE