OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome_frame/utils.h" | 5 #include "chrome_frame/utils.h" |
6 | 6 |
7 #include <atlsafe.h> | 7 #include <atlsafe.h> |
8 #include <atlsecurity.h> | 8 #include <atlsecurity.h> |
9 #include <htiframe.h> | 9 #include <htiframe.h> |
10 #include <mshtml.h> | 10 #include <mshtml.h> |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 | 1321 |
1322 if (flags) | 1322 if (flags) |
1323 s += base::StringPrintf("+UnDoc[%#x]", flags); | 1323 s += base::StringPrintf("+UnDoc[%#x]", flags); |
1324 return s; | 1324 return s; |
1325 #undef ADD_BSCF_FLAG | 1325 #undef ADD_BSCF_FLAG |
1326 } | 1326 } |
1327 | 1327 |
1328 // Reads data from a stream into a string. | 1328 // Reads data from a stream into a string. |
1329 HRESULT ReadStream(IStream* stream, size_t size, std::string* data) { | 1329 HRESULT ReadStream(IStream* stream, size_t size, std::string* data) { |
1330 DCHECK(stream); | 1330 DCHECK(stream); |
| 1331 DCHECK_GT(size, 0u); |
1331 DCHECK(data); | 1332 DCHECK(data); |
1332 | 1333 |
1333 DWORD read = 0; | 1334 DWORD read = 0; |
1334 HRESULT hr = stream->Read(WriteInto(data, size + 1), size, &read); | 1335 HRESULT hr = stream->Read(WriteInto(data, size + 1), size, &read); |
1335 DCHECK(hr == S_OK || hr == S_FALSE || hr == E_PENDING); | 1336 DCHECK(hr == S_OK || hr == S_FALSE || hr == E_PENDING); |
1336 if (read) { | 1337 if (read) { |
1337 data->erase(read); | 1338 data->erase(read); |
1338 DCHECK_EQ(read, data->length()); | 1339 DCHECK_EQ(read, data->length()); |
1339 } else { | 1340 } else { |
1340 data->clear(); | 1341 data->clear(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 ret = InternetSetOption(NULL, connection_options[option_index], | 1634 ret = InternetSetOption(NULL, connection_options[option_index], |
1634 &connections, connection_value_size); | 1635 &connections, connection_value_size); |
1635 if (!ret) { | 1636 if (!ret) { |
1636 return false; | 1637 return false; |
1637 } | 1638 } |
1638 } | 1639 } |
1639 wininet_connection_count_updated = true; | 1640 wininet_connection_count_updated = true; |
1640 return true; | 1641 return true; |
1641 } | 1642 } |
1642 | 1643 |
OLD | NEW |