| 228 | } |
| 229 | |
| 230 | char *av_strireplace(const char *str, const char *from, const char *to) |
| 231 | { |
| 232 | char *ret = NULL; |
| 233 | const char *pstr2, *pstr = str; |
| 234 | size_t tolen = strlen(to), fromlen = strlen(from); |
| 235 | AVBPrint pbuf; |
| 236 | |
| 237 | av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); |
| 238 | while ((pstr2 = av_stristr(pstr, from))) { |
| 239 | av_bprint_append_data(&pbuf, pstr, pstr2 - pstr); |
| 240 | pstr = pstr2 + fromlen; |
| 241 | av_bprint_append_data(&pbuf, to, tolen); |
| 242 | } |
| 243 | av_bprint_append_data(&pbuf, pstr, strlen(pstr)); |
| 244 | if (!av_bprint_is_complete(&pbuf)) { |
| 245 | av_bprint_finalize(&pbuf, NULL); |
| 246 | } else { |
| 247 | av_bprint_finalize(&pbuf, &ret); |
| 248 | } |
| 249 | |
| 250 | return ret; |
| 251 | } |
| 252 | |
| 253 | const char *av_basename(const char *path) |
| 254 | { |
no test coverage detected