[Pkg-mediawiki-commits] [wikidiff2] 01/01: New upstream version 1.4.1

Kunal Mehta legoktm-guest at moszumanska.debian.org
Wed Aug 31 02:14:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

legoktm-guest pushed a commit to branch upstream
in repository wikidiff2.

commit f1e209eea35a32d7207f430f480e63f3db64ed63
Author: Kunal Mehta <legoktm at member.fsf.org>
Date:   Tue Aug 30 17:51:25 2016 -0700

    New upstream version 1.4.1
---
 .gitignore           | 25 -----------------
 DiffEngine.h         | 76 ++++++++++++++++++++++++++++++++++------------------
 InlineDiff.cpp       |  2 +-
 README               | 23 ++++++----------
 TableDiff.cpp        |  2 +-
 Wikidiff2.cpp        |  6 -----
 Wikidiff2.h          |  4 +--
 debian/changelog     | 42 -----------------------------
 debian/compat        |  1 -
 debian/control       | 12 ---------
 debian/copyright     |  7 -----
 debian/rules         | 26 ------------------
 debian/source/format |  1 -
 hhvm_wikidiff2.cpp   |  7 +++--
 php_wikidiff2.cpp    | 26 +++++++++++++++---
 tests/003.phpt       |  2 +-
 tests/005.phpt       | 25 +++++++++++++++++
 tests/006.phpt       | 18 +++++++++++++
 18 files changed, 130 insertions(+), 175 deletions(-)

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 17f8943..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-.svn
-*~
-*.kate-swp
-.*.swp
-*.in
-*.lo
-*.la
-*.m4
-Makefile*
-config.*
-
-.deps
-configure
-install-sh
-libtool
-ltmain.sh
-missing
-mkinstalldirs
-run-tests.php
-
-.libs
-autom4te.cache
-build
-modules
-
diff --git a/DiffEngine.h b/DiffEngine.h
index 646bb08..fc8fc5d 100644
--- a/DiffEngine.h
+++ b/DiffEngine.h
@@ -58,7 +58,8 @@ class Diff
 		typedef std::vector<T, WD2_ALLOCATOR<T> > ValueVector;
 		typedef std::vector<DiffOp<T>, WD2_ALLOCATOR<T> > DiffOpVector;
 
-		Diff(const ValueVector & from_lines, const ValueVector & to_lines);
+		Diff(const ValueVector & from_lines, const ValueVector & to_lines,
+			long long bailoutComplexity = 0);
 
 		virtual void add_edit(const DiffOp<T> & edit) {
 			edits.push_back(edit);
@@ -91,7 +92,7 @@ class Diff
  */
 
 template<typename T>
-class _DiffEngine
+class DiffEngine
 {
 	public:
 		// Vectors
@@ -116,16 +117,17 @@ class _DiffEngine
 		typedef std::set<T, std::less<T>, WD2_ALLOCATOR<T> > ValueSet;
 #endif
 
-		_DiffEngine() : done(false) {}
+		DiffEngine() : done(false) {}
 		void clear();
 		void diff (const ValueVector & from_lines,
-				const ValueVector & to_lines, Diff<T> & diff);
-		int _lcs_pos (int ypos);
-		void _compareseq (int xoff, int xlim, int yoff, int ylim);
-		void _shift_boundaries (const ValueVector & lines, BoolVector & changed,
+				const ValueVector & to_lines, Diff<T> & diff,
+				long long bailoutComplexity = 0);
+		int lcs_pos (int ypos);
+		void compareseq (int xoff, int xlim, int yoff, int ylim);
+		void shift_boundaries (const ValueVector & lines, BoolVector & changed,
 				const BoolVector & other_changed);
 	protected:
-		int _diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
+		int diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
 				IntPairVector & seps);
 
 		BoolVector xchanged, ychanged;
@@ -139,10 +141,10 @@ class _DiffEngine
 };
 
 //-----------------------------------------------------------------------------
-// _DiffEngine implementation
+// DiffEngine implementation
 //-----------------------------------------------------------------------------
 template<typename T>
-void _DiffEngine<T>::clear()
+void DiffEngine<T>::clear()
 {
 	xchanged.clear();
 	ychanged.clear();
@@ -156,8 +158,9 @@ void _DiffEngine<T>::clear()
 }
 
 template<typename T>
