Changeset 252c882286e56574f7984bf23ad8b456fc3d9805
- Timestamp:
- 23/09/08 00:04:18
(2 months ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1222121058 +0200
- git-parent:
[897a63f65b1af3abf8038f02a6bd3f2491bc3eeb]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1222121058 +0200
- Message:
Use resolve_xml_special_chars where appropriate.
(noticed by Antoine Cellerier)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rc8b3f40 |
r252c882 |
|
| 41 | 41 | #include <vlc_xml.h> |
|---|
| 42 | 42 | #include <vlc_input.h> |
|---|
| | 43 | #include <vlc_strings.h> |
|---|
| 43 | 44 | |
|---|
| 44 | 45 | #include <math.h> |
|---|
| r0c4e17d |
r252c882 |
|
| 39 | 39 | #include <vlc_xml.h> |
|---|
| 40 | 40 | #include <vlc_input.h> |
|---|
| | 41 | #include <vlc_strings.h> |
|---|
| 41 | 42 | |
|---|
| 42 | 43 | #include <math.h> |
|---|
| r07a682d |
r252c882 |
|
| 495 | 495 | |
|---|
| 496 | 496 | /* */ |
|---|
| 497 | | static void HandleMarkup( char *psz_node ) |
|---|
| 498 | | { |
|---|
| 499 | | static const struct |
|---|
| 500 | | { |
|---|
| 501 | | const char *psz_pattern; |
|---|
| 502 | | char i_char; |
|---|
| 503 | | } p_replace[] = { |
|---|
| 504 | | { "<", '<' }, |
|---|
| 505 | | { ">", '>' }, |
|---|
| 506 | | { "&", '&' }, |
|---|
| 507 | | { """, '"' }, |
|---|
| 508 | | /* This one will always match */ |
|---|
| 509 | | { "&", '&' } |
|---|
| 510 | | }; |
|---|
| 511 | | |
|---|
| 512 | | char *s = psz_node; |
|---|
| 513 | | while( ( s = strchr( s, '&' ) ) != NULL ) |
|---|
| 514 | | { |
|---|
| 515 | | size_t i_size; |
|---|
| 516 | | int i; |
|---|
| 517 | | for( i = 0; ; i++ ) |
|---|
| 518 | | { |
|---|
| 519 | | i_size = strlen(p_replace[i].psz_pattern); |
|---|
| 520 | | if( !strncmp( s, p_replace[i].psz_pattern, i_size ) ) |
|---|
| 521 | | break; |
|---|
| 522 | | } |
|---|
| 523 | | if( i_size > 1 ) |
|---|
| 524 | | memmove( &s[1], &s[i_size], |
|---|
| 525 | | strlen( s ) - i_size + 1 ); |
|---|
| 526 | | *s++ = p_replace[i].i_char; |
|---|
| 527 | | } |
|---|
| 528 | | } |
|---|
| 529 | | |
|---|
| 530 | 497 | static int ProcessNodes( filter_t *p_filter, |
|---|
| 531 | 498 | xml_reader_t *p_xml_reader, |
|---|
| … | … | |
| 655 | 622 | /* */ |
|---|
| 656 | 623 | HandleWhiteSpace( psz_node ); |
|---|
| 657 | | HandleMarkup( psz_node ); |
|---|
| | 624 | resolve_xml_special_chars( psz_node ); |
|---|
| 658 | 625 | |
|---|
| 659 | 626 | SetupLine( p_filter, psz_node, &psz_text, |
|---|