summaryrefslogtreecommitdiff
path: root/libavutil/wchar_filename.h
Commit message (Collapse)AuthorAge
* avutil/wchar_filename: Make the header C++ compatibleAndreas Rheinhardt2022-06-28
| | | | | | | | | | | When compiling decklink, this header is included from a C++ file (albeit inside 'extern "C"') and this causes compilation failures because of an implicit void* -> char* conversion. So add an explicit cast. Fixes ticket #9819. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi(), getenv_utf8(), ↵Nil Admirari2022-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | freeenv_utf8() and getenv_dup() wchartoutf8() converts strings returned by WinAPI into UTF-8, which is FFmpeg's preffered encoding. Some external dependencies, such as AviSynth, are still not Unicode-enabled. utf8toansi() converts UTF-8 strings into ANSI in two steps: UTF-8 -> wchar_t -> ANSI. wchartoansi() is responsible for the second step of the conversion. Conversion in just one step is not supported by WinAPI. Since these character converting functions allocate the buffer of necessary size, they also facilitate the removal of MAX_PATH limit in places where fixed-size ANSI/WCHAR strings were used as filename buffers. On Windows, getenv_utf8() wraps _wgetenv() converting its input from and its output to UTF-8. Strings returned by getenv_utf8() must be freed by freeenv_utf8(). On all other platforms getenv_utf8() is a wrapper around getenv(), and freeenv_utf8() is a no-op. The value returned by plain getenv() cannot be modified; av_strdup() is usually used when modifications are required. However, on Windows, av_strdup() after getenv_utf8() leads to unnecessary allocation. getenv_dup() is introduced to avoid such an allocation. Value returned by getenv_dup() must be freed by av_free(). Because of cleanup complexities, in places that only test the existence of an environment variable or compare its value with a string consisting entirely of ASCII characters, the use of plain getenv() is still preferred. (libavutil/log.c check_color_terminal() is an example of such a place.) Plain getenv() is also preffered in UNIX-only code, such as bktr.c, fbdev_common.c, oss.c in libavdevice or af_ladspa.c in libavfilter. Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/wchar_filename,file_open: Support long file names on Windowssoftworkz2022-06-09
| | | | | Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Merge commit 'e41daa62465036ad36ad0bd14e4936e848d7f07e'James Almer2017-11-11
|\ | | | | | | | | | | | | * commit 'e41daa62465036ad36ad0bd14e4936e848d7f07e': Remove support for building for mingw32ce (Windows CE) Merged-by: James Almer <jamrial@gmail.com>
| * Remove support for building for mingw32ce (Windows CE)Martin Storsjö2017-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The toolchain for this target is unmaintained since many years. While it has been continuously build tested on fate, it hasn't actually been tested at runtime since many, many years (and back then, only a few codecs in libavcodec were tested). So far, keeping support for it has been mostly effortless, but the compiler does seem to have issues with dllimported data symbols, ending up as internal compiler errors in some cases. Instead of jumping through further hoops to work around that, just remove the target. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avutil/wchar_filename: add av_warn_unused_resultGanesh Ajjanagadde2015-10-30
| | | | | | | | | | | | | | Current code is fine, this just adds robustness. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | Merge commit '9326d64ed1baadd7af60df6bbcc59cf1fefede48'Michael Niedermayer2014-11-27
|/ | | | | | | | | | | * commit '9326d64ed1baadd7af60df6bbcc59cf1fefede48': Share the utf8 to wchar conversion routine between lavf and lavu Conflicts: libavformat/os_support.h libavutil/file_open.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* Share the utf8 to wchar conversion routine between lavf and lavuMartin Storsjö2014-11-27
This doesn't add any dependency on library internals, since this only is a static inline function that gets built into each of the calling functions - this is only to reduce the code duplication. Signed-off-by: Martin Storsjö <martin@martin.st>