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

Function fopen_utf8

fftools/fopen_utf8.h:33–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "libavutil/wchar_filename.h"
32
33static inline FILE *fopen_utf8(const char *path_utf8, const char *mode)
34{
35 wchar_t *path_w, *mode_w;
36 FILE *f;
37
38 /* convert UTF-8 to wide chars */
39 if (get_extended_win32_path(path_utf8, &path_w)) /* This sets errno on error. */
40 return NULL;
41 if (!path_w)
42 goto fallback;
43
44 if (utf8towchar(mode, &mode_w))
45 return NULL;
46 if (!mode_w) {
47 /* If failing to interpret the mode string as utf8, it is an invalid
48 * parameter. */
49 av_freep(&path_w);
50 errno = EINVAL;
51 return NULL;
52 }
53
54 f = _wfopen(path_w, mode_w);
55 av_freep(&path_w);
56 av_freep(&mode_w);
57
58 return f;
59fallback:
60 /* path may be in CP_ACP */
61 return fopen(path_utf8, mode);
62}
63
64#else
65

Callers 3

init_reportFunction · 0.85
new_stream_videoFunction · 0.85
get_preset_fileFunction · 0.85

Calls 3

get_extended_win32_pathFunction · 0.85
utf8towcharFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected