| 2841 | */ |
| 2842 | |
| 2843 | static void |
| 2844 | html_escape(ippeve_client_t *client, /* I - Client */ |
| 2845 | const char *s, /* I - String to write */ |
| 2846 | size_t slen) /* I - Number of characters to write */ |
| 2847 | { |
| 2848 | const char *start, /* Start of segment */ |
| 2849 | *end; /* End of string */ |
| 2850 | |
| 2851 | |
| 2852 | start = s; |
| 2853 | end = s + (slen > 0 ? slen : strlen(s)); |
| 2854 | |
| 2855 | while (*s && s < end) |
| 2856 | { |
| 2857 | if (*s == '&' || *s == '<') |
| 2858 | { |
| 2859 | if (s > start) |
| 2860 | httpWrite2(client->http, start, (size_t)(s - start)); |
| 2861 | |
| 2862 | if (*s == '&') |
| 2863 | httpWrite2(client->http, "&", 5); |
| 2864 | else |
| 2865 | httpWrite2(client->http, "<", 4); |
| 2866 | |
| 2867 | start = s + 1; |
| 2868 | } |
| 2869 | |
| 2870 | s ++; |
| 2871 | } |
| 2872 | |
| 2873 | if (s > start) |
| 2874 | httpWrite2(client->http, start, (size_t)(s - start)); |
| 2875 | } |
| 2876 | |
| 2877 | |
| 2878 | /* |
no test coverage detected