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

Side by Side Diff: util/file/file_writer.cc

Issue 615923004: Convert COMPILE_ASSERT to static_assert (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/file/file_writer.h" 15 #include "util/file/file_writer.h"
16 16
17 #include <algorithm> 17 #include <algorithm>
18 18
19 #include <limits.h> 19 #include <limits.h>
20 20
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/posix/eintr_wrapper.h" 22 #include "base/posix/eintr_wrapper.h"
23 #include "util/file/fd_io.h" 23 #include "util/file/fd_io.h"
24 24
25 namespace crashpad { 25 namespace crashpad {
26 26
27 // Ensure type compatibility between WritableIoVec and iovec. 27 // Ensure type compatibility between WritableIoVec and iovec.
28 COMPILE_ASSERT(sizeof(WritableIoVec) == sizeof(iovec), WritableIoVec_size); 28 static_assert(sizeof(WritableIoVec) == sizeof(iovec), "WritableIoVec size");
29 COMPILE_ASSERT(offsetof(WritableIoVec, iov_base) == offsetof(iovec, iov_base), 29 static_assert(offsetof(WritableIoVec, iov_base) == offsetof(iovec, "iov base"),
Mark Mentovai 2014/10/01 03:55:12 You changed the wrong parameter. ../../util/file/
scottmg 2014/10/01 16:37:18 Done.
30 WritableIoVec_base_offset); 30 WritableIoVec_base_offset);
31 COMPILE_ASSERT(offsetof(WritableIoVec, iov_len) == offsetof(iovec, iov_len), 31 static_assert(offsetof(WritableIoVec, iov_len) == offsetof(iovec, "iov len"),
32 WritableIoVec_len_offset); 32 WritableIoVec_len_offset);
33 33
34 FileWriter::FileWriter() : fd_() { 34 FileWriter::FileWriter() : fd_() {
35 } 35 }
36 36
37 FileWriter::~FileWriter() { 37 FileWriter::~FileWriter() {
38 } 38 }
39 39
40 bool FileWriter::Open(const base::FilePath& path, int oflag, mode_t mode) { 40 bool FileWriter::Open(const base::FilePath& path, int oflag, mode_t mode) {
41 CHECK(!fd_.is_valid()); 41 CHECK(!fd_.is_valid());
42 42
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 off_t rv = lseek(fd_.get(), offset, whence); 143 off_t rv = lseek(fd_.get(), offset, whence);
144 if (rv < 0) { 144 if (rv < 0) {
145 PLOG(ERROR) << "lseek"; 145 PLOG(ERROR) << "lseek";
146 } 146 }
147 147
148 return rv; 148 return rv;
149 } 149 }
150 150
151 } // namespace crashpad 151 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698