OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/quic/quic_utils.h" | 5 #include "net/quic/quic_utils.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 RETURN_STRING_LITERAL(ALL_UNACKED_RETRANSMISSION); | 252 RETURN_STRING_LITERAL(ALL_UNACKED_RETRANSMISSION); |
253 RETURN_STRING_LITERAL(ALL_INITIAL_RETRANSMISSION); | 253 RETURN_STRING_LITERAL(ALL_INITIAL_RETRANSMISSION); |
254 RETURN_STRING_LITERAL(RTO_RETRANSMISSION); | 254 RETURN_STRING_LITERAL(RTO_RETRANSMISSION); |
255 RETURN_STRING_LITERAL(TLP_RETRANSMISSION); | 255 RETURN_STRING_LITERAL(TLP_RETRANSMISSION); |
256 } | 256 } |
257 return "INVALID_TRANSMISSION_TYPE"; | 257 return "INVALID_TRANSMISSION_TYPE"; |
258 } | 258 } |
259 | 259 |
260 // static | 260 // static |
261 string QuicUtils::TagToString(QuicTag tag) { | 261 string QuicUtils::TagToString(QuicTag tag) { |
262 char chars[4]; | 262 char chars[sizeof tag]; |
263 bool ascii = true; | 263 bool ascii = true; |
264 const QuicTag orig_tag = tag; | 264 const QuicTag orig_tag = tag; |
265 | 265 |
266 for (size_t i = 0; i < sizeof(chars); i++) { | 266 for (size_t i = 0; i < arraysize(chars); i++) { |
267 chars[i] = tag; | 267 chars[i] = static_cast<char>(tag); |
268 if ((chars[i] == 0 || chars[i] == '\xff') && i == 3) { | 268 if ((chars[i] == 0 || chars[i] == '\xff') && i == arraysize(chars) - 1) { |
269 chars[i] = ' '; | 269 chars[i] = ' '; |
270 } | 270 } |
271 if (!isprint(static_cast<unsigned char>(chars[i]))) { | 271 if (!isprint(static_cast<unsigned char>(chars[i]))) { |
272 ascii = false; | 272 ascii = false; |
273 break; | 273 break; |
274 } | 274 } |
275 tag >>= 8; | 275 tag >>= 8; |
276 } | 276 } |
277 | 277 |
278 if (ascii) { | 278 if (ascii) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 QuicPriority QuicUtils::LowestPriority() { | 337 QuicPriority QuicUtils::LowestPriority() { |
338 return QuicWriteBlockedList::kLowestPriority; | 338 return QuicWriteBlockedList::kLowestPriority; |
339 } | 339 } |
340 | 340 |
341 // static | 341 // static |
342 QuicPriority QuicUtils::HighestPriority() { | 342 QuicPriority QuicUtils::HighestPriority() { |
343 return QuicWriteBlockedList::kHighestPriority; | 343 return QuicWriteBlockedList::kHighestPriority; |
344 } | 344 } |
345 | 345 |
346 } // namespace net | 346 } // namespace net |
OLD | NEW |