summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-11-01 19:25:02 +0100
committerDavid Tardon <dtardon@redhat.com>2013-11-01 19:25:24 +0100
commit2a677e831528c6e9ddd5f926217faa4737ef86a3 (patch)
treeb38781a843997ad3d76b65108da1172d8e5f4009
parent57a0008380254104656d31924243c92cec9cb79d (diff)
fix keynote format detection
Change-Id: Iadc1fe4efe891ef33f85086cfe0b811ebeb6e767
-rw-r--r--external/libetonyek/0001-impl.-XML-format-detection.patch65
-rw-r--r--external/libetonyek/UnpackedTarball_libetonyek.mk1
2 files changed, 66 insertions, 0 deletions
diff --git a/external/libetonyek/0001-impl.-XML-format-detection.patch b/external/libetonyek/0001-impl.-XML-format-detection.patch
new file mode 100644
index 000000000000..c4e1904b89d8
--- /dev/null
+++ b/external/libetonyek/0001-impl.-XML-format-detection.patch
@@ -0,0 +1,65 @@
+From 28a3b93cc8b0050582c54722df5ac372530ff0a4 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon@redhat.com>
+Date: Fri, 1 Nov 2013 18:29:40 +0100
+Subject: [PATCH] impl. XML format detection
+
+---
+ src/lib/KEYDocument.cpp | 31 ++++++++++++++++++++++++++++---
+ 1 file changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib/KEYDocument.cpp b/src/lib/KEYDocument.cpp
+index 8ca33ad..a1a5477 100644
+--- a/src/lib/KEYDocument.cpp
++++ b/src/lib/KEYDocument.cpp
+@@ -13,10 +13,12 @@
+ #include <libetonyek/KEYDocument.h>
+
+ #include "libetonyek_utils.h"
++#include "libetonyek_xml.h"
+ #include "KEY1Defaults.h"
+ #include "KEY1Parser.h"
+ #include "KEY2Defaults.h"
+ #include "KEY2Parser.h"
++#include "KEY2Token.h"
+ #include "KEYContentCollector.h"
+ #include "KEYDefaults.h"
+ #include "KEYDictionary.h"
+@@ -60,9 +62,32 @@ enum Source
+
+ Version detectVersionFromInput(const WPXInputStreamPtr_t &input)
+ {
+- // TODO: do a real detection
+- (void) input;
+- return VERSION_KEYNOTE_5;
++ if (input->atEOS())
++ return VERSION_UNKNOWN;
++
++ const KEY2Tokenizer tokenizer;
++ KEYXMLReader reader(input.get(), tokenizer);
++
++ if ((KEY2Token::NS_URI_KEY | KEY2Token::presentation) == getId(reader))
++ {
++ const std::string version = readOnlyAttribute(reader, KEY2Token::version, KEY2Token::NS_URI_KEY);
++
++ switch (tokenizer(version.c_str()))
++ {
++ case KEY2Token::VERSION_STR_2 :
++ return VERSION_KEYNOTE_2;
++ case KEY2Token::VERSION_STR_3 :
++ return VERSION_KEYNOTE_3;
++ case KEY2Token::VERSION_STR_4 :
++ return VERSION_KEYNOTE_4;
++ case KEY2Token::VERSION_STR_5 :
++ return VERSION_KEYNOTE_5;
++ }
++ }
++
++ // TODO: test for v.1 and v.6
++
++ return VERSION_UNKNOWN;
+ }
+
+ Version detectVersion(const WPXInputStreamPtr_t &input, Source &source)
+--
+1.8.3.1
+
diff --git a/external/libetonyek/UnpackedTarball_libetonyek.mk b/external/libetonyek/UnpackedTarball_libetonyek.mk
index 1a6b32da66bf..52eee68a49fa 100644
--- a/external/libetonyek/UnpackedTarball_libetonyek.mk
+++ b/external/libetonyek/UnpackedTarball_libetonyek.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libetonyek,1))
$(eval $(call gb_UnpackedTarball_add_patches,libetonyek,\
external/libetonyek/0001-fix-windows-build.patch \
external/libetonyek/libetonyek-doubledelete.patch.0 \
+ external/libetonyek/0001-impl.-XML-format-detection.patch \
))
# vim: set noet sw=4 ts=4: