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

Side by Side Diff: components/drive/drive_api_util.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « components/drive/directory_loader_unittest.cc ('k') | components/drive/drive_app_registry.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 // 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 "components/drive/drive_api_util.h" 5 #include "components/drive/drive_api_util.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <string> 10 #include <string>
8 11
9 #include "base/files/file.h" 12 #include "base/files/file.h"
10 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h"
11 #include "base/md5.h" 15 #include "base/md5.h"
12 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
13 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
16 #include "base/synchronization/cancellation_flag.h" 20 #include "base/synchronization/cancellation_flag.h"
17 #include "base/values.h" 21 #include "base/values.h"
18 #include "google_apis/drive/drive_api_parser.h" 22 #include "google_apis/drive/drive_api_parser.h"
19 #include "net/base/escape.h" 23 #include "net/base/escape.h"
20 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 140
137 std::string GetMd5Digest(const base::FilePath& file_path, 141 std::string GetMd5Digest(const base::FilePath& file_path,
138 const base::CancellationFlag* cancellation_flag) { 142 const base::CancellationFlag* cancellation_flag) {
139 base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ); 143 base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
140 if (!file.IsValid()) 144 if (!file.IsValid())
141 return std::string(); 145 return std::string();
142 146
143 base::MD5Context context; 147 base::MD5Context context;
144 base::MD5Init(&context); 148 base::MD5Init(&context);
145 149
146 int64 offset = 0; 150 int64_t offset = 0;
147 scoped_ptr<char[]> buffer(new char[kMd5DigestBufferSize]); 151 scoped_ptr<char[]> buffer(new char[kMd5DigestBufferSize]);
148 while (true) { 152 while (true) {
149 if (cancellation_flag && cancellation_flag->IsSet()) { // Cancelled. 153 if (cancellation_flag && cancellation_flag->IsSet()) { // Cancelled.
150 return std::string(); 154 return std::string();
151 } 155 }
152 int result = file.Read(offset, buffer.get(), kMd5DigestBufferSize); 156 int result = file.Read(offset, buffer.get(), kMd5DigestBufferSize);
153 if (result < 0) { 157 if (result < 0) {
154 // Found an error. 158 // Found an error.
155 return std::string(); 159 return std::string();
156 } 160 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe(); 193 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe();
190 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 194 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
191 if (extension == kHostedDocumentKinds[i].extension) 195 if (extension == kHostedDocumentKinds[i].extension)
192 return true; 196 return true;
193 } 197 }
194 return extension == kUnknownHostedDocumentExtension; 198 return extension == kUnknownHostedDocumentExtension;
195 } 199 }
196 200
197 } // namespace util 201 } // namespace util
198 } // namespace drive 202 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/directory_loader_unittest.cc ('k') | components/drive/drive_app_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698