2323#define DUMP_OCTETS_PER_LINE 16
2424#define DUMP_OCTETS_PER_GROUP 2
2525
26- #define ERROR0 (msg ) fprintf(stderr, " %s:%d: " msg, __FILE__, __LINE__)
27- #define ERROR (fmt, ...) \
28- fprintf (stderr, " %s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
26+ #define UNIMPLMENTED (msg ) fprintf(stderr, " %s:%d: " msg, __FILE__, __LINE__)
27+ #define ERROR (fmt, ...) fprintf(stderr, " wabt: " fmt, __VA_ARGS__)
2928
3029namespace wabt {
3130
@@ -136,7 +135,8 @@ Result OutputBuffer::WriteToFile(std::string_view filename) const {
136135 std::string filename_str (filename);
137136 FILE* file = fopen (filename_str.c_str (), " wb" );
138137 if (!file) {
139- ERROR (" unable to open %s for writing\n " , filename_str.c_str ());
138+ ERROR (" unable to open %s for writing: %s\n " , filename_str.c_str (),
139+ strerror (errno));
140140 return Result::Error;
141141 }
142142
@@ -238,7 +238,8 @@ FileStream::FileStream(std::string_view filename, Stream* log_stream)
238238 if (file_) {
239239 should_close_ = true ;
240240 } else {
241- ERROR (" fopen name=\" %s\" failed, errno=%d\n " , filename_str.c_str (), errno);
241+ ERROR (" unable to open %s for writing: %s\n " , filename_str.c_str (),
242+ strerror (errno));
242243 }
243244}
244245
@@ -304,7 +305,7 @@ Result FileStream::MoveDataImpl(size_t dst_offset,
304305 return Result::Ok;
305306 }
306307 // TODO(binji): implement if needed.
307- ERROR0 (" FileStream::MoveDataImpl not implemented!\n " );
308+ UNIMPLMENTED (" FileStream::MoveDataImpl not implemented!\n " );
308309 return Result::Error;
309310}
310311
@@ -313,7 +314,7 @@ Result FileStream::TruncateImpl(size_t size) {
313314 return Result::Error;
314315 }
315316 // TODO(binji): implement if needed.
316- ERROR0 (" FileStream::TruncateImpl not implemented!\n " );
317+ UNIMPLMENTED (" FileStream::TruncateImpl not implemented!\n " );
317318 return Result::Error;
318319}
319320
0 commit comments