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

Side by Side Diff: webrtc/base/macutils.cc

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 7 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 | « webrtc/base/macsocketserver_unittest.cc ('k') | webrtc/base/messagedigest.cc » ('j') | 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 * Copyright 2007 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory>
11 #include <sstream> 12 #include <sstream>
12 13
13 #include "webrtc/base/common.h" 14 #include "webrtc/base/common.h"
14 #include "webrtc/base/logging.h" 15 #include "webrtc/base/logging.h"
15 #include "webrtc/base/macutils.h" 16 #include "webrtc/base/macutils.h"
16 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/base/stringutils.h" 17 #include "webrtc/base/stringutils.h"
18 18
19 namespace rtc { 19 namespace rtc {
20 20
21 /////////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////////
22 22
23 bool ToUtf8(const CFStringRef str16, std::string* str8) { 23 bool ToUtf8(const CFStringRef str16, std::string* str8) {
24 if ((NULL == str16) || (NULL == str8)) { 24 if ((NULL == str16) || (NULL == str8)) {
25 return false; 25 return false;
26 } 26 }
27 size_t maxlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str16), 27 size_t maxlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str16),
28 kCFStringEncodingUTF8) + 1; 28 kCFStringEncodingUTF8) + 1;
29 scoped_ptr<char[]> buffer(new char[maxlen]); 29 std::unique_ptr<char[]> buffer(new char[maxlen]);
30 if (!buffer || !CFStringGetCString(str16, buffer.get(), maxlen, 30 if (!buffer || !CFStringGetCString(str16, buffer.get(), maxlen,
31 kCFStringEncodingUTF8)) { 31 kCFStringEncodingUTF8)) {
32 return false; 32 return false;
33 } 33 }
34 str8->assign(buffer.get()); 34 str8->assign(buffer.get());
35 return true; 35 return true;
36 } 36 }
37 37
38 bool ToUtf16(const std::string& str8, CFStringRef* str16) { 38 bool ToUtf16(const std::string& str8, CFStringRef* str16) {
39 if (NULL == str16) { 39 if (NULL == str16) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 #else 212 #else
213 // TODO(thaloun): Support applescripts with the NSAppleScript API. 213 // TODO(thaloun): Support applescripts with the NSAppleScript API.
214 return false; 214 return false;
215 #endif // CARBON_DEPRECATED 215 #endif // CARBON_DEPRECATED
216 } 216 }
217 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) 217 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
218 218
219 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
220 220
221 } // namespace rtc 221 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/macsocketserver_unittest.cc ('k') | webrtc/base/messagedigest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698