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 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 // static | 225 // static |
226 string QuicUtils::TagToString(QuicTag tag) { | 226 string QuicUtils::TagToString(QuicTag tag) { |
227 char chars[4]; | 227 char chars[4]; |
228 bool ascii = true; | 228 bool ascii = true; |
229 const QuicTag orig_tag = tag; | 229 const QuicTag orig_tag = tag; |
230 | 230 |
231 for (size_t i = 0; i < sizeof(chars); i++) { | 231 for (size_t i = 0; i < sizeof(chars); i++) { |
232 chars[i] = tag; | 232 chars[i] = tag; |
233 if (chars[i] == 0 && i == 3) { | 233 if ((chars[i] == 0 || chars[i] == '\xff') && i == 3) { |
234 chars[i] = ' '; | 234 chars[i] = ' '; |
235 } | 235 } |
236 if (!isprint(static_cast<unsigned char>(chars[i]))) { | 236 if (!isprint(static_cast<unsigned char>(chars[i]))) { |
237 ascii = false; | 237 ascii = false; |
238 break; | 238 break; |
239 } | 239 } |
240 tag >>= 8; | 240 tag >>= 8; |
241 } | 241 } |
242 | 242 |
243 if (ascii) { | 243 if (ascii) { |
(...skipping 29 matching lines...) Expand all Loading... |
273 | 273 |
274 bytes_remaining -= line_bytes; | 274 bytes_remaining -= line_bytes; |
275 offset += line_bytes; | 275 offset += line_bytes; |
276 p += line_bytes; | 276 p += line_bytes; |
277 s += '\n'; | 277 s += '\n'; |
278 } | 278 } |
279 return s; | 279 return s; |
280 } | 280 } |
281 | 281 |
282 } // namespace net | 282 } // namespace net |
OLD | NEW |