mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
e41daa6246
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>
89 lines
2.0 KiB
C
89 lines
2.0 KiB
C
/*
|
|
* This file is part of Libav.
|
|
*
|
|
* Libav is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* Libav is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with Libav; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include "internal.h"
|
|
#include "mem.h"
|
|
#include <stdarg.h>
|
|
#include <fcntl.h>
|
|
#include <sys/stat.h>
|
|
#if HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
#if HAVE_IO_H
|
|
#include <io.h>
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
|
#undef open
|
|
#undef lseek
|
|
#undef stat
|
|
#undef fstat
|
|
#include <windows.h>
|
|
#include <share.h>
|
|
#include <errno.h>
|
|
#include "wchar_filename.h"
|
|
|
|
static int win32_open(const char *filename_utf8, int oflag, int pmode)
|
|
{
|
|
int fd;
|
|
wchar_t *filename_w;
|
|
|
|
/* convert UTF-8 to wide chars */
|
|
if (utf8towchar(filename_utf8, &filename_w))
|
|
return -1;
|
|
if (!filename_w)
|
|
goto fallback;
|
|
|
|
fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode);
|
|
av_freep(&filename_w);
|
|
|
|
if (fd != -1 || (oflag & O_CREAT))
|
|
return fd;
|
|
|
|
fallback:
|
|
/* filename may be be in CP_ACP */
|
|
return _sopen(filename_utf8, oflag, SH_DENYNO, pmode);
|
|
}
|
|
#define open win32_open
|
|
#endif
|
|
|
|
int avpriv_open(const char *filename, int flags, ...)
|
|
{
|
|
int fd;
|
|
unsigned int mode = 0;
|
|
va_list ap;
|
|
|
|
va_start(ap, flags);
|
|
if (flags & O_CREAT)
|
|
mode = va_arg(ap, unsigned int);
|
|
va_end(ap);
|
|
|
|
#ifdef O_CLOEXEC
|
|
flags |= O_CLOEXEC;
|
|
#endif
|
|
|
|
fd = open(filename, flags, mode);
|
|
#if HAVE_FCNTL
|
|
if (fd != -1)
|
|
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
|
#endif
|
|
|
|
return fd;
|
|
}
|