mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Strip \r when outputting to stdout on Windows as Windows writes the \r on \n itself.
This commit is contained in:
parent
837a4bf7bb
commit
c6744290e7
@ -1,3 +1,8 @@
|
|||||||
|
2005-08-16 Moritz Bunkus <moritz@bunkus.org>
|
||||||
|
|
||||||
|
* 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 <moritz@bunkus.org>
|
2005-08-13 Moritz Bunkus <moritz@bunkus.org>
|
||||||
|
|
||||||
* mkvmerge: bug fix: The Quicktime/MP4 reader wasn't skipping
|
* mkvmerge: bug fix: The Quicktime/MP4 reader wasn't skipping
|
||||||
|
@ -1333,7 +1333,7 @@ mxmsg(int level,
|
|||||||
mm_stdio->puts(prefix);
|
mm_stdio->puts(prefix);
|
||||||
|
|
||||||
output = from_utf8(cc_stdio, mxvsprintf(new_fmt.c_str(), ap));
|
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();
|
mm_stdio->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,21 +484,21 @@ mm_io_c::setFilePointer2(int64 offset, seek_mode mode) {
|
|||||||
size_t
|
size_t
|
||||||
mm_io_c::puts(const string &s) {
|
mm_io_c::puts(const string &s) {
|
||||||
int i;
|
int i;
|
||||||
size_t bytes_written;
|
|
||||||
const char *cs;
|
const char *cs;
|
||||||
|
string output, h;
|
||||||
|
|
||||||
cs = s.c_str();
|
cs = s.c_str();
|
||||||
bytes_written = 0;
|
|
||||||
for (i = 0; cs[i] != 0; i++)
|
for (i = 0; cs[i] != 0; i++)
|
||||||
if (cs[i] != '\r') {
|
if (cs[i] != '\r') {
|
||||||
#if defined(SYS_WINDOWS)
|
#if defined(SYS_WINDOWS)
|
||||||
if ('\n' == cs[i])
|
if ('\n' == cs[i])
|
||||||
bytes_written += write("\r", 1);
|
output += "\r";
|
||||||
#endif
|
#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
|
uint32_t
|
||||||
@ -1160,7 +1160,23 @@ mm_stdio_c::read(void *buffer,
|
|||||||
size_t
|
size_t
|
||||||
mm_stdio_c::write(const void *buffer,
|
mm_stdio_c::write(const void *buffer,
|
||||||
size_t size) {
|
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);
|
return fwrite(buffer, 1, size, stdout);
|
||||||
|
#endif // defined(SYS_WINDOWS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user