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

Side by Side Diff: chrome/browser/media_galleries/win/snapshot_file_details.cc

Issue 1502503004: Remove kuint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint8
Patch Set: rebase Created 5 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/media_galleries/win/snapshot_file_details.h" 5 #include "chrome/browser/media_galleries/win/snapshot_file_details.h"
6 6
7 #include "base/basictypes.h" 7 #include <stdint.h>
8
9 #include <limits>
8 10
9 /////////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////////
10 // SnapshotRequestInfo // 12 // SnapshotRequestInfo //
11 /////////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////////
12 14
13 SnapshotRequestInfo::SnapshotRequestInfo( 15 SnapshotRequestInfo::SnapshotRequestInfo(
14 const base::FilePath& device_file_path, 16 const base::FilePath& device_file_path,
15 const base::FilePath& snapshot_file_path, 17 const base::FilePath& snapshot_file_path,
16 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback& 18 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback&
17 success_callback, 19 success_callback,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 DWORD optimal_transfer_size) { 55 DWORD optimal_transfer_size) {
54 optimal_transfer_size_ = optimal_transfer_size; 56 optimal_transfer_size_ = optimal_transfer_size;
55 } 57 }
56 58
57 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const { 59 bool SnapshotFileDetails::IsSnapshotFileWriteComplete() const {
58 return bytes_written_ == file_info_.size; 60 return bytes_written_ == file_info_.size;
59 } 61 }
60 62
61 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) { 63 bool SnapshotFileDetails::AddBytesWritten(DWORD bytes_written) {
62 if ((bytes_written == 0) || 64 if ((bytes_written == 0) ||
63 (bytes_written_ > kuint64max - bytes_written) || 65 (bytes_written_ > std::numeric_limits<uint64_t>::max() - bytes_written) ||
64 (bytes_written_ + bytes_written > file_info_.size)) 66 (bytes_written_ + bytes_written > file_info_.size))
65 return false; 67 return false;
66 68
67 bytes_written_ += bytes_written; 69 bytes_written_ += bytes_written;
68 return true; 70 return true;
69 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698