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

Side by Side Diff: third_party/crashpad/crashpad/util/stdlib/string_number_conversion.cc

Issue 2555353002: Update Crashpad to 32981a3ee9d7c2769fb27afa038fe2e194cfa329 (Closed)
Patch Set: fix readme Created 4 years 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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 : public StringToUnsignedIntegerTraits<unsigned int, unsigned long> { 103 : public StringToUnsignedIntegerTraits<unsigned int, unsigned long> {
104 static LongType Convert(const char* str, char** end, int base) { 104 static LongType Convert(const char* str, char** end, int base) {
105 if (str[0] == '-') { 105 if (str[0] == '-') {
106 *end = const_cast<char*>(str); 106 *end = const_cast<char*>(str);
107 return 0; 107 return 0;
108 } 108 }
109 return strtoul(str, end, base); 109 return strtoul(str, end, base);
110 } 110 }
111 }; 111 };
112 112
113 struct StringToInt64Traits
114 : public StringToSignedIntegerTraits<int64_t, int64_t> {
115 static LongType Convert(const char* str, char** end, int base) {
116 return strtoll(str, end, base);
117 }
118 };
119
113 struct StringToUnsignedInt64Traits 120 struct StringToUnsignedInt64Traits
114 : public StringToUnsignedIntegerTraits<uint64_t, uint64_t> { 121 : public StringToUnsignedIntegerTraits<uint64_t, uint64_t> {
115 static LongType Convert(const char* str, char** end, int base) { 122 static LongType Convert(const char* str, char** end, int base) {
116 if (str[0] == '-') { 123 if (str[0] == '-') {
117 *end = const_cast<char*>(str); 124 *end = const_cast<char*>(str);
118 return 0; 125 return 0;
119 } 126 }
120 return strtoull(str, end, base); 127 return strtoull(str, end, base);
121 } 128 }
122 }; 129 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 namespace crashpad { 166 namespace crashpad {
160 167
161 bool StringToNumber(const base::StringPiece& string, int* number) { 168 bool StringToNumber(const base::StringPiece& string, int* number) {
162 return StringToIntegerInternal<StringToIntTraits>(string, number); 169 return StringToIntegerInternal<StringToIntTraits>(string, number);
163 } 170 }
164 171
165 bool StringToNumber(const base::StringPiece& string, unsigned int* number) { 172 bool StringToNumber(const base::StringPiece& string, unsigned int* number) {
166 return StringToIntegerInternal<StringToUnsignedIntTraits>(string, number); 173 return StringToIntegerInternal<StringToUnsignedIntTraits>(string, number);
167 } 174 }
168 175
176 bool StringToNumber(const base::StringPiece& string, int64_t* number) {
177 return StringToIntegerInternal<StringToInt64Traits>(string, number);
178 }
179
169 bool StringToNumber(const base::StringPiece& string, uint64_t* number) { 180 bool StringToNumber(const base::StringPiece& string, uint64_t* number) {
170 return StringToIntegerInternal<StringToUnsignedInt64Traits>(string, number); 181 return StringToIntegerInternal<StringToUnsignedInt64Traits>(string, number);
171 } 182 }
172 183
173 } // namespace crashpad 184 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698