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

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

Issue 1477533002: Remove kint16max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint8max
Patch Set: includes 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
« no previous file with comments | « base/basictypes.h ('k') | media/base/audio_buffer_queue_unittest.cc » ('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 "base/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <io.h> 8 #include <io.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <stdint.h>
12 #include <time.h> 13 #include <time.h>
13 14
14 #include <algorithm> 15 #include <algorithm>
15 #include <limits> 16 #include <limits>
16 #include <string> 17 #include <string>
17 18
18 #include "base/files/file_enumerator.h" 19 #include "base/files/file_enumerator.h"
19 #include "base/files/file_path.h" 20 #include "base/files/file_path.h"
20 #include "base/logging.h" 21 #include "base/logging.h"
21 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 353
353 FilePath path_to_create; 354 FilePath path_to_create;
354 355
355 for (int count = 0; count < 50; ++count) { 356 for (int count = 0; count < 50; ++count) {
356 // Try create a new temporary directory with random generated name. If 357 // Try create a new temporary directory with random generated name. If
357 // the one exists, keep trying another path name until we reach some limit. 358 // the one exists, keep trying another path name until we reach some limit.
358 string16 new_dir_name; 359 string16 new_dir_name;
359 new_dir_name.assign(prefix); 360 new_dir_name.assign(prefix);
360 new_dir_name.append(IntToString16(GetCurrentProcId())); 361 new_dir_name.append(IntToString16(GetCurrentProcId()));
361 new_dir_name.push_back('_'); 362 new_dir_name.push_back('_');
362 new_dir_name.append(IntToString16(RandInt(0, kint16max))); 363 new_dir_name.append(
364 IntToString16(RandInt(0, std::numeric_limits<int16_t>::max())));
363 365
364 path_to_create = base_dir.Append(new_dir_name); 366 path_to_create = base_dir.Append(new_dir_name);
365 if (::CreateDirectory(path_to_create.value().c_str(), NULL)) { 367 if (::CreateDirectory(path_to_create.value().c_str(), NULL)) {
366 *new_dir = path_to_create; 368 *new_dir = path_to_create;
367 return true; 369 return true;
368 } 370 }
369 } 371 }
370 372
371 return false; 373 return false;
372 } 374 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // Like Move, this function is not transactional, so we just 813 // Like Move, this function is not transactional, so we just
812 // leave the copied bits behind if deleting from_path fails. 814 // leave the copied bits behind if deleting from_path fails.
813 // If to_path exists previously then we have already overwritten 815 // If to_path exists previously then we have already overwritten
814 // it by now, we don't get better off by deleting the new bits. 816 // it by now, we don't get better off by deleting the new bits.
815 } 817 }
816 return false; 818 return false;
817 } 819 }
818 820
819 } // namespace internal 821 } // namespace internal
820 } // namespace base 822 } // namespace base
OLDNEW
« no previous file with comments | « base/basictypes.h ('k') | media/base/audio_buffer_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698