[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra=5D_plugins/vectorshape/libsvm=3A_Make_the_?=
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2011-05-01 12:22:38
Message-ID: 20110501122238.1819EA60A4 () git ! kde ! org
[Download RAW message or body]

Git commit 1a6607be1da356d5dc461ff44568c3d29f36d8e4 by Inge Wallin.
Committed on 01/05/2011 at 12:15.
Pushed by ingwa into branch 'master'.

Make the header support version 2.

Also rename META_SVG_SOMETHING_ACTION to META_RENDERGRAPHIC_ACTION
because I finally found out what its real name is.

M  +1    -1    plugins/vectorshape/libsvm/SvmEnums.h     
M  +5    -1    plugins/vectorshape/libsvm/SvmParser.cpp     
M  +12   -0    plugins/vectorshape/libsvm/SvmStructs.cpp     

http://commits.kde.org/calligra/1a6607be1da356d5dc461ff44568c3d29f36d8e4

diff --git a/plugins/vectorshape/libsvm/SvmEnums.h b/plugins/vectorshape/libsvm/SvmEnums.h
index ec8847c..fd65ab7 100644
--- a/plugins/vectorshape/libsvm/SvmEnums.h
+++ b/plugins/vectorshape/libsvm/SvmEnums.h
@@ -90,7 +90,7 @@ namespace Libsvm
         META_LAYOUTMODE_ACTION            = 149,
         META_TEXTLANGUAGE_ACTION          = 150,
         META_OVERLINECOLOR_ACTION         = 151,
-        META_SVG_SOMETHING_ACTION         = 152,
+        META_RENDERGRAPHIC_ACTION         = 152,
         META_COMMENT_ACTION               = 512
     };
 
diff --git a/plugins/vectorshape/libsvm/SvmParser.cpp b/plugins/vectorshape/libsvm/SvmParser.cpp
index cfdaf76..89771b9 100644
--- a/plugins/vectorshape/libsvm/SvmParser.cpp
+++ b/plugins/vectorshape/libsvm/SvmParser.cpp
@@ -117,7 +117,7 @@ static const struct ActionNames {
     { META_LAYOUTMODE_ACTION,            "META_LAYOUTMODE_ACTION" },
     { META_TEXTLANGUAGE_ACTION,          "META_TEXTLANGUAGE_ACTION" },
     { META_OVERLINECOLOR_ACTION,         "META_OVERLINECOLOR_ACTION" },
-    { META_SVG_SOMETHING_ACTION,         "META_SVG_SOMETHING_ACTION" },
+    { META_RENDERGRAPHIC_ACTION,         "META_RENDERGRAPHIC_ACTION" },
     { META_COMMENT_ACTION,               "META_COMMENT_ACTION" }
 };
 
@@ -408,6 +408,10 @@ bool SvmParser::parse(const QByteArray &data)
         case META_LAYOUTMODE_ACTION:
         case META_TEXTLANGUAGE_ACTION:
         case META_OVERLINECOLOR_ACTION:
+            break;
+        case META_RENDERGRAPHIC_ACTION:
+            //dumpAction(stream, version, totalSize);
+            break;
         case META_COMMENT_ACTION:
             break;
 
diff --git a/plugins/vectorshape/libsvm/SvmStructs.cpp b/plugins/vectorshape/libsvm/SvmStructs.cpp
index e64980a..ffdf1b4 100644
--- a/plugins/vectorshape/libsvm/SvmStructs.cpp
+++ b/plugins/vectorshape/libsvm/SvmStructs.cpp
@@ -21,6 +21,15 @@
 #include <QDataStream>
 
 
+static void soakBytes( QDataStream &stream, int numBytes )
+{
+    quint8 scratch;
+    for ( int i = 0; i < numBytes; ++i ) {
+        stream >> scratch;
+    }
+}
+
+
 namespace Libsvm
 {
 
@@ -117,6 +126,9 @@ QDataStream &operator>>(QDataStream &stream, SvmHeader &header)
     stream >> header.height;
     stream >> header.actionCount;
 
+    if (header.versionCompat.version > 1)
+        soakBytes(stream, 1);
+
     return stream;
 }
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic