diff --git a/ChangeLog b/ChangeLog index dd6a0778e..c84c45cc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-16 Moritz Bunkus + + * mkvtoolnix: bug fix: On Windows the command line output was + terminated with CR CR NL instead of just CR NL. + 2005-08-13 Moritz Bunkus * mkvmerge: bug fix: The Quicktime/MP4 reader wasn't skipping diff --git a/src/common/common.cpp b/src/common/common.cpp index 30476e80b..0c256228c 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -1333,7 +1333,7 @@ mxmsg(int level, mm_stdio->puts(prefix); output = from_utf8(cc_stdio, mxvsprintf(new_fmt.c_str(), ap)); - mm_stdio->write(output.c_str(), output.length()); + mm_stdio->puts(output); mm_stdio->flush(); } diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index 2af84a3cd..ab22bdde6 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -484,21 +484,21 @@ mm_io_c::setFilePointer2(int64 offset, seek_mode mode) { size_t mm_io_c::puts(const string &s) { int i; - size_t bytes_written; const char *cs; + string output, h; cs = s.c_str(); - bytes_written = 0; for (i = 0; cs[i] != 0; i++) if (cs[i] != '\r') { #if defined(SYS_WINDOWS) if ('\n' == cs[i]) - bytes_written += write("\r", 1); + output += "\r"; #endif - bytes_written += write(&cs[i], 1); - } + output += cs[i]; + } else if ('\n' != cs[i + 1]) + output += "\r"; - return bytes_written; + return write(output.c_str(), output.length()); } uint32_t @@ -1160,7 +1160,23 @@ mm_stdio_c::read(void *buffer, size_t mm_stdio_c::write(const void *buffer, size_t size) { +#if defined(SYS_WINDOWS) + int i, bytes_written; + const char *s; + + bytes_written = 0; + s = (const char *)buffer; + for (i = 0; i < size; ++i) + if (('\r' != s[i]) || + (((i + 1) < size) && ('\n' != s[i + 1]))) + bytes_written += fwrite(&s[i], 1, 1, stdout); + + return bytes_written; + +#else // defined(SYS_WINDOWS) + return fwrite(buffer, 1, size, stdout); +#endif // defined(SYS_WINDOWS) } void