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

Side by Side Diff: base/files/file_util.cc

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't assume char (un)signedness Created 6 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
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 "base/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #endif 9 #endif
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return false; 68 return false;
69 69
70 const int BUFFER_SIZE = 2056; 70 const int BUFFER_SIZE = 2056;
71 char buffer1[BUFFER_SIZE], buffer2[BUFFER_SIZE]; 71 char buffer1[BUFFER_SIZE], buffer2[BUFFER_SIZE];
72 do { 72 do {
73 file1.read(buffer1, BUFFER_SIZE); 73 file1.read(buffer1, BUFFER_SIZE);
74 file2.read(buffer2, BUFFER_SIZE); 74 file2.read(buffer2, BUFFER_SIZE);
75 75
76 if ((file1.eof() != file2.eof()) || 76 if ((file1.eof() != file2.eof()) ||
77 (file1.gcount() != file2.gcount()) || 77 (file1.gcount() != file2.gcount()) ||
78 (memcmp(buffer1, buffer2, file1.gcount()))) { 78 (memcmp(buffer1, buffer2, static_cast<size_t>(file1.gcount())))) {
79 file1.close(); 79 file1.close();
80 file2.close(); 80 file2.close();
81 return false; 81 return false;
82 } 82 }
83 } while (!file1.eof() || !file2.eof()); 83 } while (!file1.eof() || !file2.eof());
84 84
85 file1.close(); 85 file1.close();
86 file2.close(); 86 file2.close();
87 return true; 87 return true;
88 } 88 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (!PathExists(new_path) && 251 if (!PathExists(new_path) &&
252 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { 252 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) {
253 return count; 253 return count;
254 } 254 }
255 } 255 }
256 256
257 return -1; 257 return -1;
258 } 258 }
259 259
260 } // namespace base 260 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698