[vlc-devel] [PATCH] win32: remove unused vlc_win32_tmpfile

Steve Lhomme robux4 at ycbcr.xyz
Wed Oct 14 10:27:22 CEST 2020


---
 include/vlc_fixups.h   |  4 ----
 src/win32/filesystem.c | 40 ----------------------------------------
 2 files changed, 44 deletions(-)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 51286f56d61..9149c7519fa 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -663,10 +663,6 @@ void sincosf(float, float *, float *);
 char *realpath(const char * restrict pathname, char * restrict resolved_path);
 #endif
 
-#ifdef _WIN32
-FILE *vlc_win32_tmpfile(void);
-#endif
-
 /* mingw-w64 has a broken IN6_IS_ADDR_MULTICAST macro */
 #if defined(_WIN32) && defined(__MINGW64_VERSION_MAJOR)
 # define IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_MULTICAST
diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
index 0a0656dbba6..d8e3cc1127d 100644
--- a/src/win32/filesystem.c
+++ b/src/win32/filesystem.c
@@ -376,43 +376,3 @@ ssize_t vlc_sendmsg(int fd, const struct msghdr *msg, int flags)
 {
     return sendmsg(fd, msg, flags);
 }
-
-#if !VLC_WINSTORE_APP
-FILE *vlc_win32_tmpfile(void)
-{
-    WCHAR tmp_path[MAX_PATH-14];
-    int i_ret = GetTempPath (MAX_PATH-14, tmp_path);
-    if (i_ret == 0)
-        return NULL;
-
-    WCHAR tmp_name[MAX_PATH];
-    i_ret = GetTempFileName(tmp_path, TEXT("VLC"), 0, tmp_name);
-    if (i_ret == 0)
-        return NULL;
-
-    HANDLE hFile = CreateFile(tmp_name,
-            GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS,
-            FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL);
-    if (hFile == INVALID_HANDLE_VALUE)
-        return NULL;
-
-    int fd = _open_osfhandle((intptr_t)hFile, 0);
-    if (fd == -1) {
-        CloseHandle(hFile);
-        return NULL;
-    }
-
-    FILE *stream = _fdopen(fd, "w+b");
-    if (stream == NULL) {
-        _close(fd);
-        return NULL;
-    }
-    return stream;
-}
-#else
-FILE *vlc_win32_tmpfile(void)
-{
-    return NULL;
-}
-#endif
-
-- 
2.26.2



More information about the vlc-devel mailing list