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

Side by Side Diff: third_party/WebKit/Source/wtf/HexNumber.h

Issue 2622363005: Migrate WTF::Vector::append() to ::push_back() in WTF::HexNumber (Closed)
Patch Set: jsbell's variation Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 2 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 27 matching lines...) Expand all
38 38
39 template <typename T> 39 template <typename T>
40 inline void appendByteAsHex(unsigned char byte, 40 inline void appendByteAsHex(unsigned char byte,
41 T& destination, 41 T& destination,
42 HexConversionMode mode = Uppercase) { 42 HexConversionMode mode = Uppercase) {
43 const LChar* hexDigits = Internal::hexDigitsForMode(mode); 43 const LChar* hexDigits = Internal::hexDigitsForMode(mode);
44 destination.append(hexDigits[byte >> 4]); 44 destination.append(hexDigits[byte >> 4]);
45 destination.append(hexDigits[byte & 0xF]); 45 destination.append(hexDigits[byte & 0xF]);
46 } 46 }
47 47
48 template <>
49 inline void appendByteAsHex<Vector<LChar>>(unsigned char byte,
50 Vector<LChar>& destination,
51 HexConversionMode mode = Uppercase) {
jsbell 2017/01/12 23:35:26 This should be just `HexConversionMode mode` (i.e.
52 const LChar* hexDigits = Internal::hexDigitsForMode(mode);
53 destination.push_back(hexDigits[byte >> 4]);
54 destination.push_back(hexDigits[byte & 0xF]);
55 }
56
48 template <typename T> 57 template <typename T>
49 inline void appendUnsignedAsHex(unsigned number, 58 inline void appendUnsignedAsHex(unsigned number,
50 T& destination, 59 T& destination,
51 HexConversionMode mode = Uppercase) { 60 HexConversionMode mode = Uppercase) {
52 const LChar* hexDigits = Internal::hexDigitsForMode(mode); 61 const LChar* hexDigits = Internal::hexDigitsForMode(mode);
53 Vector<LChar, 8> result; 62 Vector<LChar, 8> result;
54 do { 63 do {
55 result.prepend(hexDigits[number % 16]); 64 result.prepend(hexDigits[number % 16]);
56 number >>= 4; 65 number >>= 4;
57 } while (number > 0); 66 } while (number > 0);
(...skipping 22 matching lines...) Expand all
80 } 89 }
81 90
82 } // namespace WTF 91 } // namespace WTF
83 92
84 using WTF::appendByteAsHex; 93 using WTF::appendByteAsHex;
85 using WTF::appendUnsignedAsHex; 94 using WTF::appendUnsignedAsHex;
86 using WTF::appendUnsignedAsHexFixedSize; 95 using WTF::appendUnsignedAsHexFixedSize;
87 using WTF::Lowercase; 96 using WTF::Lowercase;
88 97
89 #endif // HexNumber_h 98 #endif // HexNumber_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698