-void _DiffEngine<T>::diff (const ValueVector & from_lines,
-		const ValueVector & to_lines, Diff<T> & diff)
+void DiffEngine<T>::diff (const ValueVector & from_lines,
+		const ValueVector & to_lines, Diff<T> & diff,
+		long long bailoutComplexity /* = 0 */)
 {
 	int n_from = (int)from_lines.size();
 	int n_to = (int)to_lines.size();
@@ -185,6 +188,26 @@ void _DiffEngine<T>::diff (const ValueVector & from_lines,
 		xchanged[xi] = ychanged[yi] = false;
 	}
 
+	long long complexity = (long long)(n_from - skip - endskip)
+		* (n_to - skip - endskip);
+
+	// If too complex, just output "whole left side replaced with right"
+	if (bailoutComplexity > 0 && complexity > bailoutComplexity) {
+		PointerVector del;
+		PointerVector add;
+
+		for (xi = 0; xi < n_from; xi++) {
+			del.push_back(&from_lines[xi]);
+		}
+		for (yi = 0; yi < n_to; yi++) {
+			add.push_back(&to_lines[yi]);
+		}
+		diff.add_edit(DiffOp<T>(DiffOp<T>::change, del, add));
+
+		done = true;
+		return;
+	}
+
 	// Ignore lines which do not exist in both files.
 	ValueSet xhash, yhash;
 	for (xi = skip; xi < n_from - endskip; xi++) {
@@ -208,11 +231,11 @@ void _DiffEngine<T>::diff (const ValueVector & from_lines,
 	}
 
 	// Find the LCS.
-	_compareseq(0, xv.size(), 0, yv.size());
+	compareseq(0, xv.size(), 0, yv.size());
 
 	// Merge edits when possible
-	_shift_boundaries(from_lines, xchanged, ychanged);
-	_shift_boundaries(to_lines, ychanged, xchanged);
+	shift_boundaries(from_lines, xchanged, ychanged);
+	shift_boundaries(to_lines, ychanged, xchanged);
 
 	// Compute the edit operations.
 	xi = yi = 0;
@@ -271,7 +294,7 @@ void _DiffEngine<T>::diff (const ValueVector & from_lines,
  * of the portions it is going to specify.
  */
 template <typename T>
-int _DiffEngine<T>::_diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
+int DiffEngine<T>::diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
 		IntPairVector & seps)
 {
 	using std::swap;
@@ -328,7 +351,7 @@ int _DiffEngine<T>::_diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
 
 			for (y = pMatches->begin(); y != pMatches->end(); ++y) {
 				if (!in_seq.count(*y)) {
-					k = _lcs_pos(*y);
+					k = lcs_pos(*y);
 					assert(k > 0);
 					copy(ymids.begin() + (k-1) * nchunks, ymids.begin() + k * nchunks,
 							ymids.begin() + k * nchunks);
@@ -345,7 +368,7 @@ int _DiffEngine<T>::_diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
 					seq[k] = *y;
 					in_seq.insert(*y);
 				} else if (!in_seq.count(*y)) {
-					k = _lcs_pos(*y);
+					k = lcs_pos(*y);
 					assert(k > 0);
 					copy(ymids.begin() + (k-1) * nchunks, ymids.begin() + k * nchunks,
 							ymids.begin() + k * nchunks);
@@ -369,7 +392,7 @@ int _DiffEngine<T>::_diag (int xoff, int xlim, int yoff, int ylim, int nchunks,
 }
 
 template <typename T>
-int _DiffEngine<T>::_lcs_pos (int ypos) {
+int DiffEngine<T>::lcs_pos (int ypos) {
 	int end = lcs;
 	if (end == 0 || ypos > seq[end]) {
 		seq[++lcs] = ypos;
@@ -406,7 +429,7 @@ int _DiffEngine<T>::_lcs_pos (int ypos) {
  * All line numbers are origin-0 and discarded lines are not counted.
  */
 template <typename T>
-void _DiffEngine<T>::_compareseq (int xoff, int xlim, int yoff, int ylim) {
+void DiffEngine<T>::compareseq (int xoff, int xlim, int yoff, int ylim) {
 	using std::pair;
 
 	IntPairVector seps;
@@ -431,7 +454,7 @@ void _DiffEngine<T>::_compareseq (int xoff, int xlim, int yoff, int ylim) {
 		//nchunks = sqrt(min(xlim - xoff, ylim - yoff) / 2.5);
 		//nchunks = max(2,min(8,(int)nchunks));
 		int nchunks = std::min(MAX_CHUNKS-1, std::min(xlim - xoff, ylim - yoff)) + 1;
-		lcs = _diag(xoff, xlim, yoff, ylim, nchunks, seps);
+		lcs = diag(xoff, xlim, yoff, ylim, nchunks, seps);
 	}
 
 	if (lcs == 0) {
@@ -446,7 +469,7 @@ void _DiffEngine<T>::_compareseq (int xoff, int xlim, int yoff, int ylim) {
 		IntPairVector::iterator pt1, pt2;
 		pt1 = pt2 = seps.begin();
 		while (++pt2 != seps.end()) {
-			_compareseq (pt1->first, pt2->first, pt1->second, pt2->second);
+			compareseq (pt1->first, pt2->first, pt1->second, pt2->second);
 			pt1 = pt2;
 		}
 	}
@@ -465,7 +488,7 @@ void _DiffEngine<T>::_compareseq (int xoff, int xlim, int yoff, int ylim) {
  * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
  */
 template <typename T>
-void _DiffEngine<T>::_shift_boundaries (const ValueVector & lines, BoolVector & changed,
+void DiffEngine<T>::shift_boundaries (const ValueVector & lines, BoolVector & changed,
 		const BoolVector & other_changed)
 {
 	int i = 0;
@@ -571,10 +594,11 @@ void _DiffEngine<T>::_shift_boundaries (const ValueVector & lines, BoolVector &
 //-----------------------------------------------------------------------------
 
 template<typename T>
-Diff<T>::Diff(const ValueVector & from_lines, const ValueVector & to_lines)
+Diff<T>::Diff(const ValueVector & from_lines, const ValueVector & to_lines,
+	long long bailoutComplexity)
 {
-	_DiffEngine<T> engine;
-	engine.diff(from_lines, to_lines, *this);
+	DiffEngine<T> engine;
+	engine.diff(from_lines, to_lines, *this, bailoutComplexity);
 }
 
 #endif
diff --git a/InlineDiff.cpp b/InlineDiff.cpp
index 3fa941c..d60215c 100644
--- a/InlineDiff.cpp
+++ b/InlineDiff.cpp
@@ -16,7 +16,7 @@ void InlineDiff::printWordDiff(const String& text1, const String& text2)
 
 	explodeWords(text1, words1);
 	explodeWords(text2, words2);
-	WordDiff worddiff(words1, words2);
+	WordDiff worddiff(words1, words2, MAX_WORD_LEVEL_DIFF_COMPLEXITY);
 	String word;
 
 	result += "<div class=\"mw-diff-inline-changed\">";
diff --git a/README b/README
index f4e14f4..67067fe 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Wikidiff2 is partly based on the original wikidiff, partly on DifferenceEngine.php, and partly my own work. It performs word-level (space-delimited) diffs on general text, and character-level diffs on text composed of characters from the Japanese and Thai alphabets and the unified han. Japanese, Chinese and Thai do not use spaces to separate words. The input is assumed to be UTF-8 encoded. Invalid UTF-8 may cause undesirable operation, such as truncation of the output, so the input shoul [...]
+Wikidiff2 is partly based on the original wikidiff, partly on DifferenceEngine.php, and partly Tim Starling's own work. It performs word-level (space-delimited) diffs on general text, and character-level diffs on text composed of characters from the Japanese and Thai alphabets and the unified han. Japanese, Chinese and Thai do not use spaces to separate words. The input is assumed to be UTF-8 encoded. Invalid UTF-8 may cause undesirable operation, such as truncation of the output, so the [...]
 
 The output is an HTML fragment -- a number of HTML table rows with the rest of the document structure omitted. The characters "<", ">" and "&" will be HTML-escaped in the output.
 
@@ -19,29 +19,22 @@ It requires the following library:
 
 * libthai, a Thai language support library
   http://linux.thai.net/plone/TLWG/libthai/
+  On Debian-based systems, you need libthai0 and libthai-dev packages
 
-To compile and install it:
+== Compilation and installation with Zend PHP ==
 
 $ phpize
 $ ./configure
 $ make
 $ sudo make install
 
-== Changelog ==
+== Compilation and installation with HHVM ==
 
-2013-08-07
-* (bug 52616) Use <ins> and <del> for insertions and deletions
-
-2012-01-03
-* (bug 26354) Add class to dummy cells containing  
-* (bug 25697) Add   to empty context lines
+$ hphpize
+$ cmake .
+$ make
+$ sudo make install
 
-2010-09-30
-* Automatically use CXXFLAGS=-Wno-write-strings
 
-2010-06-14
-* Converted the extension from swig to PHP native.
-* Added Thai word break support
-* Added PHP allocator support
 
 vim: wrap
diff --git a/TableDiff.cpp b/TableDiff.cpp
index f613e9d..5a4969f 100644
--- a/TableDiff.cpp
+++ b/TableDiff.cpp
@@ -29,7 +29,7 @@ void TableDiff::printWordDiff(const String & text1, const String & text2)
 
 	explodeWords(text1, words1);
 	explodeWords(text2, words2);
-	WordDiff worddiff(words1, words2);
+	WordDiff worddiff(words1, words2, MAX_WORD_LEVEL_DIFF_COMPLEXITY);
 
 	//debugPrintWordDiff(worddiff);
 
diff --git a/Wikidiff2.cpp b/Wikidiff2.cpp
index 5234dc1..d579b61 100644
--- a/Wikidiff2.cpp
+++ b/Wikidiff2.cpp
@@ -218,12 +218,6 @@ int Wikidiff2::nextUtf8Char(String::const_iterator & p, String::const_iterator &
 // have to check this somehow.
 void Wikidiff2::explodeWords(const String & text, WordVector &words)
 {
-	// Don't try to do a word-level diff on very long lines
-	if (text.size() > MAX_DIFF_LINE) {
-		words.push_back(Word(text.begin(), text.end(), text.end()));
-		return;
-	}
-
 	// Decode the UTF-8 in the string.
 	// * Save the character sizes (in bytes)
 	// * Convert the string to TIS-620, which is the internal character set of libthai.
diff --git a/Wikidiff2.h b/Wikidiff2.h
index 358b73b..da75e7b 100644
--- a/Wikidiff2.h
+++ b/Wikidiff2.h
@@ -1,8 +1,6 @@
 #ifndef WIKIDIFF2_H
 #define WIKIDIFF2_H
 
-#define MAX_DIFF_LINE 10000
-
 /** Set WD2_USE_STD_ALLOCATOR depending on whether we're compiling as a PHP module or not */
 #if defined(HAVE_CONFIG_H)
 	#define WD2_ALLOCATOR PhpAllocator
@@ -33,6 +31,7 @@ class Wikidiff2 {
 		inline const String & getResult() const;
 
 	protected:
+		enum { MAX_WORD_LEVEL_DIFF_COMPLEXITY = 40000000 };
 		String result;
 
 		virtual void diffLines(const StringVector & lines1, const StringVector & lines2,
@@ -85,4 +84,3 @@ inline const Wikidiff2::String & Wikidiff2::getResult() const
 }
 
 #endif
-
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index 3edd0ec..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,42 +0,0 @@
-php-wikidiff2 (1.2-1) precise-wikimedia; urgency=low
-
-  * Added new function, wikidiff2_inline_diff(), for one-column diffs
-
- -- Max Semenik <msemenik at wikimedia.org>  Mon, 09 Dec 2013 21:56:00 +0000
-
-php-wikidiff2 (1.1.2-2) precise-wikimedia; urgency=low
-
-  * Fixed incorrect path in wikidiff2.ini
-
- -- Tim Starling <tstarling at wikimedia.org>  Tue, 08 Jan 2013 14:30:53 +1100
-
-php-wikidiff2 (1.1.2-1) lucid-wikimedia; urgency=low
-  * Fixed bug 26354 (added class to dummy cells containing  )
-  * Fixed bug 25697 (empty context lines not showing)
-
- -- Roan Kattouw <rkattouw at wikimedia.org>  Tue, 03 Jan 2012 14:15:41 +0100
-
-php5-wikidiff2 (1.1.1-1) lucid; urgency=low
-
-  * Fixed bug 33331 (word breaking around punctuation)
-
- -- Tim Starling <tstarling at wikimedia.org>  Fri, 23 Dec 2011 15:33:40 +1100
-
-php5-wikidiff2 (1.1.0-2) lucid; urgency=low
-
-  * Include a config file so the extension loads
-
- -- Mark Bergsma <mark at wikimedia.org>  Tue, 08 Feb 2011 12:50:21 +0000
-
-php5-wikidiff2 (1.1.0-1) lucid; urgency=low
-
-  * New non-swig version
-
- -- Tim Starling <tstarling at wikimedia.org>  Sun, 20 Jun 2010 17:45:37 +1000
-
-php5-wikidiff2 (1.0.2-1) unstable; urgency=low
-
-  * Initial release as deb package
-
- -- Brion Vibber <brion at wikimedia.org>  Tue, 21 Aug 2007 18:03:07 +0000
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 7f8f011..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 2dd289e..0000000
--- a/debian/control
+++ /dev/null
@@ -1,12 +0,0 @@
-Source: php-wikidiff2
-Section: web
-Priority: optional
-Maintainer: Tim Starling <tstarling at wikimedia.org>
-Build-Depends: debhelper (>= 7.0.50), php5-dev, libthai-dev, pkg-config
-Standards-Version: 3.7.2
-
-Package: php-wikidiff2
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}, php5-common, libthai0
-Description: MediaWiki diff plugin for PHP 5
- Faster diff plugin for MediaWiki under PHP 5
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index acbd0e3..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,7 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: php-wikidiff2
-Source: http://gerrit.wikimedia.org/r/mediawiki/php/wikidiff2
-
-Files: *
-Copyright: 2006-2014 Wikimedia Foundation
-License: GPL2
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index ca31f7c..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/make -f
-
-# The PHP header files are not designed to be run with C++, they hit this
-# warning a lot.
-CXXFLAGS=-Wno-write-strings
-
-%:
-	dh $@
-
-override_dh_auto_configure:
-	# Slightly hacked here to make it work with other PHP installations
-	# earlier in the path, so I don't have to make chroots. Really it should just
-	# be phpize && dh_auto_configure.
-	/usr/bin/phpize
-	dh_auto_configure -- --with-php-config=/usr/bin/php-config
-
-override_dh_auto_test:
-
-override_dh_auto_install:
-	INSTALL_ROOT=$(CURDIR)/debian/php-wikidiff2 make install
-	install -m 0755 -d $(CURDIR)/debian/php-wikidiff2/etc/php5/conf.d
-	install -m 0644 wikidiff2.ini $(CURDIR)/debian/php-wikidiff2/etc/php5/conf.d/wikidiff2.ini
-
-override_dh_gencontrol:
-	echo "php:Depends=phpapi-$(shell php-config5 --phpapi)" >> debian/php-wikidiff2.substvars
-	dh_gencontrol
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 89ae9db..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (native)
diff --git a/hhvm_wikidiff2.cpp b/hhvm_wikidiff2.cpp
index 4b533e3..69bd9c8 100644
--- a/hhvm_wikidiff2.cpp
+++ b/hhvm_wikidiff2.cpp
@@ -1,6 +1,8 @@
 /* $Id$ */
 
-#include "hphp/runtime/base/base-includes.h"
+#include "hphp/util/lock.h"
+#include "hphp/runtime/ext/extension.h"
+#include "hphp/util/compatibility.h"
 #include "hphp/util/alloc.h"
 #include "Wikidiff2.h"
 #include "TableDiff.h"
@@ -71,6 +73,3 @@ static class Wikidiff2Extension : public Extension {
 HHVM_GET_MODULE(wikidiff2)
 
 } // namespace HPHP
-
-
-
diff --git a/php_wikidiff2.cpp b/php_wikidiff2.cpp
index 48e9d93..e15ad2b 100644
--- a/php_wikidiff2.cpp
+++ b/php_wikidiff2.cpp
@@ -12,6 +12,12 @@
 #include "TableDiff.h"
 #include "InlineDiff.h"
 
+#if PHP_MAJOR_VERSION >= 7
+#define COMPAT_RETURN_STRINGL(s, l) { RETURN_STRINGL(s, l); return; }
+#else
+#define COMPAT_RETURN_STRINGL(s, l) { RETURN_STRINGL(s, l, 1); return; }
+#endif
+
 static int le_wikidiff2;
 
 zend_function_entry wikidiff2_functions[] = {
@@ -81,9 +87,15 @@ PHP_FUNCTION(wikidiff2_do_diff)
 	char *text1 = NULL;
 	char *text2 = NULL;
 	int argc = ZEND_NUM_ARGS();
+#if PHP_MAJOR_VERSION >= 7
+	size_t text1_len;
+	size_t text2_len;
+	zend_long numContextLines;
+#else
 	int text1_len;
 	int text2_len;
 	long numContextLines;
+#endif
 
 	if (zend_parse_parameters(argc TSRMLS_CC, "ssl", &text1, &text1_len, &text2,
 		&text2_len, &numContextLines) == FAILURE)
@@ -96,8 +108,8 @@ PHP_FUNCTION(wikidiff2_do_diff)
 		TableDiff wikidiff2;
 		Wikidiff2::String text1String(text1, text1_len);
 		Wikidiff2::String text2String(text2, text2_len);
-		const Wikidiff2::String & ret = wikidiff2.execute(text1String, text2String, numContextLines);
-		RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size(), 1);
+		const Wikidiff2::String & ret = wikidiff2.execute(text1String, text2String, (int)numContextLines);
+		COMPAT_RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size());
 	} catch (std::bad_alloc &e) {
 		zend_error(E_WARNING, "Out of memory in wikidiff2_do_diff().");
 	} catch (...) {
@@ -115,9 +127,15 @@ PHP_FUNCTION(wikidiff2_inline_diff)
 	char *text1 = NULL;
 	char *text2 = NULL;
 	int argc = ZEND_NUM_ARGS();
+#if PHP_MAJOR_VERSION >= 7
+	size_t text1_len;
+	size_t text2_len;
+	zend_long numContextLines;
+#else
 	int text1_len;
 	int text2_len;
 	long numContextLines;
+#endif
 
 	if (zend_parse_parameters(argc TSRMLS_CC, "ssl", &text1, &text1_len, &text2,
 		&text2_len, &numContextLines) == FAILURE)
@@ -130,8 +148,8 @@ PHP_FUNCTION(wikidiff2_inline_diff)
 		InlineDiff wikidiff2;
 		Wikidiff2::String text1String(text1, text1_len);
 		Wikidiff2::String text2String(text2, text2_len);
-		const Wikidiff2::String& ret = wikidiff2.execute(text1String, text2String, numContextLines);
-		RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size(), 1);
+		const Wikidiff2::String& ret = wikidiff2.execute(text1String, text2String, (int)numContextLines);
+		COMPAT_RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size());
 	} catch (std::bad_alloc &e) {
 		zend_error(E_WARNING, "Out of memory in wikidiff2_inline_diff().");
 	} catch (...) {
diff --git a/tests/003.phpt b/tests/003.phpt
index 2bd90fa..1a3399e 100644
--- a/tests/003.phpt
+++ b/tests/003.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Diff test C: https://bugzilla.wikimedia.org/show_bug.cgi?id=27993
+Diff test C: https://phabricator.wikimedia.org/T29993
 --SKIPIF--
 <?php if (!extension_loaded("wikidiff2")) print "skip"; ?>
 --FILE--
diff --git a/tests/005.phpt b/tests/005.phpt
new file mode 100644
index 0000000..6d9ac45
--- /dev/null
+++ b/tests/005.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Diff test E: small change in a big paragraph
+--SKIPIF--
+<?php if (!extension_loaded("wikidiff2")) print "skip"; ?>
+--FILE--
+<?php
+$x = str_repeat( 'test ', 2002 );
+$y = str_repeat( 'test ', 1001 ) . 'bloody ' . str_repeat( 'test ', 1001 );
+
+#---------------------------------------------------
+
+print wikidiff2_do_diff( $x, $y, 2 );
+
+?>
+--EXPECT--
+<tr>
+  <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
+  <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
+</tr>
+<tr>
+  <td class="diff-marker">−</td>
+  <td class="diff-deletedline"><div>test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test t [...]
+  <td class="diff-marker">+</td>
+  <td class="diff-addedline"><div>test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test tes [...]
+</tr>
diff --git a/tests/006.phpt b/tests/006.phpt
new file mode 100644
index 0000000..5ee72e9
--- /dev/null
+++ b/tests/006.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Diff test F: don't diff reeeal long paragraph-level changes
+--SKIPIF--
+<?php if (!extension_loaded("wikidiff2")) print "skip"; ?>
+--FILE--
+<?php
+$x = str_repeat( 'a ', 6500 );
+$y = str_repeat( 'b ', 6000 ) . "\n" . str_repeat( 'b ', 500 );
+
+#---------------------------------------------------
+
+print wikidiff2_inline_diff( $x, $y, 2 );
+
+?>
+--EXPECT--
+<div class="mw-diff-inline-header"><!-- LINES 1,1 --></div>
+<div class="mw-diff-inline-changed"><del>a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a [...]
+<div class="mw-diff-inline-added"><ins>b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b [...]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/wikidiff2.git



More information about the Pkg-mediawiki-commits mailing list