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

Unified Diff: base/win/scoped_bstr.cc

Issue 3781009: Move the windows-specific scoped_* stuff from base to base/win and in the bas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: base/win/scoped_bstr.cc
===================================================================
--- base/win/scoped_bstr.cc (revision 62694)
+++ base/win/scoped_bstr.cc (working copy)
@@ -1,13 +1,15 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/scoped_bstr_win.h"
+#include "base/win/scoped_bstr.h"
#include "base/logging.h"
+namespace base {
+namespace win {
-ScopedBstr::ScopedBstr(const wchar_t* non_bstr)
+ScopedBstr::ScopedBstr(const char16* non_bstr)
: bstr_(SysAllocString(non_bstr)) {
}
@@ -41,26 +43,29 @@
return &bstr_;
}
-BSTR ScopedBstr::Allocate(const wchar_t* wide_str) {
- Reset(SysAllocString(wide_str));
+BSTR ScopedBstr::Allocate(const char16* str) {
+ Reset(SysAllocString(str));
return bstr_;
}
-BSTR ScopedBstr::AllocateBytes(int bytes) {
+BSTR ScopedBstr::AllocateBytes(size_t bytes) {
Reset(SysAllocStringByteLen(NULL, bytes));
return bstr_;
}
-void ScopedBstr::SetByteLen(uint32 bytes) {
+void ScopedBstr::SetByteLen(size_t bytes) {
DCHECK(bstr_ != NULL) << "attempting to modify a NULL bstr";
uint32* data = reinterpret_cast<uint32*>(bstr_);
data[-1] = bytes;
}
-uint32 ScopedBstr::Length() const {
+size_t ScopedBstr::Length() const {
return SysStringLen(bstr_);
}
-uint32 ScopedBstr::ByteLength() const {
+size_t ScopedBstr::ByteLength() const {
return SysStringByteLen(bstr_);
}
+
+} // namespace win
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698