[asterisk-commits] eliel: branch group/appdocsxml r143336 - /team/group/appdocsxml/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 17 12:42:01 CDT 2008
Author: eliel
Date: Wed Sep 17 12:42:00 2008
New Revision: 143336
URL: http://svn.digium.com/view/asterisk?view=rev&rev=143336
Log:
Fix an issue while wrapping the text to a fixed size and trying to cut the line in the middle
of an ESC sequence.
Remove a not needed space while printing especial tags like 'literal', 'emphasis', etc.
Modified:
team/group/appdocsxml/main/pbx.c
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=143336&r1=143335&r2=143336
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Wed Sep 17 12:42:00 2008
@@ -2944,6 +2944,11 @@
/* Wait for the next space? */
if (*t == ' ') {
break;
+ } else if (*t == ESC) {
+ /* bypass escape sequences. */
+ while (*t && *t != 'm') {
+ t++;
+ }
}
sep--;
}
@@ -2954,6 +2959,9 @@
while (sep > 0) {
t--;
if (*t == ' ') {
+ break;
+ } else if (*t == 'm') { /* XXX: Possible ESC don't continue */
+ sep = 0;
break;
}
sep--;
@@ -2973,6 +2981,7 @@
}
needtobreak = 0;
}
+
}
/* skip blanks after a \n */
while (*in == ' ') {
@@ -2987,10 +2996,12 @@
}
if (*in == ESC) {
/* Ignore Escape sequences. */
- while (*in && *in != 'm') {
+ do {
tmp[tmplen++] = *in;
in++;
- }
+ } while (*in && *in != 'm');
+ tmp[tmplen++] = *in;
+ in++;
} else {
tmp[tmplen++] = *in;
count++;
@@ -3504,10 +3515,10 @@
ast_xml_free_text(tmptext);
if (cleantext) {
if (strcasecmp((char *)tmp->AST_XML_NAME, "text")) {
- /* + 6 for= " <></>" */
- *buffer = ast_realloc(*buffer, *len + strlen(cleantext) + (strlen((char *)tmp->AST_XML_NAME) * 2) + 6 + 1);
+ /* + 5 for= "<></>" */
+ *buffer = ast_realloc(*buffer, *len + strlen(cleantext) + (strlen((char *)tmp->AST_XML_NAME) * 2) + 5 + 1);
/* The last space is not returned by getContent? */
- *len += sprintf(*buffer + *len, " <%s>%s</%s>", tmp->AST_XML_NAME, cleantext, tmp->AST_XML_NAME);
+ *len += sprintf(*buffer + *len, "<%s>%s</%s>", tmp->AST_XML_NAME, cleantext, tmp->AST_XML_NAME);
} else {
*buffer = ast_realloc(*buffer, *len + strlen(cleantext) + 1);
ast_copy_string(*buffer + *len, cleantext, strlen(cleantext) + 1);
@@ -3532,6 +3543,8 @@
* \param buffer Output buffer to put values found inside the <argument> element.
* \param len Output buffer length (will be modified if data is appended to buffer).
* \param fixnode Pointer to the 'argument' xml node.
+ * \retval 1 If there is content inside the argument.
+ * \retval 0 If the argument element is not parsed, or there is no content inside it.
*/
static int xmldoc_parse_argument(const char *tabs, char **buffer, int *len, ast_xml_node *fixnode)
{
@@ -3919,7 +3932,6 @@
}
/* if found, parse a <variablelist> element. */
xmldoc_parse_variablelist(tmp, "", &len, &ret);
-
tmp = tmp->AST_XML_NEXT;
}
}
More information about the asterisk-commits
mailing list