[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:05:33 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 276f42792abe60f16ec850d3a24c1901e33d84de
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 27 06:31:02 2003 +0000

            Reviewed by Maciej.
    
            - fixed uses of NULL in non-pointer contexts
    
            * khtml/khtml_part.cpp: (findWordBoundary): Changed NULL to 0 and did a little code
            cleanup of the surrounding code.
            * khtml/rendering/break_lines.cpp: (khtml::isBreakable): Changed NULL to 0 and did
            a tiny bit of cleanup.
    
            * WebCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
            __null feature even if the system C library doesn't.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0430ec6..3879271 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,20 @@
 
         Reviewed by Maciej.
 
+        - fixed uses of NULL in non-pointer contexts
+
+        * khtml/khtml_part.cpp: (findWordBoundary): Changed NULL to 0 and did a little code
+        cleanup of the surrounding code.
+        * khtml/rendering/break_lines.cpp: (khtml::isBreakable): Changed NULL to 0 and did
+        a tiny bit of cleanup.
+
+        * WebCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
+        __null feature even if the system C library doesn't.
+
+2003-10-26  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
         - fixed 3457831 -- REGRESSION: copying particular text and pasting (plain) produces lots of extra text
 
         * khtml/khtml_part.cpp: (KHTMLPart::text): Check for the end node when following a
diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h
index e57685a..724e563 100644
--- a/WebCore/WebCorePrefix.h
+++ b/WebCore/WebCorePrefix.h
@@ -1,3 +1,9 @@
+#ifdef __cplusplus
+#define NULL __null
+#else
+#define NULL ((void *)0)
+#endif
+
 #include <assert.h>
 #include <ctype.h>
 #include <fcntl.h>
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 9d69cf5..bb7ca7c 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -4417,50 +4417,53 @@ static bool startAndEndLineNodesIncludingNode (DOM::NodeImpl *node, int offset,
     return false;
 }
 
-static void findWordBoundary(QChar *chars, int len, int position, int *start, int *end){
-    OSStatus status, findStatus = 0;
+static void findWordBoundary(QChar *chars, int len, int position, int *start, int *end)
+{
     TextBreakLocatorRef breakLocator;
-    
-    status = UCCreateTextBreakLocator (NULL, 0, kUCTextBreakWordMask, &breakLocator);
-    if (status == 0){
-        findStatus = UCFindTextBreak (breakLocator,  kUCTextBreakWordMask, NULL, (const UniChar *)chars, (UniCharCount)len, (UniCharArrayOffset)position, (UniCharArrayOffset *)end);
-        findStatus |= UCFindTextBreak (breakLocator,  kUCTextBreakWordMask, kUCTextBreakGoBackwardsMask,  (const UniChar *)chars, (UniCharCount)len, (UniCharArrayOffset)position, (UniCharArrayOffset *)start);
-        UCDisposeTextBreakLocator (&breakLocator);
-    }
-    
-    // If carbon fails do a simple space/punctuation boundary check.
-    if (findStatus){
-        if (chars[position].isSpace()){
-            int pos = position;
-            while (chars[pos].isSpace() && pos >= 0)
-                pos--;
-            *start = pos+1;
-            pos = position;
-            while (chars[pos].isSpace() && pos < (int)len)
-                pos++;
-            *end = pos;
-        }
-        else if (chars[position].isPunct()){
-            int pos = position;
-            while (chars[pos].isPunct() && pos >= 0)
-                pos--;
-            *start = pos+1;
-            pos = position;
-            while (chars[pos].isPunct() && pos < (int)len)
-                pos++;
-            *end = pos;
+    OSStatus status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakWordMask, &breakLocator);
+    if (status == noErr) {
+        UniCharArrayOffset startOffset, endOffset;
+        status = UCFindTextBreak(breakLocator, kUCTextBreakWordMask, 0, (const UniChar *)chars, len, position, &endOffset);
+        if (status == noErr) {
+            status = UCFindTextBreak(breakLocator, kUCTextBreakWordMask, kUCTextBreakGoBackwardsMask, (const UniChar *)chars, len, position, (UniCharArrayOffset *)start);
         }
-        else {
-            int pos = position;
-            while (!chars[pos].isSpace() && !chars[pos].isPunct() && pos >= 0)
-                pos--;
-            *start = pos+1;
-            pos = position;
-            while (!chars[pos].isSpace() && !chars[pos].isPunct() && pos < (int)len)
-                pos++;
-            *end = pos;
+        UCDisposeTextBreakLocator(&breakLocator);
+        if (status == noErr) {
+            *start = startOffset;
+            *end = endOffset;
+            return;
         }
     }
+    
+    // If Carbon fails (why would it?), do a simple space/punctuation boundary check.
+    if (chars[position].isSpace()) {
+        int pos = position;
+        while (chars[pos].isSpace() && pos >= 0)
+            pos--;
+        *start = pos+1;
+        pos = position;
+        while (chars[pos].isSpace() && pos < (int)len)
+            pos++;
+        *end = pos;
+    } else if (chars[position].isPunct()) {
+        int pos = position;
+        while (chars[pos].isPunct() && pos >= 0)
+            pos--;
+        *start = pos+1;
+        pos = position;
+        while (chars[pos].isPunct() && pos < (int)len)
+            pos++;
+        *end = pos;
+    } else {
+        int pos = position;
+        while (!chars[pos].isSpace() && !chars[pos].isPunct() && pos >= 0)
+            pos--;
+        *start = pos+1;
+        pos = position;
+        while (!chars[pos].isSpace() && !chars[pos].isPunct() && pos < (int)len)
+            pos++;
+        *end = pos;
+    }
 }
 #endif
 
diff --git a/WebCore/khtml/rendering/break_lines.cpp b/WebCore/khtml/rendering/break_lines.cpp
index 2f06878..739a740 100644
--- a/WebCore/khtml/rendering/break_lines.cpp
+++ b/WebCore/khtml/rendering/break_lines.cpp
@@ -95,9 +95,9 @@ bool isBreakable( const QChar *s, int pos, int len)
     unsigned short lastCh = pos > 0 ? (s+pos-1)->unicode() : 0;
     if ((ch > 0x7f && ch != 0xa0) || (lastCh > 0x7f && lastCh != 0xa0)) {
         if (!breakLocator)
-            status = UCCreateTextBreakLocator (NULL, 0, kUCTextBreakLineMask, &breakLocator);
+            status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakLineMask, &breakLocator);
         if (status == 0)
-            findStatus = UCFindTextBreak (breakLocator, kUCTextBreakLineMask, NULL, (const UniChar *)s, len, pos, &end);
+            findStatus = UCFindTextBreak(breakLocator, kUCTextBreakLineMask, 0, (const UniChar *)s, len, pos, &end);
 
         // If carbon fails, fail back on simple white space detection.
         if (findStatus == 0)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list