Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: source/common/rbbi.cpp

Issue 9425042: ICU: Merge upstream r30255 to fix a clang warning. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/icu46/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « patches/changeset_30255.patch ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/rbbi.cpp
===================================================================
--- source/common/rbbi.cpp (revision 122609)
+++ source/common/rbbi.cpp (working copy)
@@ -1504,19 +1504,8 @@
//
// Clone the source BI into the caller-supplied buffer.
- // TODO: using an overloaded operator new to directly initialize the
- // copy in the user's buffer would be better, but it doesn't seem
- // to get along with namespaces. Investigate why.
//
- // The memcpy is only safe with an empty (default constructed)
- // break iterator. Use on others can screw up reference counts
- // to data. memcpy-ing objects is not really a good idea...
- //
- RuleBasedBreakIterator localIter; // Empty break iterator, source for memcpy
- RuleBasedBreakIterator *clone = (RuleBasedBreakIterator *)buf;
- uprv_memcpy(clone, &localIter, sizeof(RuleBasedBreakIterator)); // init C++ gorp, BreakIterator base class part
- clone->init(); // Init RuleBasedBreakIterator part, (user default constructor)
- *clone = *this; // clone = the real BI we want.
+ RuleBasedBreakIterator *clone = new(buf) RuleBasedBreakIterator(*this);
clone->fBufferClone = TRUE; // Flag to prevent deleting storage on close (From C code)
return clone;
« no previous file with comments | « patches/changeset_30255.patch ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698