rpms/openoffice.org/F-11 openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch, NONE, 1.1 openoffice.org.spec, 1.1917, 1.1918

Caolan McNamara caolanm at fedoraproject.org
Thu Jun 18 16:19:46 UTC 2009


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31228/F-11

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch 
Log Message:
Resolves: rhbz#506545: openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch

openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch:

--- NEW FILE openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch ---
diff -ru i18npool.orig/source/breakiterator/xdictionary.cxx i18npool/source/breakiterator/xdictionary.cxx
--- i18npool.orig/source/breakiterator/xdictionary.cxx	2009-05-28 10:03:10.000000000 +0100
+++ i18npool/source/breakiterator/xdictionary.cxx	2009-06-18 17:02:37.000000000 +0100
@@ -111,8 +112,9 @@
         japaneseWordBreak = sal_True;
 }
 
-sal_Bool xdictionary::exists(const sal_Unicode c) {
-        sal_Bool exist = existMark ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False;
+sal_Bool xdictionary::exists(const sal_uInt32 c) {
+        // 0x1FFF is the hardcoded limit in gendict for existMarks
+        sal_Bool exist = (existMark && ((c>>3) < 0x1FFF)) ? sal::static_int_cast<sal_Bool>((existMark[c>>3] & (1<<(c&0x07))) != 0) : sal_False;
         if (!exist && japaneseWordBreak)
             return BreakIteratorImpl::getScriptClass(c) == ScriptType::ASIAN;
         else
@@ -169,20 +171,35 @@
  * @param pos : Position of the given character.
  * @return true if CJK.
  */
-sal_Bool xdictionary::seekSegment(const sal_Unicode *text, sal_Int32 pos, 
-                sal_Int32 len, Boundary& segBoundary) {
-        for (segBoundary.startPos = pos - 1; 
-            segBoundary.startPos >= 0 && 
-                (u_isWhitespace((sal_uInt32)text[segBoundary.startPos]) || exists(text[segBoundary.startPos]));
-            segBoundary.startPos--) ;
-        segBoundary.startPos++;
-
-        for (segBoundary.endPos = pos;
-            segBoundary.endPos < len &&
-                    (u_isWhitespace((sal_uInt32)text[segBoundary.endPos]) || exists(text[segBoundary.endPos]));
-            segBoundary.endPos++) ;
+sal_Bool xdictionary::seekSegment(const rtl::OUString &rText, sal_Int32 pos, 
+	Boundary& segBoundary)
+{
+    sal_Int32 indexUtf16;
+    segBoundary.endPos = segBoundary.startPos = pos;
+
+    indexUtf16 = pos;
+    while (indexUtf16 > 0)
+    {
+        sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, -1);
+        if (u_isWhitespace(ch) || exists(ch))
+            segBoundary.startPos = indexUtf16;
+        else
+            break;
+    }
 
-        return segBoundary.endPos > segBoundary.startPos + 1;
+    indexUtf16 = pos;
+    while (indexUtf16 < rText.getLength())
+    {
+        sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, 1);
+        if (u_isWhitespace(ch) || exists(ch))
+            segBoundary.endPos = indexUtf16;
+        else
+            break;
+    }
+
+    indexUtf16 = segBoundary.startPos;
+    rText.iterateCodePoints(&indexUtf16, 1);
+    return segBoundary.endPos > indexUtf16;
 }
 
 #define KANJA       1
@@ -312,19 +329,24 @@
         sal_Int32 len=rText.getLength();
         if (anyPos >= len || anyPos < 0) {
             boundary.startPos = boundary.endPos = anyPos < 0 ? 0 : len;
-        } else if (seekSegment(text, anyPos, len, boundary)) {          // character in dict
+        } else if (seekSegment(rText, anyPos, boundary)) {          // character in dict
             WordBreakCache& aCache = getCache(text, boundary);
             sal_Int32 i = 0;
 
-            while (aCache.wordboundary[i] <= (sal_Int32)anyPos - boundary.startPos) i++;
+            while (aCache.wordboundary[i] <= anyPos - boundary.startPos) i++;
 
             sal_Int32 startPos = aCache.wordboundary[i - 1];
             // if bDirection is false
-            if (!bDirection && startPos > 0 && startPos == (anyPos - boundary.startPos) &&
-                                                u_isWhitespace((sal_uInt32) text[anyPos - 1]))
-                i--;
-            boundary.endPos = aCache.wordboundary[i] + boundary.startPos;
-            boundary.startPos += aCache.wordboundary[i - 1];
+            if (!bDirection && startPos > 0 && startPos == (anyPos - boundary.startPos))
+            {
+                sal_Int32 indexUtf16 = anyPos-1;
+                sal_uInt32 ch = rText.iterateCodePoints(&indexUtf16, 1);
+                if (u_isWhitespace(ch))
+                    i--;
+            }
+            boundary.endPos = boundary.startPos;
+            rText.iterateCodePoints(&boundary.endPos, aCache.wordboundary[i]);
+            rText.iterateCodePoints(&boundary.startPos, aCache.wordboundary[i-1]);
         } else {
             boundary.startPos = anyPos;
             if (anyPos < len) rText.iterateCodePoints(&anyPos, 1);
@@ -332,8 +354,14 @@
         }
         if (wordType == WordType::WORD_COUNT) {
             // skip punctuation for word count.
-            while (boundary.endPos < len && u_ispunct((sal_uInt32)text[boundary.endPos])) 
-                boundary.endPos++;
+            while (boundary.endPos < len)
+            {
+                sal_Int32 indexUtf16 = boundary.endPos;
+                if (u_ispunct(rText.iterateCodePoints(&indexUtf16, 1)))
+                    boundary.endPos = indexUtf16;
+                else
+                    break;
+            }
         }
 
         return boundary;
--- i18npool.orig/inc/xdictionary.hxx	2009-05-28 10:03:15.000000000 +0100
+++ i18npool/inc/xdictionary.hxx	2009-06-18 16:46:15.000000000 +0100
@@ -85,9 +85,9 @@
 private:
 	WordBreakCache cache[CACHE_MAX];
 
-	sal_Bool        seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& boundary);
+	sal_Bool        seekSegment(const rtl::OUString& rText, sal_Int32 pos, Boundary& boundary);
 	WordBreakCache& getCache(const sal_Unicode *text, Boundary& boundary);
