[Libreoffice-commits] .: Branch 'feature/mork' - connectivity/source
David Ostrovsky
davido at kemper.freedesktop.org
Tue Jul 31 15:19:19 PDT 2012
connectivity/source/drivers/mork/MorkParser.cxx | 18 +++++++++++++++++-
connectivity/source/drivers/mork/MorkParser.hxx | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
New commits:
commit 312548329a90ed4bd903b1c87aa79d246f11ed04
Author: David Ostrovsky <david at ostrovsky.org>
Date: Tue Jul 31 23:41:36 2012 +0200
mork parser: fix table id straying rows
Straying rows (rows that defined outside the table) belong to the
default scope and to the table that was last seen. i. e. 1:^80
(at least i read the specification that way).
In current implementation straing rows were always put in
"dummy" table with id 0. By doing so the straying update rows
were missing (they were assigned to the dummy table) and
the data was wrong (outdated).
Change-Id: Iea8edb3bf77c9d873f085bd312d2098ed4c9f69b
diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx
index 7191149..b57fb94 100644
--- a/connectivity/source/drivers/mork/MorkParser.cxx
+++ b/connectivity/source/drivers/mork/MorkParser.cxx
@@ -58,6 +58,8 @@ MorkParser::MorkParser( int DefaultScope ) :
morkPos_(0),
nextAddValueId_(0x7fffffff),
defaultScope_(DefaultScope),
+ defaultListScope_(0x81),
+ defaultTableId_(1),
nowParsing_(NPValues)
{
}
@@ -465,6 +467,20 @@ inline void MorkParser::setCurrentRow( int TableScope, int TableId, int RowScope
TableScope = defaultScope_;
}
+ // 01.08.2012 davido
+ // TableId 0 is wrong here.
+ // Straying rows (rows that defined outside the table) belong to the default scope and table is the last was seen: 1:^80
+ // (at least i read so the specification)
+ if (TableId)
+ {
+ defaultTableId_ = TableId;
+ }
+
+ if (!TableId)
+ {
+ TableId = defaultTableId_;
+ }
+
currentCells_ = &( mork_[ abs( TableScope ) ][ abs( TableId ) ][ abs( RowScope ) ][ abs( RowId ) ] );
}
@@ -631,7 +647,7 @@ void MorkParser::dump()
{
std::cout << "\t Table:"
<< ( ( int ) TableIter->first < 0 ? "-" : " " )
- << std::hex << std::uppercase << "\r\n";
+ << std::hex << std::uppercase << TableIter->first << std::endl;
for (RowScopeMap::iterator RowScopeIter = TableIter->second.begin();
RowScopeIter != TableIter->second.end(); RowScopeIter++ )
diff --git a/connectivity/source/drivers/mork/MorkParser.hxx b/connectivity/source/drivers/mork/MorkParser.hxx
index e92ad39..7654441 100644
--- a/connectivity/source/drivers/mork/MorkParser.hxx
+++ b/connectivity/source/drivers/mork/MorkParser.hxx
@@ -152,6 +152,8 @@ protected: // Data
unsigned morkPos_;
int nextAddValueId_;
int defaultScope_;
+ int defaultListScope_;
+ int defaultTableId_;
// Indicates intity is being parsed
enum { NPColumns, NPValues, NPRows } nowParsing_;
More information about the Libreoffice-commits
mailing list