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

Unified Diff: third_party/crashpad/crashpad/util/file/file_writer.cc

Issue 2773813002: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 (Closed)
Patch Set: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/util/file/file_writer.cc
diff --git a/third_party/crashpad/crashpad/util/file/file_writer.cc b/third_party/crashpad/crashpad/util/file/file_writer.cc
index d22a1a3b21392387abb526da5d638c5077d727d7..13ac6cf5fcb1ec995085407923453ebefaac40d8 100644
--- a/third_party/crashpad/crashpad/util/file/file_writer.cc
+++ b/third_party/crashpad/crashpad/util/file/file_writer.cc
@@ -15,6 +15,7 @@
#include "util/file/file_writer.h"
#include <limits.h>
+#include <stddef.h>
#include <string.h>
#include <algorithm>
@@ -192,66 +193,4 @@ FileOffset FileWriter::Seek(FileOffset offset, int whence) {
return weak_file_handle_file_writer_.Seek(offset, whence);
}
-WeakStdioFileWriter::WeakStdioFileWriter(FILE* file)
- : file_(file) {
-}
-
-WeakStdioFileWriter::~WeakStdioFileWriter() {
-}
-
-bool WeakStdioFileWriter::Write(const void* data, size_t size) {
- DCHECK(file_);
-
- size_t rv = fwrite(data, 1, size, file_);
- if (rv != size) {
- if (ferror(file_)) {
- STDIO_PLOG(ERROR) << "fwrite";
- } else {
- LOG(ERROR) << "fwrite: expected " << size << ", observed " << rv;
- }
- return false;
- }
-
- return true;
-}
-
-bool WeakStdioFileWriter::WriteIoVec(std::vector<WritableIoVec>* iovecs) {
- DCHECK(file_);
-
- if (iovecs->empty()) {
- LOG(ERROR) << "WriteIoVec(): no iovecs";
- return false;
- }
-
- for (const WritableIoVec& iov : *iovecs) {
- if (!Write(iov.iov_base, iov.iov_len)) {
- return false;
- }
- }
-
-#ifndef NDEBUG
- // The interface says that |iovecs| is not sacred, so scramble it to make sure
- // that nobody depends on it.
- memset(&(*iovecs)[0], 0xa5, sizeof((*iovecs)[0]) * iovecs->size());
-#endif
-
- return true;
-}
-
-FileOffset WeakStdioFileWriter::Seek(FileOffset offset, int whence) {
- DCHECK(file_);
- if (fseeko(file_, offset, whence) == -1) {
- STDIO_PLOG(ERROR) << "fseeko";
- return -1;
- }
-
- FileOffset new_offset = ftello(file_);
- if (new_offset == -1) {
- STDIO_PLOG(ERROR) << "ftello";
- return -1;
- }
-
- return new_offset;
-}
-
} // namespace crashpad
« no previous file with comments | « third_party/crashpad/crashpad/util/file/file_writer.h ('k') | third_party/crashpad/crashpad/util/mach/child_port_handshake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698