Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/DefaultWebRequestWinInet.cpp

Issue 29361644: Issue 769 - replace auto_ptr by unique_ptr and use proper delete[] operator (Closed)
Patch Set: Created Nov. 3, 2016, 1:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
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 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 res = WinHttpReceiveResponse(hRequest, 0); 303 res = WinHttpReceiveResponse(hRequest, 0);
304 if (!res) 304 if (!res)
305 { 305 {
306 result.status = WindowsErrorToGeckoError(GetLastError()); 306 result.status = WindowsErrorToGeckoError(GetLastError());
307 return result; 307 return result;
308 } 308 }
309 309
310 ParseResponseHeaders(hRequest, &result); 310 ParseResponseHeaders(hRequest, &result);
311 311
312 std::auto_ptr<char> outBuffer; 312 std::unique_ptr<char[]> outBuffer;
313 DWORD downloadSize, downloaded; 313 DWORD downloadSize, downloaded;
314 314
315 // Download the actual response 315 // Download the actual response
316 // Keep checking for data until there is nothing left. 316 // Keep checking for data until there is nothing left.
317 do 317 do
318 { 318 {
319 // Check for available data. 319 // Check for available data.
320 downloadSize = 0; 320 downloadSize = 0;
321 if (!WinHttpQueryDataAvailable(hRequest, &downloadSize)) 321 if (!WinHttpQueryDataAvailable(hRequest, &downloadSize))
322 { 322 {
(...skipping 14 matching lines...) Expand all
337 ZeroMemory(outBuffer.get(), downloadSize+1); 337 ZeroMemory(outBuffer.get(), downloadSize+1);
338 338
339 if (WinHttpReadData(hRequest, outBuffer.get(), downloadSize, &downloaded)) 339 if (WinHttpReadData(hRequest, outBuffer.get(), downloadSize, &downloaded))
340 { 340 {
341 result.responseText.append(outBuffer.get(), downloaded); 341 result.responseText.append(outBuffer.get(), downloaded);
342 } 342 }
343 } 343 }
344 } while (downloadSize > 0); 344 } while (downloadSize > 0);
345 return result; 345 return result;
346 } 346 }
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