Skip to content

Commit b73a4a6

Browse files
Merge pull request #805 from g-maxime/deprecated
Remove / replace use of deprecated libxml2 functions
2 parents 28267f3 + efb6ec9 commit b73a4a6

File tree

10 files changed

+19
-26
lines changed

10 files changed

+19
-26
lines changed

Source/CLI/CLI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_S
124124

125125
//--------------------------------------------------------------------------
126126
CLI::CLI() : watch_folder_user(NULL), use_as_user(-1), use_daemon(false), asynchronous(false),
127-
force_analyze(false), full_report(false), no_database(false), include_hidden_files(false), mil_analyze(true),
127+
force_analyze(false), no_database(false), full_report(false), include_hidden_files(false), mil_analyze(true),
128128
watch_folder_recursive(true), create_policy_mode(false), file_information(false),
129129
plugins_list_mode(false), list_watch_folders_mode(false), no_needs_files_mode(false),
130130
list_mode(false), fixer(false)

Source/Checker/Checker.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ int tfsxml_hasvalue(tfsxml_string* priv)
118118
}
119119

120120
//---------------------------------------------------------------------------
121-
std::string tokenize(const std::string& scope, const std::string& list, const std::string& delimiter)
121+
std::string tokenize(const std::string& scope, const std::string& list, const char delimiter)
122122
{
123123
std::stringstream ss;
124124

125125
//TODO: mmt
126126
if (scope.empty() || scope=="mi")
127127
{
128128
std::istringstream iss(list);
129-
for (std::string token; std::getline(iss, token, '/');)
129+
for (std::string token; std::getline(iss, token, delimiter);)
130130
ss << "/mi:" << token;
131131
}
132132

@@ -280,7 +280,7 @@ std::string PolicyChecker::PolicyElement::to_string(size_t level, bool verbose)
280280
//---------------------------------------------------------------------------
281281

282282
//---------------------------------------------------------------------------
283-
PolicyChecker::RuleElement::RuleElement() : resolved(false), pass(false), tracks(0), source(NULL)
283+
PolicyChecker::RuleElement::RuleElement() : source(NULL), tracks(0), resolved(false), pass(false)
284284
{
285285
}
286286

@@ -624,7 +624,7 @@ PolicyChecker::RuleElement* PolicyChecker::parse_rule(tfsxml_string& tfsxml_priv
624624
<< rule->source->tracktype << "']["
625625
<< ((rule->source->occurrence.empty() || rule->source->occurrence=="all" || rule->source->occurrence=="any") ? "*" : rule->source->occurrence)
626626
<< "]"
627-
<< tokenize(rule->source->scope, rule->source->field, "/");
627+
<< tokenize(rule->source->scope, rule->source->field, '/');
628628
rule->source->path=parse_path(ss.str());
629629
}
630630
break;
@@ -650,7 +650,7 @@ PolicyChecker::RuleElement* PolicyChecker::parse_rule(tfsxml_string& tfsxml_priv
650650
<< rule->tracktype
651651
<< "']["
652652
<< ((rule->occurrence.empty() || rule->occurrence=="all" || rule->occurrence=="any") ? "*" : rule->occurrence)
653-
<< "]" << tokenize(rule->scope, rule->field, "/");
653+
<< "]" << tokenize(rule->scope, rule->field, '/');
654654
rule->xpath=ss.str();
655655
rule->path=parse_path(rule->xpath);
656656
}

Source/Checker/Checker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ class PolicyChecker
4747
class Element
4848
{
4949
public:
50-
typedef enum Level {
50+
enum Level {
5151
LEVEL_NONE = 0,
5252
LEVEL_INFO,
5353
LEVEL_WARN,
5454
LEVEL_FAIL,
5555
};
5656

57-
typedef enum Result {
57+
enum Result {
5858
RESULT_PASS = 0,
5959
RESULT_INFO,
6060
RESULT_WARN,

Source/Checker/Path.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ std::vector<PathElement> parse_path(const std::string& xpath)
113113
bool path_is_matching(tfsxml_string& tfsxml_priv, tfsxml_string& node, PathElement path, size_t& occurrence)
114114
{
115115
tfsxml_string tfsxml_priv_local = tfsxml_priv;
116-
tfsxml_string value;
117116

118117
// compare names
119118
if (tfsxml_strcmp_charp(node, path.name.c_str()))

Source/Common/Core.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ long Core::checker_analyze(int user, const std::string& filename, long src_id, s
506506
}
507507

508508
//--------------------------------------------------------------------------
509-
int Core::checker_list_mediainfo_outputs(std::string& output, std::string& err)
509+
int Core::checker_list_mediainfo_outputs(std::string& output, std::string&)
510510
{
511511
output = Ztring(MI->Option(__T("Info_OutputFormats_JSON"))).To_UTF8();
512512

@@ -980,7 +980,7 @@ int Core::transform_mixml_report(const std::string& mi_xml, const std::string& m
980980
}
981981

982982
tmpMI->Open_Buffer_Init(BufferSize);
983-
tmpMI->Open_Buffer_Continue((ZenLib::int8u*)mi_xml.data(), BufferSize);
983+
tmpMI->Open_Buffer_Continue((const ZenLib::int8u*)mi_xml.data(), BufferSize);
984984
tmpMI->Open_Buffer_Finalize();
985985

986986
report = Ztring(tmpMI->Inform()).To_UTF8();
@@ -1697,10 +1697,10 @@ unsigned long long Core::mil_version()
16971697
build = strtol(version, &end, 10);
16981698
}
16991699

1700-
return ((unsigned long long )major << 52) & 0xFFF0000000000000 |
1701-
((unsigned long long )minor << 40) & 0x000FFF0000000000 |
1702-
((unsigned long long )patch << 32) & 0x000000FF00000000 |
1703-
((unsigned long long )build) & 0x00000000FFFFFFFF;
1700+
return (((unsigned long long )major << 52) & 0xFFF0000000000000) |
1701+
(((unsigned long long )minor << 40) & 0x000FFF0000000000) |
1702+
(((unsigned long long )patch << 32) & 0x000000FF00000000) |
1703+
(((unsigned long long )build) & 0x00000000FFFFFFFF);
17041704
}
17051705

17061706
//--------------------------------------------------------------------------

Source/Common/Policy.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ int Policy::import_schema(const std::string& filename, const std::string& save_n
9595

9696
int ret = import_schema_from_doc(doc, save_name);
9797
xmlFreeDoc(doc);
98-
xmlCleanupCharEncodingHandlers();
9998
xmlSetGenericErrorFunc(NULL, NULL);
10099
return ret;
101100
}

Source/Common/Scheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace MediaConch {
4242
//***************************************************************************
4343

4444
//---------------------------------------------------------------------------
45-
Scheduler::Scheduler(Core* c) : core(c), max_threads_modified(false), max_threads(1)
45+
Scheduler::Scheduler(Core* c) : core(c), max_threads(1), max_threads_modified(false)
4646
{
4747
queue = new Queue(this);
4848
}

Source/Common/Scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Scheduler
7272
void write_log_timestamp(int level, std::string log);
7373
void log_cb(struct MediaInfo_Event_Log_0 *Event);
7474

75-
void set_default_max_threads(size_t nb) {} // { if (max_threads_modified) return; max_threads = nb; } //TODO: check issues with the GUI when there are tons of files
75+
void set_default_max_threads(size_t /* nb */) {} // { if (max_threads_modified) return; max_threads = nb; } //TODO: check issues with the GUI when there are tons of files
7676
void set_max_threads(size_t nb) { max_threads_modified = true; max_threads = nb; }
7777

7878
private:

Source/Common/Xslt.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ bool Xslt::register_schema_from_doc(void* data)
7474
return false;
7575

7676
xsltSetGenericErrorFunc(this, &manage_generic_error);
77-
xmlLoadExtDtdDefaultValue = 1;
7877

7978
if (xslt_ctx)
8079
{
@@ -100,7 +99,6 @@ bool Xslt::register_schema_from_doc(void* data)
10099
//---------------------------------------------------------------------------
101100
bool Xslt::register_schema_from_memory(const std::string& schem)
102101
{
103-
xmlLoadExtDtdDefaultValue = 1;
104102
xmlSetGenericErrorFunc(this, &manage_generic_error);
105103

106104
int doc_flags = XML_PARSE_COMPACT | XML_PARSE_DTDLOAD;
@@ -135,10 +133,7 @@ int Xslt::validate_xml(const std::string& xml, bool)
135133
if (!xslt_ctx)
136134
return -1;
137135

138-
xmlSubstituteEntitiesDefault(1);
139-
xmlLoadExtDtdDefaultValue = 1;
140-
141-
int doc_flags = XML_PARSE_COMPACT | XML_PARSE_DTDLOAD;
136+
int doc_flags = XML_PARSE_COMPACT | XML_PARSE_DTDLOAD | XML_PARSE_NOENT;
142137
xmlSetGenericErrorFunc(this, &manage_generic_error);
143138

144139
#ifdef XML_PARSE_BIG_LINES

Source/IMSC1/IMSC1Plugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace MediaConch {
8181
}
8282

8383
//---------------------------------------------------------------------------
84-
int IMSC1Plugin::create_report(std::string& report, const std::string& filename, bool result, const std::string& message, std::string& error)
84+
int IMSC1Plugin::create_report(std::string& report, const std::string& filename, bool result, const std::string& message, std::string&)
8585
{
8686

8787
xmlDocPtr doc = xmlNewDoc((const xmlChar *)"1.0");
@@ -348,7 +348,7 @@ namespace MediaConch {
348348
}
349349

350350
//---------------------------------------------------------------------------
351-
void IMSC1Plugin::xml_error_discard(void* user_data, const char* format, ...)
351+
void IMSC1Plugin::xml_error_discard(void*, const char*, ...)
352352
{
353353
}
354354
}

0 commit comments

Comments
 (0)