| 167 | }; |
| 168 | |
| 169 | apr_status_t md_data_to_hex(const char **phex, char separator, |
| 170 | apr_pool_t *p, const md_data_t *data) |
| 171 | { |
| 172 | char *hex, *cp; |
| 173 | const char * x; |
| 174 | unsigned int i; |
| 175 | |
| 176 | cp = hex = apr_pcalloc(p, ((separator? 3 : 2) * data->len) + 1); |
| 177 | if (!hex) { |
| 178 | *phex = NULL; |
| 179 | return APR_ENOMEM; |
| 180 | } |
| 181 | for (i = 0; i < data->len; ++i) { |
| 182 | x = hex_const[(unsigned char)data->data[i]]; |
| 183 | if (i && separator) *cp++ = separator; |
| 184 | *cp++ = x[0]; |
| 185 | *cp++ = x[1]; |
| 186 | } |
| 187 | *phex = hex; |
| 188 | return APR_SUCCESS; |
| 189 | } |
| 190 | |
| 191 | /**************************************************************************************************/ |
| 192 | /* generic arrays */ |
no outgoing calls
no test coverage detected