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

Side by Side Diff: base/os_compat_android.cc

Issue 185423006: Eliminate build warnings in base/ for Android x64 (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/stack_trace_android.cc ('k') | base/strings/string_piece_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/os_compat_android.h" 5 #include "base/os_compat_android.h"
6 6
7 #include <asm/unistd.h> 7 #include <asm/unistd.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <math.h> 9 #include <math.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 23 matching lines...) Expand all
34 ts[0].tv_nsec = tv[0].tv_usec * 1000; 34 ts[0].tv_nsec = tv[0].tv_usec * 1000;
35 ts[1].tv_sec = tv[1].tv_sec; 35 ts[1].tv_sec = tv[1].tv_sec;
36 ts[1].tv_nsec = tv[1].tv_usec * 1000; 36 ts[1].tv_nsec = tv[1].tv_usec * 1000;
37 return syscall(__NR_utimensat, fd, NULL, ts, 0); 37 return syscall(__NR_utimensat, fd, NULL, ts, 0);
38 } 38 }
39 39
40 // Android has only timegm64() and no timegm(). 40 // Android has only timegm64() and no timegm().
41 // We replicate the behaviour of timegm() when the result overflows time_t. 41 // We replicate the behaviour of timegm() when the result overflows time_t.
42 time_t timegm(struct tm* const t) { 42 time_t timegm(struct tm* const t) {
43 // time_t is signed on Android. 43 // time_t is signed on Android.
44 static const time_t kTimeMax = ~(1 << (sizeof(time_t) * CHAR_BIT - 1)); 44 static const time_t kTimeMax = ~(1L << (sizeof(time_t) * CHAR_BIT - 1));
45 static const time_t kTimeMin = (1 << (sizeof(time_t) * CHAR_BIT - 1)); 45 static const time_t kTimeMin = (1L << (sizeof(time_t) * CHAR_BIT - 1));
46 time64_t result = timegm64(t); 46 time64_t result = timegm64(t);
47 if (result < kTimeMin || result > kTimeMax) 47 if (result < kTimeMin || result > kTimeMax)
48 return -1; 48 return -1;
49 return result; 49 return result;
50 } 50 }
51 51
52 // The following is only needed when building with GCC 4.6 or higher 52 // The following is only needed when building with GCC 4.6 or higher
53 // (i.e. not with Android GCC 4.4.3, nor with Clang). 53 // (i.e. not with Android GCC 4.4.3, nor with Clang).
54 // 54 //
55 // GCC is now capable of optimizing successive calls to sin() and cos() into 55 // GCC is now capable of optimizing successive calls to sin() and cos() into
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // The directory doesn't exist, but an error occured 162 // The directory doesn't exist, but an error occured
163 return NULL; 163 return NULL;
164 } 164 }
165 } 165 }
166 166
167 // We reached the max number of tries. 167 // We reached the max number of tries.
168 return NULL; 168 return NULL;
169 } 169 }
170 170
171 } // extern "C" 171 } // extern "C"
OLDNEW
« no previous file with comments | « base/debug/stack_trace_android.cc ('k') | base/strings/string_piece_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698