- Timestamp:
- 2011-10-21T03:59:14Z (13 years ago)
- Branches:
- master
- Children:
- de26f3c
- Parents:
- 3864c08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/xmltree.c
r3864c08 re6b41b1 557 557 } 558 558 559 /* Strip a few non-printable characters that aren't allowed in XML streams 560 (and upset some XMPP servers for example). */ 561 void xt_strip_text( char *in ) 562 { 563 char *out = in; 564 static const char nonprint[32] = { 565 0, 0, 0, 0, 0, 0, 0, 0, /* 0..7 */ 566 0, 1, 1, 0, 0, 1, 0, 0, /* 9 (tab), 10 (\n), 13 (\r) */ 567 }; 568 569 if( !in ) 570 return; 571 572 while( *in ) 573 { 574 if( (unsigned int) *in >= ' ' || nonprint[(unsigned int) *in] ) 575 *out ++ = *in; 576 in ++; 577 } 578 *out = *in; 579 } 580 559 581 struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children ) 560 582 { … … 568 590 if( text ) 569 591 { 570 node->text_len = strlen( text ); 571 node->text = g_memdup( text, node->text_len + 1 ); 592 node->text = g_strdup( text ); 593 xt_strip_text( node->text ); 594 node->text_len = strlen( node->text ); 572 595 } 573 596
Note: See TracChangeset
for help on using the changeset viewer.