aboutsummaryrefslogtreecommitdiff
path: root/ports/sndfile/uwp-createfile-getfilesize.patch
diff options
context:
space:
mode:
authorevpobr <evpobr@gmail.com>2019-05-03 00:02:03 +0500
committerPhil Christensen <philc@microsoft.com>2019-05-02 12:02:03 -0700
commitbba224b978935c8d8759ba5ae47d2ac9735dd545 (patch)
treeefd25367f2e227fcb33747d5c05dd43aa6033658 /ports/sndfile/uwp-createfile-getfilesize.patch
parent969ed5fbc1b306acb076b1c900cd87f0e1f4194f (diff)
downloadvcpkg-bba224b978935c8d8759ba5ae47d2ac9735dd545.tar.gz
vcpkg-bba224b978935c8d8759ba5ae47d2ac9735dd545.zip
[sndfile] Add new port sndfile (#4514)
* [port] Add sndfile port
Diffstat (limited to 'ports/sndfile/uwp-createfile-getfilesize.patch')
-rw-r--r--ports/sndfile/uwp-createfile-getfilesize.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/ports/sndfile/uwp-createfile-getfilesize.patch b/ports/sndfile/uwp-createfile-getfilesize.patch
new file mode 100644
index 000000000..0e60cde54
--- /dev/null
+++ b/ports/sndfile/uwp-createfile-getfilesize.patch
@@ -0,0 +1,58 @@
+diff --git a/src/file_io.c b/src/file_io.c
+index 7cf8f0c..47351bc 100644
+--- a/src/file_io.c
++++ b/src/file_io.c
+@@ -787,6 +787,19 @@ psf_open_handle (PSF_FILE * pfile)
+ return NULL ;
+ } ;
+
++#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
++ if (!pfile->use_wchar)
++ return NULL;
++
++ CREATEFILE2_EXTENDED_PARAMETERS cfParams = {0};
++ cfParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
++ cfParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
++
++ handle = CreateFile2(pfile->path.wc, dwDesiredAccess, dwShareMode, dwCreationDistribution, &cfParams);
++
++ if (handle == INVALID_HANDLE_VALUE)
++ return NULL;
++#else
+ if (pfile->use_wchar)
+ handle = CreateFileW (
+ pfile->path.wc, /* pointer to name of the file */
+@@ -812,6 +825,7 @@ psf_open_handle (PSF_FILE * pfile)
+ return NULL ;
+
+ return handle ;
++#endif
+ } /* psf_open_handle */
+
+ /* USE_WINDOWS_API */ static void
+@@ -1104,7 +1118,16 @@ psf_is_pipe (SF_PRIVATE *psf)
+
+ /* USE_WINDOWS_API */ sf_count_t
+ psf_get_filelen_handle (HANDLE handle)
+-{ sf_count_t filelen ;
++{
++#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
++ LARGE_INTEGER size;
++
++ if (!GetFileSizeEx(handle, &size) && GetLastError() != NO_ERROR)
++ return (sf_count_t) -1 ;
++
++ return size.QuadPart;
++#else
++ sf_count_t filelen ;
+ DWORD dwFileSizeLow, dwFileSizeHigh, dwError = NO_ERROR ;
+
+ dwFileSizeLow = GetFileSize (handle, &dwFileSizeHigh) ;
+@@ -1118,6 +1141,7 @@ psf_get_filelen_handle (HANDLE handle)
+ filelen = dwFileSizeLow + ((__int64) dwFileSizeHigh << 32) ;
+
+ return filelen ;
++#endif
+ } /* psf_get_filelen_handle */
+
+ /* USE_WINDOWS_API */ void