mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
Strings are postprocessed so that the special characters &, <, >, " are replaced by their HTML equivalents &, <, > and ".
This commit is contained in:
parent
defc198ca1
commit
dbdc6fa19e
@ -1,3 +1,9 @@
|
||||
2003-08-25 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvextract: Strings are postprocessed so that the special
|
||||
characters &, <, >, " are replaced by their HTML equivalents
|
||||
&, <, > and ".
|
||||
|
||||
2003-08-24 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvmerge: Disabled lacing by default and renamed --no-lacing to
|
||||
|
@ -50,11 +50,6 @@ static void print_tag(int level, const char *name, const char *fmt, ...) {
|
||||
mxprint(o, "</%s>\n", name);
|
||||
}
|
||||
|
||||
static void print_tag_and_free(int level, const char *name, char *str) {
|
||||
print_tag(level, name, "%s", str);
|
||||
safefree(str);
|
||||
}
|
||||
|
||||
static void print_binary(int level, const char *name, EbmlElement *e) {
|
||||
EbmlBinary *b;
|
||||
string s;
|
||||
@ -121,6 +116,38 @@ static void print_date(int level, const char *name, EbmlElement *e) {
|
||||
mxprint(o, "</%s>\n", name);
|
||||
}
|
||||
|
||||
static void print_string(int level, const char *name, const char *src) {
|
||||
int idx;
|
||||
string s;
|
||||
|
||||
idx = 0;
|
||||
s = "";
|
||||
while (src[idx] != 0) {
|
||||
if (src[idx] == '&')
|
||||
s += "&";
|
||||
else if (src[idx] == '<')
|
||||
s += "<";
|
||||
else if (src[idx] == '>')
|
||||
s += ">";
|
||||
else if (src[idx] == '"')
|
||||
s += """;
|
||||
else
|
||||
s += src[idx];
|
||||
idx++;
|
||||
}
|
||||
for (idx = 0; idx < level; idx++)
|
||||
mxprint(o, " ");
|
||||
mxprint(o, "<%s>%s</%s>\n", name, s.c_str(), name);
|
||||
}
|
||||
|
||||
static void print_utf_string(int level, const char *name, EbmlElement *e) {
|
||||
char *s;
|
||||
|
||||
s = UTFstring_to_cstrutf8(*static_cast<EbmlUnicodeString *>(e));
|
||||
print_string(level, name, s);
|
||||
safefree(s);
|
||||
}
|
||||
|
||||
static void print_unknown(int level, EbmlElement *e) {
|
||||
int idx;
|
||||
|
||||
@ -135,11 +162,9 @@ static void print_unknown(int level, EbmlElement *e) {
|
||||
int64(*static_cast<EbmlSInteger *>(e)))
|
||||
#define pr_f(n) print_tag(level, n, "%f", \
|
||||
float(*static_cast<EbmlFloat *>(e)))
|
||||
#define pr_s(n) print_tag(level, n, "%s", \
|
||||
#define pr_s(n) print_string(level, n, \
|
||||
string(*static_cast<EbmlString *>(e)).c_str())
|
||||
#define pr_us(n) print_tag_and_free(level, n, \
|
||||
UTFstring_to_cstrutf8(UTFstring( \
|
||||
*static_cast<EbmlUnicodeString *>(e))))
|
||||
#define pr_us(n) print_utf_string(level, n, e)
|
||||
#define pr_d(n) print_date(level, n, e)
|
||||
|
||||
#define pr_b(n) print_binary(level, n, e)
|
||||
|
Loading…
Reference in New Issue
Block a user