#define SGL_QUOTE_XESCAPE "'"
#define DBL_QUOTE_XESCAPE """
-int escape_xml_attr_len(const char *buf)
+size_t escape_xml_attr_len(const char *buf)
{
const char *b;
- int ret = 0;
+ size_t ret = 0;
for (b = buf; *b; ++b) {
unsigned char c = *b;
switch (c) {
#define TAB_JESCAPE "\\t"
#define NEWLINE_JESCAPE "\\n"
-int escape_json_attr_len(const char *buf, int src_len)
+size_t escape_json_attr_len(const char *buf, size_t src_len)
{
const char *b;
- int ret = 0;
- int i;
+ size_t i, ret = 0;
for (i = 0, b = buf; i < src_len; ++i, ++b) {
unsigned char c = *b;
switch (c) {
return ret;
}
-void escape_json_attr(const char *buf, int src_len, char *out)
+void escape_json_attr(const char *buf, size_t src_len, char *out)
{
char *o = out;
const char *b;
- int i;
+ size_t i;
for (i = 0, b = buf; i < src_len; ++i, ++b) {
unsigned char c = *b;
switch (c) {
/* Returns the length of a buffer that would be needed to escape 'buf'
* as an XML attrribute
*/
-int escape_xml_attr_len(const char *buf);
+size_t escape_xml_attr_len(const char *buf);
/* Escapes 'buf' as an XML attribute. Assumes that 'out' is at least long
* enough to fit the output. You can find out the required length by calling
/* Returns the length of a buffer that would be needed to escape 'buf'
* as an JSON attrribute
*/
-int escape_json_attr_len(const char *buf, int src_len);
+size_t escape_json_attr_len(const char *buf, size_t src_len);
/* Escapes 'buf' as an JSON attribute. Assumes that 'out' is at least long
* enough to fit the output. You can find out the required length by calling
* escape_json_attr_len first.
*/
-void escape_json_attr(const char *buf, int src_len, char *out);
+void escape_json_attr(const char *buf, size_t src_len, char *out);
/* Note: we escape control characters. Although the XML spec doesn't actually
* require this, Amazon does it in their XML responses.