| 1953 | #define ENDSWITH(c, e) ((c) == (e) || ((c) == 0 && endch == (e))) |
| 1954 | |
| 1955 | PUGI__FN char_t* strconv_comment(char_t* s, char_t endch) |
| 1956 | { |
| 1957 | gap g; |
| 1958 | |
| 1959 | while (true) |
| 1960 | { |
| 1961 | while (!PUGI__IS_CHARTYPE(*s, ct_parse_comment)) |
| 1962 | ++s; |
| 1963 | |
| 1964 | if (*s == '\r') // Either a single 0x0d or 0x0d 0x0a pair |
| 1965 | { |
| 1966 | *s++ = '\n'; // replace first one with 0x0a |
| 1967 | |
| 1968 | if (*s == '\n') |
| 1969 | g.push(s, 1); |
| 1970 | } |
| 1971 | else if (s[0] == '-' && s[1] == '-' && ENDSWITH(s[2], '>')) // comment ends here |
| 1972 | { |
| 1973 | *g.flush(s) = 0; |
| 1974 | |
| 1975 | return s + (s[2] == '>' ? 3 : 2); |
| 1976 | } |
| 1977 | else if (*s == 0) |
| 1978 | { |
| 1979 | return 0; |
| 1980 | } |
| 1981 | else |
| 1982 | ++s; |
| 1983 | } |
| 1984 | } |
| 1985 | |
| 1986 | PUGI__FN char_t* strconv_cdata(char_t* s, char_t endch) |
| 1987 | { |
no test coverage detected