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

Unified Diff: third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp

Issue 1373773002: Fix check-webkit-style errors in Source/wtf/text/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
index 99cefe63ee30bb9bd0572f2feb9456749918293d..e940d6defd50b4aa2a94a9251caa57b83c9cf111 100644
--- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
+++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
@@ -31,12 +31,10 @@
#include "wtf/text/StringBuffer.h"
#include "wtf/text/TextCodecASCIIFastPath.h"
-using namespace WTF;
-using namespace WTF::Unicode;
-using namespace std;
-
namespace WTF {
+using namespace WTF::Unicode;
+
const int nonCharacter = -1;
PassOwnPtr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*)
@@ -146,9 +144,9 @@ static inline UChar* appendCharacter(UChar* destination, int character)
{
ASSERT(character != nonCharacter);
ASSERT(!U_IS_SURROGATE(character));
- if (U_IS_BMP(character))
+ if (U_IS_BMP(character)) {
*destination++ = static_cast<UChar>(character);
- else {
+ } else {
*destination++ = U16_LEAD(character);
*destination++ = U16_TRAIL(character);
}
@@ -316,9 +314,9 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, FlushBehavior flu
}
int count = nonASCIISequenceLength(*source);
int character;
- if (!count)
+ if (count == 0) {
character = nonCharacter;
- else {
+ } else {
if (count > end - source) {
ASSERT_WITH_SECURITY_IMPLICATION(end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence)));
ASSERT(!m_partialSequenceSize);
@@ -393,9 +391,9 @@ upConvertTo16Bit:
}
int count = nonASCIISequenceLength(*source);
int character;
- if (!count)
+ if (count == 0) {
character = nonCharacter;
- else {
+ } else {
if (count > end - source) {
ASSERT_WITH_SECURITY_IMPLICATION(end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence)));
ASSERT(!m_partialSequenceSize);
@@ -431,7 +429,7 @@ CString TextCodecUTF8::encodeCommon(const CharType* characters, size_t length)
// The maximum number of UTF-8 bytes needed per UTF-16 code unit is 3.
// BMP characters take only one UTF-16 code unit and can take up to 3 bytes (3x).
// Non-BMP characters take two UTF-16 code units and can take up to 4 bytes (2x).
- if (length > numeric_limits<size_t>::max() / 3)
+ if (length > std::numeric_limits<size_t>::max() / 3)
CRASH();
Vector<uint8_t> bytes(length * 3);
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextCodecUTF16.h ('k') | third_party/WebKit/Source/wtf/text/TextCodecUserDefined.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698