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

Side by Side Diff: chrome/install_static/install_util.cc

Issue 2727593003: Fix incorrect use of unique_ptr found by PVS-Studio (Closed)
Patch Set: Created 3 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/install_static/install_util.h" 5 #include "chrome/install_static/install_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <assert.h> 8 #include <assert.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 assert(channel_name); 490 assert(channel_name);
491 491
492 // Default values in case we don't find a version resource. 492 // Default values in case we don't find a version resource.
493 *product_name = L"Chrome"; 493 *product_name = L"Chrome";
494 *version = L"0.0.0.0-devel"; 494 *version = L"0.0.0.0-devel";
495 special_build->clear(); 495 special_build->clear();
496 496
497 DWORD dummy = 0; 497 DWORD dummy = 0;
498 DWORD length = ::GetFileVersionInfoSize(exe_path.c_str(), &dummy); 498 DWORD length = ::GetFileVersionInfoSize(exe_path.c_str(), &dummy);
499 if (length) { 499 if (length) {
500 std::unique_ptr<char> data(new char[length]); 500 std::unique_ptr<char[]> data(new char[length]);
501 if (::GetFileVersionInfo(exe_path.c_str(), dummy, length, data.get())) { 501 if (::GetFileVersionInfo(exe_path.c_str(), dummy, length, data.get())) {
502 GetValueFromVersionResource(data.get(), L"ProductVersion", version); 502 GetValueFromVersionResource(data.get(), L"ProductVersion", version);
503 503
504 std::wstring official_build; 504 std::wstring official_build;
505 GetValueFromVersionResource(data.get(), L"Official Build", 505 GetValueFromVersionResource(data.get(), L"Official Build",
506 &official_build); 506 &official_build);
507 if (official_build != L"1") 507 if (official_build != L"1")
508 version->append(L"-devel"); 508 version->append(L"-devel");
509 GetValueFromVersionResource(data.get(), L"ProductShortName", 509 GetValueFromVersionResource(data.get(), L"ProductShortName",
510 product_name); 510 product_name);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 case ChannelStrategy::ADDITIONAL_PARAMETERS: 754 case ChannelStrategy::ADDITIONAL_PARAMETERS:
755 return ChannelFromAdditionalParameters(mode, system_level, from_binaries); 755 return ChannelFromAdditionalParameters(mode, system_level, from_binaries);
756 case ChannelStrategy::FIXED: 756 case ChannelStrategy::FIXED:
757 return mode.default_channel_name; 757 return mode.default_channel_name;
758 } 758 }
759 759
760 return std::wstring(); 760 return std::wstring();
761 } 761 }
762 762
763 } // namespace install_static 763 } // namespace install_static
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