summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-04-16 16:07:03 -0700
committerGitHub <noreply@github.com>2017-04-16 16:07:03 -0700
commita4751fe78f119305fa8927f1bba10aefecc14f3f (patch)
treee339741de3c5b1ce7382601952d0f80a685cd701 /src/binary-reader-objdump.cc
parent15c898a5bd3e257e72e4f5b4fdc831c82bf20e83 (diff)
downloadwabt-a4751fe78f119305fa8927f1bba10aefecc14f3f.tar.gz
wabt-a4751fe78f119305fa8927f1bba10aefecc14f3f.tar.bz2
wabt-a4751fe78f119305fa8927f1bba10aefecc14f3f.zip
Refactor Stream/Writer; write as C++ (#399)
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r--src/binary-reader-objdump.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index b086c55b..a57ec1bb 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -485,14 +485,14 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
void PrintDetails(const char* fmt, ...);
Result OnCount(uint32_t count);
- Stream* out_stream;
+ std::unique_ptr<FileStream> out_stream;
};
BinaryReaderObjdump::BinaryReaderObjdump(const uint8_t* data,
size_t size,
ObjdumpOptions* options)
: BinaryReaderObjdumpBase(data, size, options),
- out_stream(init_stdout_stream()) {}
+ out_stream(FileStream::CreateStdout()) {}
Result BinaryReaderObjdump::BeginCustomSection(uint32_t size,
StringSlice section_name) {
@@ -533,8 +533,8 @@ Result BinaryReaderObjdump::BeginSection(BinarySection section_code,
case ObjdumpMode::RawData:
if (section_match) {
printf("\nContents of section %s:\n", name);
- write_memory_dump(out_stream, data + state->offset, size, state->offset,
- PrintChars::Yes, nullptr, nullptr);
+ out_stream->WriteMemoryDump(data + state->offset, size, state->offset,
+ nullptr, nullptr, PrintChars::Yes);
}
break;
case ObjdumpMode::Prepass:
@@ -807,8 +807,8 @@ Result BinaryReaderObjdump::OnDataSegmentData(uint32_t index,
const void* src_data,
uint32_t size) {
if (ShouldPrintDetails()) {
- write_memory_dump(out_stream, src_data, size, 0, PrintChars::Yes, " - ",
- nullptr);
+ out_stream->WriteMemoryDump(src_data, size, 0, " - ", nullptr,
+ PrintChars::Yes);
}
return Result::Ok;
}