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

Unified Diff: Source/wtf/dtoa/utils.h

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | « Source/wtf/dtoa/strtod.h ('k') | Source/wtf/text/AtomicString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/dtoa/utils.h
diff --git a/Source/wtf/dtoa/utils.h b/Source/wtf/dtoa/utils.h
index 7f6a695e65a5a6f2b624d05e08d6051303277fd7..f6fe024aa56c7123a74d46690a0e14b7ac5d3748 100644
--- a/Source/wtf/dtoa/utils.h
+++ b/Source/wtf/dtoa/utils.h
@@ -115,29 +115,29 @@ DISALLOW_COPY_AND_ASSIGN(TypeName)
namespace WTF {
namespace double_conversion {
-
+
static const int kCharSize = sizeof(char);
-
+
// Returns the maximum of the two parameters.
template <typename T>
static T Max(T a, T b) {
return a < b ? b : a;
}
-
-
+
+
// Returns the minimum of the two parameters.
template <typename T>
static T Min(T a, T b) {
return a < b ? a : b;
}
-
-
+
+
inline int StrLength(const char* string) {
size_t length = strlen(string);
ASSERT(length == static_cast<size_t>(static_cast<int>(length)));
return static_cast<int>(length);
}
-
+
// This is a simplified version of V8's Vector class.
template <typename T>
class Vector {
@@ -146,7 +146,7 @@ namespace double_conversion {
Vector(T* data, int length) : start_(data), length_(length) {
ASSERT(length == 0 || (length > 0 && data != NULL));
}
-
+
// Returns a vector using the same backing storage as this one,
// spanning from and including 'from', to but not including 'to'.
Vector<T> SubVector(int from, int to) {
@@ -155,32 +155,32 @@ namespace double_conversion {
ASSERT(0 <= from);
return Vector<T>(start() + from, to - from);
}
-
+
// Returns the length of the vector.
int length() const { return length_; }
-
+
// Returns whether or not the vector is empty.
bool is_empty() const { return length_ == 0; }
-
+
// Returns the pointer to the start of the data in the vector.
T* start() const { return start_; }
-
+
// Access individual vector elements - checks bounds in debug mode.
T& operator[](int index) const {
ASSERT(0 <= index && index < length_);
return start_[index];
}
-
+
T& first() { return start_[0]; }
-
+
T& last() { return start_[length_ - 1]; }
-
+
private:
T* start_;
int length_;
};
-
-
+
+
// Helper class for building result strings in a character buffer. The
// purpose of the class is to use safe operations that checks the
// buffer bounds on all operations in debug mode.
@@ -188,17 +188,17 @@ namespace double_conversion {
public:
StringBuilder(char* buffer, int size)
: buffer_(buffer, size), position_(0) { }
-
+
~StringBuilder() { if (!is_finalized()) Finalize(); }
-
+
int size() const { return buffer_.length(); }
-
+
// Get the current position in the builder.
int position() const {
ASSERT(!is_finalized());
return position_;
}
-
+
// Set the current position in the builder.
void SetPosition(int position)
{
@@ -206,10 +206,10 @@ namespace double_conversion {
ASSERT_WITH_SECURITY_IMPLICATION(position < size());
position_ = position;
}
-
+
// Reset the position.
void Reset() { position_ = 0; }
-
+
// Add a single character to the builder. It is not allowed to add
// 0-characters; use the Finalize() method to terminate the string
// instead.
@@ -218,13 +218,13 @@ namespace double_conversion {
ASSERT(!is_finalized() && position_ < buffer_.length());
buffer_[position_++] = c;
}
-
+
// Add an entire string to the builder. Uses strlen() internally to
// compute the length of the input string.
void AddString(const char* s) {
AddSubstring(s, StrLength(s));
}
-
+
// Add the first 'n' characters of the given string 's' to the
// builder. The input string must have enough characters.
void AddSubstring(const char* s, int n) {
@@ -233,8 +233,8 @@ namespace double_conversion {
memcpy(&buffer_[position_], s, n * kCharSize);
position_ += n;
}
-
-
+
+
// Add character padding to the builder. If count is non-positive,
// nothing is added to the builder.
void AddPadding(char c, int count) {
@@ -242,7 +242,7 @@ namespace double_conversion {
AddCharacter(c);
}
}
-
+
// Finalize the string by 0-terminating it and returning the buffer.
char* Finalize() {
ASSERT(!is_finalized() && position_ < buffer_.length());
@@ -254,16 +254,16 @@ namespace double_conversion {
ASSERT(is_finalized());
return buffer_.start();
}
-
+
private:
Vector<char> buffer_;
int position_;
-
+
bool is_finalized() const { return position_ < 0; }
-
+
DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
};
-
+
// The type-based aliasing rule allows the compiler to assume that pointers of
// different types (for some definition of different) never alias each other.
// Thus the following code does not work:
@@ -293,17 +293,17 @@ namespace double_conversion {
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
-
+
Dest dest;
memcpy(&dest, &source, sizeof(dest));
return dest;
}
-
+
template <class Dest, class Source>
inline Dest BitCast(Source* source) {
return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
}
-
+
} // namespace double_conversion
} // namespace WTF
« no previous file with comments | « Source/wtf/dtoa/strtod.h ('k') | Source/wtf/text/AtomicString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698