]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: use size_t for object size
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 24 Jan 2018 19:26:42 +0000 (11:26 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 7 Feb 2018 14:40:46 +0000 (06:40 -0800)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/common/escape.cc
src/common/escape.h

index 78659b0bfb29b8950c75f6482f828ed37a2233fc..4e6b7f7f66a8ad91a5f4f69f32ee17cdf3806a75 100644 (file)
 #define SGL_QUOTE_XESCAPE              "&apos;"
 #define DBL_QUOTE_XESCAPE              "&quot;"
 
-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) {
@@ -173,11 +173,10 @@ std::ostream& operator<<(std::ostream& out, const xml_stream_escaper& e)
 #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) {
@@ -208,11 +207,11 @@ int escape_json_attr_len(const char *buf, int src_len)
        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) {
index 277a208174c6364a18689a21040e4f7c4dbde081..22da777212a58e1b03775542bf997e61ce046f1c 100644 (file)
@@ -21,7 +21,7 @@
 /* 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
@@ -32,13 +32,13 @@ void escape_xml_attr(const char *buf, char *out);
 /* 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.