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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/win32filesystem.h ('k') | webrtc/base/win32regkey.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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 bool Win32Filesystem::GetAppTempFolder(Pathname* path) { 374 bool Win32Filesystem::GetAppTempFolder(Pathname* path) {
375 if (!GetAppPathname(path)) 375 if (!GetAppPathname(path))
376 return false; 376 return false;
377 std::string filename(path->filename()); 377 std::string filename(path->filename());
378 return GetTemporaryFolder(*path, true, &filename); 378 return GetTemporaryFolder(*path, true, &filename);
379 } 379 }
380 380
381 bool Win32Filesystem::GetDiskFreeSpace(const Pathname& path, 381 bool Win32Filesystem::GetDiskFreeSpace(const Pathname& path,
382 int64 *free_bytes) { 382 int64_t* free_bytes) {
383 if (!free_bytes) { 383 if (!free_bytes) {
384 return false; 384 return false;
385 } 385 }
386 char drive[4]; 386 char drive[4];
387 std::wstring drive16; 387 std::wstring drive16;
388 const wchar_t* target_drive = NULL; 388 const wchar_t* target_drive = NULL;
389 if (path.GetDrive(drive, sizeof(drive))) { 389 if (path.GetDrive(drive, sizeof(drive))) {
390 drive16 = ToUtf16(drive); 390 drive16 = ToUtf16(drive);
391 target_drive = drive16.c_str(); 391 target_drive = drive16.c_str();
392 } else if (path.folder().substr(0, 2) == "\\\\") { 392 } else if (path.folder().substr(0, 2) == "\\\\") {
393 // UNC path, fail. 393 // UNC path, fail.
394 // TODO: Handle UNC paths. 394 // TODO: Handle UNC paths.
395 return false; 395 return false;
396 } else { 396 } else {
397 // The path is probably relative. GetDriveType and GetDiskFreeSpaceEx 397 // The path is probably relative. GetDriveType and GetDiskFreeSpaceEx
398 // use the current drive if NULL is passed as the drive name. 398 // use the current drive if NULL is passed as the drive name.
399 // TODO: Add method to Pathname to determine if the path is relative. 399 // TODO: Add method to Pathname to determine if the path is relative.
400 // TODO: Add method to Pathname to convert a path to absolute. 400 // TODO: Add method to Pathname to convert a path to absolute.
401 } 401 }
402 UINT drive_type = ::GetDriveType(target_drive); 402 UINT drive_type = ::GetDriveType(target_drive);
403 if ((drive_type == DRIVE_REMOTE) || (drive_type == DRIVE_UNKNOWN)) { 403 if ((drive_type == DRIVE_REMOTE) || (drive_type == DRIVE_UNKNOWN)) {
404 LOG(LS_VERBOSE) << "Remote or unknown drive: " << drive; 404 LOG(LS_VERBOSE) << "Remote or unknown drive: " << drive;
405 return false; 405 return false;
406 } 406 }
407 407
408 int64 total_number_of_bytes; // receives the number of bytes on disk 408 int64_t total_number_of_bytes; // receives the number of bytes on disk
409 int64 total_number_of_free_bytes; // receives the free bytes on disk 409 int64_t total_number_of_free_bytes; // receives the free bytes on disk
410 // make sure things won't change in 64 bit machine 410 // make sure things won't change in 64 bit machine
411 // TODO replace with compile time assert 411 // TODO replace with compile time assert
412 ASSERT(sizeof(ULARGE_INTEGER) == sizeof(uint64)); //NOLINT 412 ASSERT(sizeof(ULARGE_INTEGER) == sizeof(uint64_t)); // NOLINT
413 if (::GetDiskFreeSpaceEx(target_drive, 413 if (::GetDiskFreeSpaceEx(target_drive,
414 (PULARGE_INTEGER)free_bytes, 414 (PULARGE_INTEGER)free_bytes,
415 (PULARGE_INTEGER)&total_number_of_bytes, 415 (PULARGE_INTEGER)&total_number_of_bytes,
416 (PULARGE_INTEGER)&total_number_of_free_bytes)) { 416 (PULARGE_INTEGER)&total_number_of_free_bytes)) {
417 return true; 417 return true;
418 } else { 418 } else {
419 LOG(LS_VERBOSE) << "GetDiskFreeSpaceEx returns error."; 419 LOG(LS_VERBOSE) << "GetDiskFreeSpaceEx returns error.";
420 return false; 420 return false;
421 } 421 }
422 } 422 }
(...skipping 29 matching lines...) Expand all
452 temp_path16.append(1, '\0'); 452 temp_path16.append(1, '\0');
453 453
454 SHFILEOPSTRUCT file_op = { 0 }; 454 SHFILEOPSTRUCT file_op = { 0 };
455 file_op.wFunc = FO_DELETE; 455 file_op.wFunc = FO_DELETE;
456 file_op.pFrom = temp_path16.c_str(); 456 file_op.pFrom = temp_path16.c_str();
457 file_op.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT; 457 file_op.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
458 return (0 == SHFileOperation(&file_op)); 458 return (0 == SHFileOperation(&file_op));
459 */ 459 */
460 460
461 } // namespace rtc 461 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32filesystem.h ('k') | webrtc/base/win32regkey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698