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

Unified Diff: base/guid.cc

Issue 546603002: Make base::IsValidGUID() accept GUID strings in lowercase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | base/guid_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/guid.cc
diff --git a/base/guid.cc b/base/guid.cc
index b7d79f22790da1da990bacc6f7b1073a751c6b79..be5c58b53599d43a96e26168b0d4be9db546bb7f 100644
--- a/base/guid.cc
+++ b/base/guid.cc
@@ -4,6 +4,8 @@
#include "base/guid.h"
+#include "base/strings/string_util.h"
+
namespace base {
bool IsValidGUID(const std::string& guid) {
@@ -11,14 +13,13 @@ bool IsValidGUID(const std::string& guid) {
if (guid.length() != kGUIDLength)
return false;
- const std::string hexchars = "0123456789ABCDEF";
- for (uint32 i = 0; i < guid.length(); ++i) {
+ for (size_t i = 0; i < guid.length(); ++i) {
char current = guid[i];
if (i == 8 || i == 13 || i == 18 || i == 23) {
if (current != '-')
return false;
} else {
- if (hexchars.find(current) == std::string::npos)
+ if (!IsHexDigit(current))
return false;
}
}
« no previous file with comments | « no previous file | base/guid_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698