-    sal_Bool        exists(const sal_Unicode u);
+	sal_Bool        exists(const sal_uInt32 u);
 	sal_Int32       getLongestMatch(const sal_Unicode *text, sal_Int32 len);
 };
 


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/F-11/openoffice.org.spec,v
retrieving revision 1.1917
retrieving revision 1.1918
diff -u -p -r1.1917 -r1.1918
--- openoffice.org.spec	16 Jun 2009 13:04:45 -0000	1.1917
+++ openoffice.org.spec	18 Jun 2009 16:19:14 -0000	1.1918
@@ -143,6 +143,7 @@ Patch67: openoffice.org-3.1.0.ooo101566.
 Patch68: openoffice.org-3.1.0.ooo101567.i18npool.mailocaledata.patch
 Patch69: openoffice.org-3.1.0.ooo102566.sc.less.frenetic.progress.patch
 Patch70: workspace.pdfextfix02.patch
+Patch71: openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch
 
 %define python_py_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")
 %define instdir %{_libdir}
@@ -1644,6 +1645,7 @@ cat %{PATCH11} >> svtools/source/dialogs
 %patch68 -p0 -b .ooo101567.i18npool.mailocaledata.patch
 %patch69 -p0 -b .ooo102566.sc.less.frenetic.progress.patch
 %patch70 -p0 -b .workspace.pdfextfix02.patch
+%patch71 -p0 -b .ooo102920.i18npool.utf16bustage.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -4146,11 +4148,12 @@ fi
     unopkg list --shared > /dev/null 2>&1 || :
 
 %changelog
-* Tue Jun 16 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.1.0-11.4.UNRELEASED
+* Thu Jun 18 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.1.0-11.4.UNRELEASED
 - Related: rhbz#472853 openoffice.org-3.1.0.ooo99250.sc.autooutline-reflists.patch
 - Resolves: rhbz#503003 silence warnings on updates
 - Resolves: rhbz#504419 openoffice.org-3.1.0.ooo102566.sc.less.frenetic.progress.patch
 - Resolves: rhbz#506039 workspace.pdfextfix02.patch upsidedown images in pdf import
+- Resolves: rhbz#506545: openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch
 
 * Mon May 25 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.1.0-11.3
 - add in the ia64 and arm fixes for the secondary arch people




More information about the fedora-extras-commits mailing list