Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
20233479
Commit
20233479
authored
Feb 06, 2013
by
Yann Diorcet
Browse files
Improve tools
parent
ab1c855d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
tools/lpc2xml.c
tools/lpc2xml.c
+3
-0
tools/xml2lpc.c
tools/xml2lpc.c
+12
-3
No files found.
tools/lpc2xml.c
View file @
20233479
...
...
@@ -98,6 +98,8 @@ static int processEntry(const char *section, const char *entry, xmlNode *node, l
lpc2xml_log
(
ctx
->
ctx
,
LPC2XML_ERROR
,
"Issue when reading the lpc"
);
return
-
1
;
}
lpc2xml_log
(
ctx
,
LPC2XML_MESSAGE
,
"Set %s|%s = %s"
,
section
,
entry
,
content
);
xmlNodeSetContent
(
node
,
(
const
xmlChar
*
)
content
);
return
0
;
}
...
...
@@ -123,6 +125,7 @@ static void processSection_cb(const char *entry, struct __processSectionCtx *ctx
ctx
->
ret
=
-
1
;
return
;
}
ctx
->
ret
=
processEntry
(
ctx
->
section
,
entry
,
node
,
ctx
->
ctx
);
}
}
...
...
tools/xml2lpc.c
View file @
20233479
...
...
@@ -148,7 +148,7 @@ static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_co
if
(
name
!=
NULL
)
{
const
char
*
str
=
lp_config_get_string
(
ctx
->
lpc
,
sectionName
,
name
,
NULL
);
if
(
str
==
NULL
||
overwrite
)
{
xml2lpc_log
(
ctx
,
XML2LPC_MESSAGE
,
"Set %s|%s = %s"
,
sectionName
,
name
,
value
);
xml2lpc_log
(
ctx
,
XML2LPC_MESSAGE
,
"Set %s|%s = %s"
,
sectionName
,
name
,
value
);
lp_config_set_string
(
ctx
->
lpc
,
sectionName
,
name
,
value
);
}
else
{
xml2lpc_log
(
ctx
,
XML2LPC_MESSAGE
,
"Don't touch %s|%s = %s"
,
sectionName
,
name
,
str
);
...
...
@@ -231,8 +231,10 @@ int xml2lpc_validate(xml2lpc_context *xmlCtx) {
xmlSchemaSetValidErrors
(
validCtx
,
xml2lpc_genericxml_error
,
xml2lpc_genericxml_warning
,
xmlCtx
);
int
ret
=
xmlSchemaValidateDoc
(
validCtx
,
xmlCtx
->
doc
);
if
(
ret
>
0
)
{
xml2lpc_log
(
xmlCtx
,
XML2LPC_WARNING
,
"%s"
,
xmlCtx
->
warningBuffer
);
xml2lpc_log
(
xmlCtx
,
XML2LPC_ERROR
,
"%s"
,
xmlCtx
->
errorBuffer
);
if
(
strlen
(
xmlCtx
->
warningBuffer
)
>
0
)
xml2lpc_log
(
xmlCtx
,
XML2LPC_WARNING
,
"%s"
,
xmlCtx
->
warningBuffer
);
if
(
strlen
(
xmlCtx
->
errorBuffer
)
>
0
)
xml2lpc_log
(
xmlCtx
,
XML2LPC_ERROR
,
"%s"
,
xmlCtx
->
errorBuffer
);
}
else
if
(
ret
<
0
)
{
xml2lpc_log
(
xmlCtx
,
XML2LPC_ERROR
,
"Internal error"
);
}
...
...
@@ -242,6 +244,13 @@ int xml2lpc_validate(xml2lpc_context *xmlCtx) {
int
xml2lpc_convert
(
xml2lpc_context
*
xmlCtx
,
LpConfig
*
lpc
)
{
xml2lpc_context_clear_logs
(
xmlCtx
);
if
(
xmlCtx
->
doc
==
NULL
)
{
xml2lpc_log
(
xmlCtx
,
XML2LPC_ERROR
,
"No doc set"
);
return
-
1
;
}
if
(
lpc
==
NULL
)
{
xml2lpc_log
(
xmlCtx
,
XML2LPC_ERROR
,
"Invalid lpc"
);
}
xmlCtx
->
lpc
=
lpc
;
return
internal_convert_xml2lpc
(
xmlCtx
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment