[apertium] 01/01: Add PCRE workaround patch
Tino Didriksen
tinodidriksen-guest at moszumanska.debian.org
Tue Oct 28 08:13:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
tinodidriksen-guest pushed a commit to branch master
in repository apertium.
commit 7c16c3a79b4df511586fcd2441b5ddd96eb64687
Author: Tino Didriksen <mail at tinodidriksen.com>
Date: Tue Oct 28 08:13:22 2014 +0000
Add PCRE workaround patch
---
debian/patches/apertium_01_pcre_version.diff | 110 +++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 111 insertions(+)
diff --git a/debian/patches/apertium_01_pcre_version.diff b/debian/patches/apertium_01_pcre_version.diff
new file mode 100644
index 0000000..2d0f42d
--- /dev/null
+++ b/debian/patches/apertium_01_pcre_version.diff
@@ -0,0 +1,110 @@
+diff --git a/apertium/interchunk.cc b/apertium/interchunk.cc
+index fd7e93b..bcb8573 100644
+--- a/apertium/interchunk.cc
++++ b/apertium/interchunk.cc
+@@ -108,10 +108,15 @@ Interchunk::readData(FILE *in)
+ me = new MatchExe(t, finals);
+
+ // attr_items
++ bool recompile_attrs = Compression::string_read(in) != string(pcre_version());
+ for(int i = 0, limit = Compression::multibyte_read(in); i != limit; i++)
+ {
+ string const cad_k = UtfConverter::toUtf8(Compression::wstring_read(in));
+ attr_items[cad_k].read(in);
++ wstring fallback = Compression::wstring_read(in);
++ if(recompile_attrs) {
++ attr_items[cad_k].compile(UtfConverter::toUtf8(fallback));
++ }
+ }
+
+ // variables
+diff --git a/apertium/postchunk.cc b/apertium/postchunk.cc
+index 62d64c8..b5c44a9 100644
+--- a/apertium/postchunk.cc
++++ b/apertium/postchunk.cc
+@@ -107,10 +107,15 @@ Postchunk::readData(FILE *in)
+ me = new MatchExe(t, finals);
+
+ // attr_items
++ bool recompile_attrs = Compression::string_read(in) != string(pcre_version());
+ for(int i = 0, limit = Compression::multibyte_read(in); i != limit; i++)
+ {
+ string const cad_k = UtfConverter::toUtf8(Compression::wstring_read(in));
+ attr_items[cad_k].read(in);
++ wstring fallback = Compression::wstring_read(in);
++ if(recompile_attrs) {
++ attr_items[cad_k].compile(UtfConverter::toUtf8(fallback));
++ }
+ }
+
+ // variables
+diff --git a/apertium/transfer.cc b/apertium/transfer.cc
+index fa955ad..c4cb382 100644
+--- a/apertium/transfer.cc
++++ b/apertium/transfer.cc
+@@ -22,6 +22,7 @@
+ #include <apertium/string_utils.h>
+ #include <lttoolbox/compression.h>
+ #include <lttoolbox/xml_parse_util.h>
++#include <pcre.h>
+
+ #include <cctype>
+ #include <iostream>
+@@ -110,10 +111,15 @@ Transfer::readData(FILE *in)
+ me = new MatchExe(t, finals);
+
+ // attr_items
++ bool recompile_attrs = Compression::string_read(in) != string(pcre_version());
+ for(int i = 0, limit = Compression::multibyte_read(in); i != limit; i++)
+ {
+ string const cad_k = UtfConverter::toUtf8(Compression::wstring_read(in));
+ attr_items[cad_k].read(in);
++ wstring fallback = Compression::wstring_read(in);
++ if(recompile_attrs) {
++ attr_items[cad_k].compile(UtfConverter::toUtf8(fallback));
++ }
+ }
+
+ // variables
+diff --git a/apertium/transfer_data.cc b/apertium/transfer_data.cc
+index aff81c0..d41d56a 100644
+--- a/apertium/transfer_data.cc
++++ b/apertium/transfer_data.cc
+@@ -180,6 +180,7 @@ TransferData::write(FILE *output)
+ void
+ TransferData::writeRegexps(FILE *output)
+ {
++ Compression::string_write(string(pcre_version()), output);
+ Compression::multibyte_write(attr_items.size(), output);
+
+ map<wstring, wstring, Ltstr>::iterator it, limit;
+@@ -187,8 +188,8 @@ TransferData::writeRegexps(FILE *output)
+ {
+ Compression::wstring_write(it->first, output);
+ ApertiumRE my_re;
+- //wcerr << it->second << endl;
+ my_re.compile(UtfConverter::toUtf8(it->second));
+ my_re.write(output);
++ Compression::wstring_write(it->second, output);
+ }
+ }
+diff --git a/apertium/transfer_mult.cc b/apertium/transfer_mult.cc
+index ed0fd61..dc74e9c 100644
+--- a/apertium/transfer_mult.cc
++++ b/apertium/transfer_mult.cc
+@@ -107,10 +107,15 @@ TransferMult::readData(FILE *in)
+ me = new MatchExe(t, finals);
+
+ // attr_items
++ bool recompile_attrs = Compression::string_read(in) != string(pcre_version());
+ for(int i = 0, limit = Compression::multibyte_read(in); i != limit; i++)
+ {
+ string const cad_k = UtfConverter::toUtf8(Compression::wstring_read(in));
+ attr_items[cad_k].read(in);
++ wstring fallback = Compression::wstring_read(in);
++ if(recompile_attrs) {
++ attr_items[cad_k].compile(UtfConverter::toUtf8(fallback));
++ }
+ }
+
+ // variables
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..bf1df9d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+apertium_01_pcre_version.diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/apertium.git
More information about the debian-science-commits
mailing list