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

Side by Side Diff: sandbox/win/src/win_utils.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/win/src/win_utils.h" 5 #include "sandbox/win/src/win_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return true; 85 return true;
86 } 86 }
87 87
88 bool StartsWithDriveLetter(const base::string16& path) { 88 bool StartsWithDriveLetter(const base::string16& path) {
89 if (path.size() < 3) 89 if (path.size() < 3)
90 return false; 90 return false;
91 91
92 if (path[1] != L':' || path[2] != L'\\') 92 if (path[1] != L':' || path[2] != L'\\')
93 return false; 93 return false;
94 94
95 return (path[0] >= 'a' && path[0] <= 'z') || 95 return base::IsAsciiAlpha(path[0]);
96 (path[0] >= 'A' && path[0] <= 'Z');
97 } 96 }
98 97
99 const wchar_t kNTDotPrefix[] = L"\\\\.\\"; 98 const wchar_t kNTDotPrefix[] = L"\\\\.\\";
100 const size_t kNTDotPrefixLen = arraysize(kNTDotPrefix) - 1; 99 const size_t kNTDotPrefixLen = arraysize(kNTDotPrefix) - 1;
101 100
102 // Removes "\\\\.\\" from the path. 101 // Removes "\\\\.\\" from the path.
103 void RemoveImpliedDevice(base::string16* path) { 102 void RemoveImpliedDevice(base::string16* path) {
104 if (0 == path->compare(0, kNTDotPrefixLen, kNTDotPrefix)) 103 if (0 == path->compare(0, kNTDotPrefixLen, kNTDotPrefix))
105 *path = path->substr(kNTDotPrefixLen); 104 *path = path->substr(kNTDotPrefixLen);
106 } 105 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 ::InterlockedCompareExchangePointer( 418 ::InterlockedCompareExchangePointer(
420 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL); 419 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL);
421 420
422 } 421 }
423 422
424 CHECK_NT(ntdll); 423 CHECK_NT(ntdll);
425 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr); 424 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr);
426 *function_ptr = ::GetProcAddress(ntdll, name); 425 *function_ptr = ::GetProcAddress(ntdll, name);
427 CHECK_NT(*function_ptr); 426 CHECK_NT(*function_ptr);
428 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698