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

Side by Side Diff: remoting/base/util.cc

Issue 13642007: Rewrite scoped_array<T> to scoped_ptr<T[]> in remoting/, Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Manually rewrite Win files. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « remoting/base/compound_buffer_unittest.cc ('k') | remoting/base/util_unittest.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/base/util.h" 5 #include "remoting/base/util.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 316
317 return true; 317 return true;
318 } 318 }
319 319
320 std::string GetUsername() { 320 std::string GetUsername() {
321 #if defined(OS_POSIX) 321 #if defined(OS_POSIX)
322 long buf_size = sysconf(_SC_GETPW_R_SIZE_MAX); 322 long buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
323 if (buf_size <= 0) 323 if (buf_size <= 0)
324 return std::string(); 324 return std::string();
325 scoped_array<char> buf(new char[buf_size]); 325 scoped_ptr<char[]> buf(new char[buf_size]);
326 struct passwd passwd; 326 struct passwd passwd;
327 struct passwd* passwd_result = NULL; 327 struct passwd* passwd_result = NULL;
328 getpwuid_r(getuid(), &passwd, buf.get(), buf_size, &passwd_result); 328 getpwuid_r(getuid(), &passwd, buf.get(), buf_size, &passwd_result);
329 if (!passwd_result) 329 if (!passwd_result)
330 return std::string(); 330 return std::string();
331 return std::string(passwd_result->pw_name); 331 return std::string(passwd_result->pw_name);
332 #else // !defined(OS_POSIX) 332 #else // !defined(OS_POSIX)
333 return std::string(); 333 return std::string();
334 #endif // defined(OS_POSIX) 334 #endif // defined(OS_POSIX)
335 } 335 }
336 336
337 } // namespace remoting 337 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/compound_buffer_unittest.cc ('k') | remoting/base/util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698