Title: [127212] trunk/Source
- Revision
- 127212
- Author
- [email protected]
- Date
- 2012-08-30 16:41:29 -0700 (Thu, 30 Aug 2012)
Log Message
Ambiguous operator[] after r127191 on some compiler
https://bugs.webkit.org/show_bug.cgi?id=95509
Patch by Benjamin Poulain <[email protected]> on 2012-08-30
Reviewed by Simon Fraser.
Source/_javascript_Core:
On some compilers, the operator[] conflicts with the Obj-C++ operators. This attempts to solve
the issue.
* runtime/JSString.h:
(JSC::jsSingleCharacterSubstring):
(JSC::jsString):
(JSC::jsSubstring8):
(JSC::jsSubstring):
(JSC::jsOwnedString):
Source/WTF:
* wtf/text/WTFString.h:
(WTF::String::characterAt): At this as a synonym to operator[] to attempt a build fix.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (127211 => 127212)
--- trunk/Source/_javascript_Core/ChangeLog 2012-08-30 23:36:41 UTC (rev 127211)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-08-30 23:41:29 UTC (rev 127212)
@@ -1,3 +1,20 @@
+2012-08-30 Benjamin Poulain <[email protected]>
+
+ Ambiguous operator[] after r127191 on some compiler
+ https://bugs.webkit.org/show_bug.cgi?id=95509
+
+ Reviewed by Simon Fraser.
+
+ On some compilers, the operator[] conflicts with the Obj-C++ operators. This attempts to solve
+ the issue.
+
+ * runtime/JSString.h:
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsString):
+ (JSC::jsSubstring8):
+ (JSC::jsSubstring):
+ (JSC::jsOwnedString):
+
2012-08-30 Geoffrey Garen <[email protected]>
Try to fix the Qt build: Remove the inline keyword at the declaration
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (127211 => 127212)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2012-08-30 23:36:41 UTC (rev 127211)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2012-08-30 23:41:29 UTC (rev 127212)
@@ -347,7 +347,7 @@
{
JSGlobalData* globalData = &exec->globalData();
ASSERT(offset < static_cast<unsigned>(s.length()));
- UChar c = s[offset];
+ UChar c = s.characterAt(offset);
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
return JSString::create(*globalData, StringImpl::create(s.impl(), offset, 1));
@@ -396,7 +396,7 @@
if (!size)
return globalData->smallStrings.emptyString(globalData);
if (size == 1) {
- UChar c = s[0];
+ UChar c = s.characterAt(0);
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
}
@@ -422,7 +422,7 @@
if (!length)
return globalData->smallStrings.emptyString(globalData);
if (length == 1) {
- UChar c = s[offset];
+ UChar c = s.characterAt(offset);
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
}
@@ -437,7 +437,7 @@
if (!length)
return globalData->smallStrings.emptyString(globalData);
if (length == 1) {
- UChar c = s[offset];
+ UChar c = s.characterAt(offset);
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
}
@@ -450,7 +450,7 @@
if (!size)
return globalData->smallStrings.emptyString(globalData);
if (size == 1) {
- UChar c = s[0];
+ UChar c = s.characterAt(0);
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
}
Modified: trunk/Source/WTF/ChangeLog (127211 => 127212)
--- trunk/Source/WTF/ChangeLog 2012-08-30 23:36:41 UTC (rev 127211)
+++ trunk/Source/WTF/ChangeLog 2012-08-30 23:41:29 UTC (rev 127212)
@@ -1,3 +1,13 @@
+2012-08-30 Benjamin Poulain <[email protected]>
+
+ Ambiguous operator[] after r127191 on some compiler
+ https://bugs.webkit.org/show_bug.cgi?id=95509
+
+ Reviewed by Simon Fraser.
+
+ * wtf/text/WTFString.h:
+ (WTF::String::characterAt): At this as a synonym to operator[] to attempt a build fix.
+
2012-08-30 Mark Lam <[email protected]>
Render unto #ifdef's that which belong to them.
Modified: trunk/Source/WTF/wtf/text/WTFString.h (127211 => 127212)
--- trunk/Source/WTF/wtf/text/WTFString.h 2012-08-30 23:36:41 UTC (rev 127211)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2012-08-30 23:41:29 UTC (rev 127212)
@@ -449,6 +449,14 @@
WTF_EXPORT_STRING_API void show() const;
#endif
+ // Workaround for a compiler bug. Use operator[] instead.
+ UChar characterAt(unsigned index) const
+ {
+ if (!m_impl || index >= m_impl->length())
+ return 0;
+ return (*m_impl)[index];
+ }
+
private:
RefPtr<StringImpl> m_impl;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes