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

Unified Diff: base/string_piece.h

Issue 6317016: Change UTF8ToUTF16 to accept const StringPiece&. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 11 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 | « base/logging.h ('k') | base/utf_string_conversions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_piece.h
diff --git a/base/string_piece.h b/base/string_piece.h
index 80c6cabf5edcbff5eb2941cd602c02317f3336a1..64326e1652af44f226f3dfb8ce9a16ceff18de59 100644
--- a/base/string_piece.h
+++ b/base/string_piece.h
@@ -19,8 +19,6 @@
#define BASE_STRING_PIECE_H_
#pragma once
-#include <algorithm>
-#include <iosfwd>
#include <string>
#include "base/basictypes.h"
@@ -93,7 +91,8 @@ class StringPiece {
}
int compare(const StringPiece& x) const {
- int r = wordmemcmp(ptr_, x.ptr_, std::min(length_, x.length_));
+ int r = wordmemcmp(
+ ptr_, x.ptr_, (length_ < x.length_ ? length_ : x.length_));
if (r == 0) {
if (length_ < x.length_) r = -1;
else if (length_ > x.length_) r = +1;
@@ -171,8 +170,8 @@ inline bool operator!=(const StringPiece& x, const StringPiece& y) {
}
inline bool operator<(const StringPiece& x, const StringPiece& y) {
- const int r = StringPiece::wordmemcmp(x.data(), y.data(),
- std::min(x.size(), y.size()));
+ const int r = StringPiece::wordmemcmp(
+ x.data(), y.data(), (x.size() < y.size() ? x.size() : y.size()));
return ((r < 0) || ((r == 0) && (x.size() < y.size())));
}
@@ -188,9 +187,6 @@ inline bool operator>=(const StringPiece& x, const StringPiece& y) {
return !(x < y);
}
-// allow StringPiece to be logged (needed for unit testing).
-extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece);
-
} // namespace base
#endif // BASE_STRING_PIECE_H_
« no previous file with comments | « base/logging.h ('k') | base/utf_string_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698