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

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

Issue 2926713007: Delete unused method FilesystemInterface::GetFileTime. (Closed)
Patch Set: Rebased. Created 3 years, 6 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/unixfilesystem.h ('k') | webrtc/base/win32filesystem.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 bool UnixFilesystem::GetFileSize(const Pathname& pathname, size_t *size) { 213 bool UnixFilesystem::GetFileSize(const Pathname& pathname, size_t *size) {
214 struct stat st; 214 struct stat st;
215 if (::stat(pathname.pathname().c_str(), &st) != 0) 215 if (::stat(pathname.pathname().c_str(), &st) != 0)
216 return false; 216 return false;
217 *size = st.st_size; 217 *size = st.st_size;
218 return true; 218 return true;
219 } 219 }
220 220
221 bool UnixFilesystem::GetFileTime(const Pathname& path, FileTimeType which,
222 time_t* time) {
223 struct stat st;
224 if (::stat(path.pathname().c_str(), &st) != 0)
225 return false;
226 switch (which) {
227 case FTT_CREATED:
228 *time = st.st_ctime;
229 break;
230 case FTT_MODIFIED:
231 *time = st.st_mtime;
232 break;
233 case FTT_ACCESSED:
234 *time = st.st_atime;
235 break;
236 default:
237 return false;
238 }
239 return true;
240 }
241
242 char* UnixFilesystem::CopyString(const std::string& str) { 221 char* UnixFilesystem::CopyString(const std::string& str) {
243 size_t size = str.length() + 1; 222 size_t size = str.length() + 1;
244 223
245 char* buf = new char[size]; 224 char* buf = new char[size];
246 if (!buf) { 225 if (!buf) {
247 return nullptr; 226 return nullptr;
248 } 227 }
249 228
250 strcpyn(buf, size, str.c_str()); 229 strcpyn(buf, size, str.c_str());
251 return buf; 230 return buf;
252 } 231 }
253 232
254 } // namespace rtc 233 } // namespace rtc
255 234
256 #if defined(__native_client__) 235 #if defined(__native_client__)
257 extern "C" int __attribute__((weak)) 236 extern "C" int __attribute__((weak))
258 link(const char* oldpath, const char* newpath) { 237 link(const char* oldpath, const char* newpath) {
259 errno = EACCES; 238 errno = EACCES;
260 return -1; 239 return -1;
261 } 240 }
262 #endif 241 #endif
OLDNEW
« no previous file with comments | « webrtc/base/unixfilesystem.h ('k') | webrtc/base/win32filesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698