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

Side by Side Diff: base/win/scoped_variant.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « base/win/scoped_comptr_unittest.cc ('k') | base/win/shortcut.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/win/scoped_variant.h" 5 #include "base/win/scoped_variant.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 namespace base { 8 namespace base {
9 namespace win { 9 namespace win {
10 10
11 // Global, const instance of an empty variant. 11 // Global, const instance of an empty variant.
12 const VARIANT ScopedVariant::kEmptyVariant = { VT_EMPTY }; 12 const VARIANT ScopedVariant::kEmptyVariant = {{{VT_EMPTY}}};
13 13
14 ScopedVariant::~ScopedVariant() { 14 ScopedVariant::~ScopedVariant() {
15 COMPILE_ASSERT(sizeof(ScopedVariant) == sizeof(VARIANT), ScopedVariantSize); 15 COMPILE_ASSERT(sizeof(ScopedVariant) == sizeof(VARIANT), ScopedVariantSize);
16 ::VariantClear(&var_); 16 ::VariantClear(&var_);
17 } 17 }
18 18
19 ScopedVariant::ScopedVariant(const wchar_t* str) { 19 ScopedVariant::ScopedVariant(const wchar_t* str) {
20 var_.vt = VT_EMPTY; 20 var_.vt = VT_EMPTY;
21 Set(str); 21 Set(str);
22 } 22 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 var_ = var.var_; 75 var_ = var.var_;
76 var.var_ = tmp; 76 var.var_ = tmp;
77 } 77 }
78 78
79 VARIANT* ScopedVariant::Receive() { 79 VARIANT* ScopedVariant::Receive() {
80 DCHECK(!IsLeakableVarType(var_.vt)) << "variant leak. type: " << var_.vt; 80 DCHECK(!IsLeakableVarType(var_.vt)) << "variant leak. type: " << var_.vt;
81 return &var_; 81 return &var_;
82 } 82 }
83 83
84 VARIANT ScopedVariant::Copy() const { 84 VARIANT ScopedVariant::Copy() const {
85 VARIANT ret = { VT_EMPTY }; 85 VARIANT ret = {{{VT_EMPTY}}};
86 ::VariantCopy(&ret, &var_); 86 ::VariantCopy(&ret, &var_);
87 return ret; 87 return ret;
88 } 88 }
89 89
90 int ScopedVariant::Compare(const VARIANT& var, bool ignore_case) const { 90 int ScopedVariant::Compare(const VARIANT& var, bool ignore_case) const {
91 ULONG flags = ignore_case ? NORM_IGNORECASE : 0; 91 ULONG flags = ignore_case ? NORM_IGNORECASE : 0;
92 HRESULT hr = ::VarCmp(const_cast<VARIANT*>(&var_), const_cast<VARIANT*>(&var), 92 HRESULT hr = ::VarCmp(const_cast<VARIANT*>(&var_), const_cast<VARIANT*>(&var),
93 LOCALE_USER_DEFAULT, flags); 93 LOCALE_USER_DEFAULT, flags);
94 int ret = 0; 94 int ret = 0;
95 95
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 if (!leakable && (vt & VT_ARRAY) != 0) { 268 if (!leakable && (vt & VT_ARRAY) != 0) {
269 leakable = true; 269 leakable = true;
270 } 270 }
271 271
272 return leakable; 272 return leakable;
273 } 273 }
274 274
275 } // namespace win 275 } // namespace win
276 } // namespace base 276 } // namespace base
OLDNEW
« no previous file with comments | « base/win/scoped_comptr_unittest.cc ('k') | base/win/shortcut.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698