Removed JSON_CDATA_STRIP compile-time option (obsolete since 5.4)

This commit is contained in:
Olof hagsand 2022-11-07 10:07:10 +01:00
parent 4b21a05bcc
commit 1683723b1d
3 changed files with 1 additions and 34 deletions

View file

@ -80,6 +80,7 @@ Developers may need to change their code
### Minor features ### Minor features
* Removed `JSON_CDATA_STRIP` compile-time option (obsolete since 5.4)
* Added fuzz code for xpath * Added fuzz code for xpath
* List-pagination: Follow ietf-draft 100%: Removed list-pagination "presence" * List-pagination: Follow ietf-draft 100%: Removed list-pagination "presence"
* Main example: Removed dependency of external IETF RFCs * Main example: Removed dependency of external IETF RFCs

View file

@ -127,17 +127,6 @@
*/ */
#undef LIST_PAGINATION_REMAINING #undef LIST_PAGINATION_REMAINING
/*! XML CDATA encoding in payload is stripped when translating to JSON
* Example: XML: "<s><![CDATA[ z > x & x < y ]]></s>" is translated to
* JSON: {"s":" z > x & x < y "}
* If not set:
* JSON: {"s":"<![CDATA[ z > x & x < y ]]>"}`
* Clixon stripped CDATA in 5.3 and earlier versions.
* To keep this backward-compatible enable this option
* Consider removing this option after 5.4
*/
#undef JSON_CDATA_STRIP
/*! /*!
* RFC 7950 generally does not specify an XML/JSON encoding order of sub-elements of list or * RFC 7950 generally does not specify an XML/JSON encoding order of sub-elements of list or
* containers. See sections 7.5.7 and 7.8.5 * containers. See sections 7.5.7 and 7.8.5

View file

@ -251,9 +251,6 @@ json_str_escape_cdata(cbuf *cb,
int retval = -1; int retval = -1;
int i; int i;
size_t len; size_t len;
#ifdef JSON_CDATA_STRIP
int esc = 0; /* cdata escape */
#endif
len = strlen(str); len = strlen(str);
for (i=0; i<len; i++) for (i=0; i<len; i++)
@ -267,26 +264,6 @@ json_str_escape_cdata(cbuf *cb,
case '\\': case '\\':
cprintf(cb, "\\\\"); cprintf(cb, "\\\\");
break; break;
#ifdef JSON_CDATA_STRIP
case '<':
if (!esc &&
strncmp(&str[i], "<![CDATA[", strlen("<![CDATA[")) == 0){
esc=1;
i += strlen("<![CDATA[")-1;
}
else
cprintf(cb, "%c", str[i]);
break;
case ']':
if (esc &&
strncmp(&str[i], "]]>", strlen("]]>")) == 0){
esc=0;
i += strlen("]]>")-1;
}
else
cprintf(cb, "%c", str[i]);
break;
#endif /* JSON_CDATA_STRIP */
default: /* fall thru */ default: /* fall thru */
cprintf(cb, "%c", str[i]); cprintf(cb, "%c", str[i]);
break; break;