summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/text
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/text')
-rw-r--r--WebCore/platform/text/TextBoundaries.cpp28
-rw-r--r--WebCore/platform/text/TextBoundaries.h3
-rw-r--r--WebCore/platform/text/TextCodecUTF16.cpp11
3 files changed, 3 insertions, 39 deletions
diff --git a/WebCore/platform/text/TextBoundaries.cpp b/WebCore/platform/text/TextBoundaries.cpp
index fbb261b..8eaffca 100644
--- a/WebCore/platform/text/TextBoundaries.cpp
+++ b/WebCore/platform/text/TextBoundaries.cpp
@@ -36,32 +36,6 @@ using namespace Unicode;
namespace WebCore {
-int endOfFirstWordBoundaryContext(const UChar* characters, int length)
-{
- for (int i = 0; i < length; ) {
- int first = i;
- UChar32 ch;
- U16_NEXT(characters, i, length, ch);
- if (!requiresContextForWordBoundary(ch))
- return first;
- }
- return length;
-}
-
-int startOfLastWordBoundaryContext(const UChar* characters, int length)
-{
- for (int i = length; i > 0; ) {
- int last = i;
- UChar32 ch;
- U16_PREV(characters, 0, i, ch);
- if (!requiresContextForWordBoundary(ch))
- return last;
- }
- return 0;
-}
-
-#if !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT)
-
int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
{
TextBreakIterator* it = wordBreakIterator(chars, len);
@@ -102,6 +76,4 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int
*start = textBreakPrevious(it);
}
-#endif // !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT)
-
} // namespace WebCore
diff --git a/WebCore/platform/text/TextBoundaries.h b/WebCore/platform/text/TextBoundaries.h
index 870ab62..7eb9cab 100644
--- a/WebCore/platform/text/TextBoundaries.h
+++ b/WebCore/platform/text/TextBoundaries.h
@@ -35,9 +35,6 @@ namespace WebCore {
return WTF::Unicode::hasLineBreakingPropertyComplexContext(ch);
}
- int endOfFirstWordBoundaryContext(const UChar* characters, int length);
- int startOfLastWordBoundaryContext(const UChar* characters, int length);
-
void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
diff --git a/WebCore/platform/text/TextCodecUTF16.cpp b/WebCore/platform/text/TextCodecUTF16.cpp
index e88e83b..95f4dc4 100644
--- a/WebCore/platform/text/TextCodecUTF16.cpp
+++ b/WebCore/platform/text/TextCodecUTF16.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -117,13 +117,8 @@ String TextCodecUTF16::decode(const char* bytes, size_t length, bool, bool, bool
CString TextCodecUTF16::encode(const UChar* characters, size_t length, UnencodableHandling)
{
- // We need to be sure we can double the length without overflowing.
- // Since the passed-in length is the length of an actual existing
- // character buffer, each character is two bytes, and we know
- // the buffer doesn't occupy the entire address space, we can
- // assert here that doubling the length does not overflow size_t
- // and there's no need for a runtime check.
- ASSERT(length <= numeric_limits<size_t>::max() / 2);
+ if (length > numeric_limits<size_t>::max() / 2)
+ CRASH();
char* bytes;
CString string = CString::newUninitialized(length * 2, bytes);