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

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

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. 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 | « webrtc/base/win32filesystem.h ('k') | webrtc/base/win32socketserver.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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Directory doesn't exist, look up one directory level 54 // Directory doesn't exist, look up one directory level
55 if (!pathname.parent_folder().empty()) { 55 if (!pathname.parent_folder().empty()) {
56 Pathname parent(pathname); 56 Pathname parent(pathname);
57 parent.SetFolder(pathname.parent_folder()); 57 parent.SetFolder(pathname.parent_folder());
58 if (!CreateFolder(parent)) { 58 if (!CreateFolder(parent)) {
59 return false; 59 return false;
60 } 60 }
61 } 61 }
62 62
63 return (::CreateDirectory(path16.c_str(), NULL) != 0); 63 return (::CreateDirectory(path16.c_str(), nullptr) != 0);
64 } 64 }
65 65
66 FileStream *Win32Filesystem::OpenFile(const Pathname &filename, 66 FileStream *Win32Filesystem::OpenFile(const Pathname &filename,
67 const std::string &mode) { 67 const std::string &mode) {
68 FileStream *fs = new FileStream(); 68 FileStream *fs = new FileStream();
69 if (fs && !fs->Open(filename.pathname().c_str(), mode.c_str(), NULL)) { 69 if (fs && !fs->Open(filename.pathname().c_str(), mode.c_str(), nullptr)) {
70 delete fs; 70 delete fs;
71 fs = NULL; 71 fs = nullptr;
72 } 72 }
73 return fs; 73 return fs;
74 } 74 }
75 75
76 bool Win32Filesystem::DeleteFile(const Pathname &filename) { 76 bool Win32Filesystem::DeleteFile(const Pathname &filename) {
77 LOG(LS_INFO) << "Deleting file " << filename.pathname(); 77 LOG(LS_INFO) << "Deleting file " << filename.pathname();
78 if (!IsFile(filename)) { 78 if (!IsFile(filename)) {
79 RTC_DCHECK(IsFile(filename)); 79 RTC_DCHECK(IsFile(filename));
80 return false; 80 return false;
81 } 81 }
(...skipping 16 matching lines...) Expand all
98 !::GetLongPathName(buffer, buffer, arraysize(buffer))) 98 !::GetLongPathName(buffer, buffer, arraysize(buffer)))
99 return false; 99 return false;
100 size_t len = strlen(buffer); 100 size_t len = strlen(buffer);
101 if ((len > 0) && (buffer[len-1] != '\\')) { 101 if ((len > 0) && (buffer[len-1] != '\\')) {
102 len += strcpyn(buffer + len, arraysize(buffer) - len, L"\\"); 102 len += strcpyn(buffer + len, arraysize(buffer) - len, L"\\");
103 } 103 }
104 if (len >= arraysize(buffer) - 1) 104 if (len >= arraysize(buffer) - 1)
105 return false; 105 return false;
106 pathname.clear(); 106 pathname.clear();
107 pathname.SetFolder(ToUtf8(buffer)); 107 pathname.SetFolder(ToUtf8(buffer));
108 if (append != NULL) { 108 if (append != nullptr) {
109 RTC_DCHECK(!append->empty()); 109 RTC_DCHECK(!append->empty());
110 pathname.AppendFolder(*append); 110 pathname.AppendFolder(*append);
111 } 111 }
112 return !create || CreateFolder(pathname); 112 return !create || CreateFolder(pathname);
113 } 113 }
114 114
115 std::string Win32Filesystem::TempFilename(const Pathname &dir, 115 std::string Win32Filesystem::TempFilename(const Pathname &dir,
116 const std::string &prefix) { 116 const std::string &prefix) {
117 wchar_t filename[MAX_PATH]; 117 wchar_t filename[MAX_PATH];
118 if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(), 118 if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 FileTimeToUnixTime(data.ftLastAccessTime, time); 203 FileTimeToUnixTime(data.ftLastAccessTime, time);
204 break; 204 break;
205 default: 205 default:
206 return false; 206 return false;
207 } 207 }
208 return true; 208 return true;
209 } 209 }
210 210
211 bool Win32Filesystem::GetAppPathname(Pathname* path) { 211 bool Win32Filesystem::GetAppPathname(Pathname* path) {
212 TCHAR buffer[MAX_PATH + 1]; 212 TCHAR buffer[MAX_PATH + 1];
213 if (0 == ::GetModuleFileName(NULL, buffer, arraysize(buffer))) 213 if (0 == ::GetModuleFileName(nullptr, buffer, arraysize(buffer)))
214 return false; 214 return false;
215 path->SetPathname(ToUtf8(buffer)); 215 path->SetPathname(ToUtf8(buffer));
216 return true; 216 return true;
217 } 217 }
218 218
219 bool Win32Filesystem::GetAppTempFolder(Pathname* path) { 219 bool Win32Filesystem::GetAppTempFolder(Pathname* path) {
220 if (!GetAppPathname(path)) 220 if (!GetAppPathname(path))
221 return false; 221 return false;
222 std::string filename(path->filename()); 222 std::string filename(path->filename());
223 return GetTemporaryFolder(*path, true, &filename); 223 return GetTemporaryFolder(*path, true, &filename);
224 } 224 }
225 225
226 } // namespace rtc 226 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32filesystem.h ('k') | webrtc/base/win32socketserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698