Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/String.h

Issue 29587914: Issue 5142 - Convert Element Hiding to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebased on master. Created Dec. 5, 2017, 6:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -276,17 +276,17 @@
OwnedString newValue(length() + additionalSize);
if (length() > 0)
std::memcpy(newValue.mBuf, mBuf, sizeof(value_type) * length());
*this = std::move(newValue);
}
public:
explicit OwnedString(size_type len = 0)
- : String(nullptr, len, READ_WRITE)
+ : String(nullptr, len, len ? READ_WRITE : INVALID)
sergei 2018/01/15 15:31:19 If it's not difficult could you please put the cha
hub 2018/01/16 02:57:39 Done https://codereview.adblockplus.org/29669631/
{
if (len)
{
mBuf = new value_type[length()];
annotate_address(mBuf, "String");
}
else
mBuf = nullptr;
@@ -319,16 +319,21 @@
}
~OwnedString()
{
if (mBuf)
delete[] mBuf;
}
+ void reset(const String& str)
+ {
+ *this = str;
+ }
+
OwnedString& operator=(const String& str)
{
*this = OwnedString(str);
return *this;
}
OwnedString& operator=(const OwnedString& str)
{

Powered by Google App Engine
This is Rietveld