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

Side by Side Diff: net/http/http_auth_handler_ntlm_portable.cc

Issue 2912443002: Remove unwanted temp variable (Closed)
Patch Set: Created 3 years, 7 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 // 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/http/http_auth_handler_ntlm.h" 5 #include "net/http/http_auth_handler_ntlm.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 // For gethostname 8 // For gethostname
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 * convert the unicode buffer to little-endian on big-endian platforms. 213 * convert the unicode buffer to little-endian on big-endian platforms.
214 */ 214 */
215 static void* WriteUnicodeLE(void* buf, 215 static void* WriteUnicodeLE(void* buf,
216 const base::char16* str, 216 const base::char16* str,
217 uint32_t str_len) { 217 uint32_t str_len) {
218 // Convert input string from BE to LE. 218 // Convert input string from BE to LE.
219 uint8_t* cursor = static_cast<uint8_t*>(buf); 219 uint8_t* cursor = static_cast<uint8_t*>(buf);
220 const uint8_t* input = reinterpret_cast<const uint8_t*>(str); 220 const uint8_t* input = reinterpret_cast<const uint8_t*>(str);
221 for (uint32_t i = 0; i < str_len; ++i, input += 2, cursor += 2) { 221 for (uint32_t i = 0; i < str_len; ++i, input += 2, cursor += 2) {
222 // Allow for the case where |buf == str|. 222 // Allow for the case where |buf == str|.
223 uint8_t temp = input[0];
224 cursor[0] = input[1]; 223 cursor[0] = input[1];
225 cursor[1] = temp; 224 cursor[1] = input[0];
226 } 225 }
227 return buf; 226 return buf;
228 } 227 }
229 #endif 228 #endif
230 229
231 static uint16_t ReadUint16(const uint8_t*& buf) { 230 static uint16_t ReadUint16(const uint8_t*& buf) {
232 uint16_t x = 231 uint16_t x =
233 (static_cast<uint16_t>(buf[0])) | (static_cast<uint16_t>(buf[1]) << 8); 232 (static_cast<uint16_t>(buf[0])) | (static_cast<uint16_t>(buf[1]) << 8);
234 buf += sizeof(x); 233 buf += sizeof(x);
235 return x; 234 return x;
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // of NTLM. 720 // of NTLM.
722 std::unique_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); 721 std::unique_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM);
723 if (!tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin, 722 if (!tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin,
724 net_log)) 723 net_log))
725 return ERR_INVALID_RESPONSE; 724 return ERR_INVALID_RESPONSE;
726 handler->swap(tmp_handler); 725 handler->swap(tmp_handler);
727 return OK; 726 return OK;
728 } 727 }
729 728
730 } // namespace net 729 } // namespace net
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