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

Unified Diff: compiled/String.h

Issue 29542705: Noissue - rename functions checking that the String is writable (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: Created Sept. 12, 2017, 2:27 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
diff --git a/compiled/String.h b/compiled/String.h
index 2b3ae159db33b5b1a1d290cabd1b4055bb4fd48c..a031621a087d2785a68ef2be6e1ec6918b08c6bb 100644
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -25,7 +25,7 @@
#include "debug.h"
#include "library.h"
-inline void String_assert_readonly(bool readOnly);
+inline void String_assert_writable(bool isWritable);
class String
{
@@ -84,7 +84,7 @@ public:
value_type* data()
{
- String_assert_readonly(is_readOnly());
+ String_assert_writable(is_writable());
return mBuf;
}
@@ -95,13 +95,13 @@ public:
value_type& operator[](size_type pos)
{
- String_assert_readonly(is_readOnly());
+ String_assert_writable(is_writable());
return mBuf[pos];
}
- bool is_readOnly() const
+ bool is_writable() const
{
- return (mLen & FLAGS_MASK) != READ_WRITE;
+ return (mLen & FLAGS_MASK) == READ_WRITE;
}
bool equals(const String& other) const
@@ -215,7 +215,7 @@ public:
: String(
str.mBuf + std::min(pos, str.length()),
std::min(len, str.length() - std::min(pos, str.length())),
- str.is_readOnly() ? READ_ONLY : READ_WRITE
+ str.is_writable() ? READ_WRITE: READ_ONLY
)
{
}
@@ -263,9 +263,9 @@ inline DependentString operator "" _str(const String::value_type* str,
return DependentString(str, len);
}
-inline void String_assert_readonly(bool readOnly)
+inline void String_assert_writable(bool isWritable)
{
- assert(!readOnly, u"Writing access to a read-only string"_str);
+ assert(isWritable, u"Writing access to a read-only string"_str);
}
class OwnedString : public String
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld