rpms/openoffice.org/devel workspace.locales32.patch, NONE, 1.1 openoffice.org.spec, 1.1981, 1.1982 openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch, 1.1, NONE

Caolan McNamara caolanm at fedoraproject.org
Tue Aug 18 07:39:21 UTC 2009


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23811

Modified Files:
	openoffice.org.spec 
Added Files:
	workspace.locales32.patch 
Removed Files:
	openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch 
Log Message:
rename to upstream workspace

workspace.locales32.patch:
 i18npool/source/breakiterator/xdictionary.cxx |   75 +++++++++++++++++---------
 inc/xdictionary.hxx                           |    4 -
 2 files changed, 53 insertions(+), 26 deletions(-)

--- NEW FILE workspace.locales32.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/devel/openoffice.org.spec,v
retrieving revision 1.1981
retrieving revision 1.1982
diff -u -p -r1.1981 -r1.1982
--- openoffice.org.spec	17 Aug 2009 11:08:12 -0000	1.1981
+++ openoffice.org.spec	18 Aug 2009 07:39:21 -0000	1.1982
@@ -146,7 +146,7 @@ Patch68: openoffice.org-3.1.0.ooo102061.
 Patch69: openoffice.org-3.1.0.ooo102142.sd.resleak.patch
 Patch70: workspace.calc51.patch
 Patch71: openoffice.org-2.0.0.ooo46270.svx.search-dialog.no-find-all-in-draw.patch
-Patch72: openoffice.org-3.1.0.ooo102920.i18npool.utf16bustage.patch
+Patch72: workspace.locales32.patch
 Patch73: workspace.cmcfixes60.patch
 Patch74: workspace.dr72.patch
 Patch75: workspace.vcl103.patch
@@ -1685,7 +1685,7 @@ cat %{PATCH11} >> svtools/source/dialogs
 %patch69 -p0 -b .ooo102142.sd.resleak.patch
 %patch70 -p0 -b .workspace.calc51.patch
 %patch71 -p0 -b .ooo46270.svx.search-dialog.no-find-all-in-draw.patch
-%patch72 -p0 -b .ooo102920.i18npool.utf16bustage.patch
+%patch72 -p0 -b .workspace.locales32.patch
 %patch73 -p0 -b .workspace.cmcfixes60.patch
 %patch74 -p0 -b .workspace.dr72.patch
 %patch75 -p0 -b .workspace.vcl103.patch


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




More information about the fedora-extras-commits mailing list