MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_append_path_component

Function av_append_path_component

libavutil/avstring.c:297–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297char *av_append_path_component(const char *path, const char *component)
298{
299 size_t p_len, c_len;
300 char *fullpath;
301
302 if (!path)
303 return av_strdup(component);
304 if (!component)
305 return av_strdup(path);
306
307 p_len = strlen(path);
308 c_len = strlen(component);
309 if (p_len > SIZE_MAX - c_len || p_len + c_len > SIZE_MAX - 2)
310 return NULL;
311 fullpath = av_malloc(p_len + c_len + 2);
312 if (fullpath) {
313 if (p_len) {
314 av_strlcpy(fullpath, path, p_len + 1);
315 if (c_len) {
316 if (fullpath[p_len - 1] != '/' && component[0] != '/')
317 fullpath[p_len++] = '/';
318 else if (fullpath[p_len - 1] == '/' && component[0] == '/')
319 p_len--;
320 }
321 }
322 av_strlcpy(&fullpath[p_len], component, c_len + 1);
323 fullpath[p_len + c_len] = 0;
324 }
325 return fullpath;
326}
327
328int av_escape(char **dst, const char *src, const char *special_chars,
329 enum AVEscapeMode mode, int flags)

Callers 6

update_master_pl_infoFunction · 0.85
file_read_dirFunction · 0.85
imf_read_headerFunction · 0.85
libsmbc_read_dirFunction · 0.85
ftp_connectFunction · 0.85

Calls 3

av_strdupFunction · 0.85
av_strlcpyFunction · 0.85
av_mallocFunction · 0.70

Tested by

no test coverage detected