Changeset 208

Show
Ignore:
Timestamp:
04/23/10 17:01:18 (22 months ago)
Author:
ol
Message:

escape XML entities on char and varchar column also, and not only on text columns. Related to #45

Location:
src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/ows_api.h

    r205 r208  
    1717void buffer_add_int (buffer * buf, int i); 
    1818void buffer_add_str (buffer * buf, const char *str); 
     19bool buffer_cmp (const buffer * buf, const char *str); 
     20bool buffer_ncmp(const buffer * buf, const char *str, size_t n); 
    1921bool buffer_case_cmp (const buffer * buf, const char *str); 
    20 bool buffer_cmp (const buffer * buf, const char *str); 
    2122void buffer_copy (buffer * dest, const buffer * src); 
    2223void buffer_empty (buffer * buf); 
  • src/struct/buffer.c

    r182 r208  
    307307 
    308308/* 
     309 * Check if a buffer string is the same than another, on the n first char 
     310 */ 
     311bool buffer_ncmp(const buffer * buf, const char *str, size_t n) 
     312{ 
     313    size_t i; 
     314 
     315    assert(buf != NULL); 
     316    assert(str != NULL); 
     317 
     318    if (buf->use < n) return false; 
     319 
     320    for (i = 0 ; i < n ; i++) 
     321        if (buf->buf[i] != str[i]) 
     322            return false; 
     323 
     324    return true; 
     325} 
     326 
     327/* 
    309328 * Check if a buffer string is the same than anoter for a specified length 
    310329 * (insensitive case check) 
  • src/wfs/wfs_get_feature.c

    r201 r208  
    140140            fprintf(o->output, "false"); 
    141141 
    142     /* FIXME what about varchar or char postgreSQL type ? */  
    143     } else if (buffer_cmp(prop_type, "text")) { 
    144         value_encoded = buffer_encode_xml_entities(value); 
     142    } else if (buffer_cmp(prop_type, "text") 
     143            || buffer_ncmp(prop_type, "char", 4) 
     144            || buffer_ncmp(prop_type, "varchar", 7)) { 
     145            value_encoded = buffer_encode_xml_entities(value); 
    145146        fprintf(o->output, "%s", value_encoded->buf); 
    146147        buffer_free(value_encoded); 
    147     } else  
    148         fprintf(o->output, "%s", value->buf); 
     148 
     149    } else fprintf(o->output, "%s", value->buf); 
    149150     
    150151    if (gml_ns)