mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Output text lines with new lines according to the OS (\r\n on Windows, \n on all other systems).
This commit is contained in:
parent
8cca15fa07
commit
e8cdd29702
@ -1,5 +1,9 @@
|
||||
2005-05-05 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvextract: bug fix: Use the native newline style when
|
||||
extracting text subtitles (\r\n on Windows and \n on all other
|
||||
systems).
|
||||
|
||||
* mkvextract: bug fix: SSA/ASS text was missing in the output if
|
||||
the "Format=" line contained newlines at the end of the
|
||||
CodecPrivate data (e.g. our old Mew Mew sample file).
|
||||
|
@ -482,7 +482,7 @@ mm_io_c::setFilePointer2(int64 offset, seek_mode mode) {
|
||||
}
|
||||
|
||||
size_t
|
||||
mm_io_c::puts_unl(const string &s) {
|
||||
mm_io_c::puts(const string &s) {
|
||||
int i;
|
||||
size_t bytes_written;
|
||||
const char *cs;
|
||||
@ -490,8 +490,13 @@ mm_io_c::puts_unl(const string &s) {
|
||||
cs = s.c_str();
|
||||
bytes_written = 0;
|
||||
for (i = 0; cs[i] != 0; i++)
|
||||
if (cs[i] != '\r')
|
||||
if (cs[i] != '\r') {
|
||||
#if defined(SYS_WINDOWS)
|
||||
if ('\n' == cs[i])
|
||||
bytes_written += write("\r", 1);
|
||||
#endif
|
||||
bytes_written += write(&cs[i], 1);
|
||||
}
|
||||
|
||||
return bytes_written;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
|
||||
virtual string getline();
|
||||
virtual bool getline2(string &s);
|
||||
virtual size_t puts_unl(const string &s);
|
||||
virtual size_t puts(const string &s);
|
||||
virtual bool write_bom(const string &charset);
|
||||
virtual int getch();
|
||||
|
||||
|
@ -76,7 +76,7 @@ xtr_srt_c::handle_block(KaxBlock &block,
|
||||
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
|
||||
(end / 1000) % 60, end % 1000,
|
||||
from_utf8(conv, text).c_str());
|
||||
out->puts_unl(buffer);
|
||||
out->puts(buffer);
|
||||
delete []text;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ xtr_ssa_c::create_file(xtr_base_c *_master,
|
||||
ssa_format[pos1] = downcase(ssa_format[pos1]);
|
||||
|
||||
sconv = from_utf8(conv, sconv);
|
||||
out->puts_unl(sconv);
|
||||
out->puts(sconv);
|
||||
}
|
||||
|
||||
void
|
||||
@ -275,6 +275,6 @@ xtr_ssa_c::finish_file() {
|
||||
// write them.
|
||||
sort(lines.begin(), lines.end());
|
||||
for (i = 0; i < lines.size(); i++)
|
||||
out->puts_unl(lines[i].line.c_str());
|
||||
out->puts(lines[i].line.c_str());
|
||||
}
|
||||
|
||||
|
@ -1170,10 +1170,8 @@ ogm_reader_c::handle_stream_comments() {
|
||||
try {
|
||||
out = new mm_mem_io_c(NULL, 0, 1000);
|
||||
out->write_bom("UTF-8");
|
||||
for (j = 0; j < chapters.size(); j++) {
|
||||
out->puts_unl(to_utf8(cch, chapters[j]));
|
||||
out->puts_unl("\n");
|
||||
}
|
||||
for (j = 0; j < chapters.size(); j++)
|
||||
out->puts(to_utf8(cch, chapters[j]) + string("\n"));
|
||||
out->set_file_name(ti.fname);
|
||||
kax_chapters = parse_chapters(new mm_text_io_c(out));
|
||||
} catch (...) {
|
||||
|
Loading…
Reference in New Issue
Block a user