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

Side by Side Diff: src/base/platform/platform-win32.cc

Issue 2184673002: [base] Use thread safe localtime_r() instead of localtime(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | « src/base/platform/platform-solaris.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 // Platform-specific code for Win32. 5 // Platform-specific code for Win32.
6 6
7 // Secure API functions are not available using MinGW with msvcrt.dll 7 // Secure API functions are not available using MinGW with msvcrt.dll
8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to 8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to
9 // disable definition of secure API functions in standard headers that 9 // disable definition of secure API functions in standard headers that
10 // would conflict with our own implementation. 10 // would conflict with our own implementation.
(...skipping 28 matching lines...) Expand all
39 39
40 inline void MemoryBarrier() { 40 inline void MemoryBarrier() {
41 int barrier = 0; 41 int barrier = 0;
42 __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier)); 42 __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier));
43 } 43 }
44 44
45 #endif // __MINGW64_VERSION_MAJOR 45 #endif // __MINGW64_VERSION_MAJOR
46 46
47 47
48 int localtime_s(tm* out_tm, const time_t* time) { 48 int localtime_s(tm* out_tm, const time_t* time) {
49 tm* posix_local_time_struct = localtime(time); // NOLINT 49 tm* posix_local_time_struct = localtime_r(time, out_tm);
50 if (posix_local_time_struct == NULL) return 1; 50 if (posix_local_time_struct == NULL) return 1;
51 *out_tm = *posix_local_time_struct;
52 return 0; 51 return 0;
53 } 52 }
54 53
55 54
56 int fopen_s(FILE** pFile, const char* filename, const char* mode) { 55 int fopen_s(FILE** pFile, const char* filename, const char* mode) {
57 *pFile = fopen(filename, mode); 56 *pFile = fopen(filename, mode);
58 return *pFile != NULL ? 0 : 1; 57 return *pFile != NULL ? 0 : 1;
59 } 58 }
60 59
61 int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count, 60 int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count,
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1396
1398 1397
1399 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 1398 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
1400 BOOL result = TlsSetValue(static_cast<DWORD>(key), value); 1399 BOOL result = TlsSetValue(static_cast<DWORD>(key), value);
1401 USE(result); 1400 USE(result);
1402 DCHECK(result); 1401 DCHECK(result);
1403 } 1402 }
1404 1403
1405 } // namespace base 1404 } // namespace base
1406 } // namespace v8 1405 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/platform/platform-solaris.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698