OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tools/balsa/balsa_frame.h" | 5 #include "net/tools/balsa/balsa_frame.h" |
6 | 6 |
7 // Visual C++ defines _M_IX86_FP as 2 if the /arch:SSE2 compiler option is | 7 // Visual C++ defines _M_IX86_FP as 2 if the /arch:SSE2 compiler option is |
8 // specified. | 8 // specified. |
9 #if !defined(__SSE2__) && _M_IX86_FP == 2 | 9 #if !defined(__SSE2__) && _M_IX86_FP == 2 |
10 #define __SSE2__ 1 | 10 #define __SSE2__ 1 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // Note that this allows for the conversion of response codes which | 398 // Note that this allows for the conversion of response codes which |
399 // are outside the bounds of normal HTTP response codes (no checking | 399 // are outside the bounds of normal HTTP response codes (no checking |
400 // is done to ensure that these are valid-- they're merely parsed)! | 400 // is done to ensure that these are valid-- they're merely parsed)! |
401 while (parsed_response_code_current < parsed_response_code_end) { | 401 while (parsed_response_code_current < parsed_response_code_end) { |
402 if (*parsed_response_code_current < '0' || | 402 if (*parsed_response_code_current < '0' || |
403 *parsed_response_code_current > '9') { | 403 *parsed_response_code_current > '9') { |
404 *error_code = BalsaFrameEnums::FAILED_CONVERTING_STATUS_CODE_TO_INT; | 404 *error_code = BalsaFrameEnums::FAILED_CONVERTING_STATUS_CODE_TO_INT; |
405 return false; | 405 return false; |
406 } | 406 } |
407 size_t status_code_x_10 = headers->parsed_response_code_ * 10; | 407 size_t status_code_x_10 = headers->parsed_response_code_ * 10; |
408 uint8 c = *parsed_response_code_current - '0'; | 408 uint8_t c = *parsed_response_code_current - '0'; |
409 if ((headers->parsed_response_code_ > kMaxDiv10) || | 409 if ((headers->parsed_response_code_ > kMaxDiv10) || |
410 (std::numeric_limits<size_t>::max() - status_code_x_10) < c) { | 410 (std::numeric_limits<size_t>::max() - status_code_x_10) < c) { |
411 // overflow. | 411 // overflow. |
412 *error_code = BalsaFrameEnums::FAILED_CONVERTING_STATUS_CODE_TO_INT; | 412 *error_code = BalsaFrameEnums::FAILED_CONVERTING_STATUS_CODE_TO_INT; |
413 return false; | 413 return false; |
414 } | 414 } |
415 headers->parsed_response_code_ = status_code_x_10 + c; | 415 headers->parsed_response_code_ = status_code_x_10 + c; |
416 ++parsed_response_code_current; | 416 ++parsed_response_code_current; |
417 } | 417 } |
418 } | 418 } |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 << "$$$$$$$$$$$$$$$" | 1567 << "$$$$$$$$$$$$$$$" |
1568 << " consumed: " << (current - input); | 1568 << " consumed: " << (current - input); |
1569 if (Error()) { | 1569 if (Error()) { |
1570 LOG(INFO) << BalsaFrameEnums::ErrorCodeToString(ErrorCode()); | 1570 LOG(INFO) << BalsaFrameEnums::ErrorCodeToString(ErrorCode()); |
1571 } | 1571 } |
1572 #endif // DEBUGFRAMER | 1572 #endif // DEBUGFRAMER |
1573 return current - input; | 1573 return current - input; |
1574 } | 1574 } |
1575 | 1575 |
1576 } // namespace net | 1576 } // namespace net |
OLD | NEW |