mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 18:48:59 +08:00
Merge pull request #2216 from aybe/libsndfile-uwp
[libsndfile] patches for UWP builds
This commit is contained in:
commit
23932a841e
@ -1,4 +1,4 @@
|
||||
Source: libsndfile
|
||||
Version: 1.0.29-6830c42-1
|
||||
Version: 1.0.29-6830c42-2
|
||||
Description: Library to read, write and manipulate many soundfile types. Authored by Eric de Castro Lopo
|
||||
Build-Depends: libogg, libflac, libvorbis
|
||||
|
@ -19,6 +19,13 @@ vcpkg_download_distfile(ARCHIVE
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libsndfile-6830c421899e32f8d413a903a21a9b6cf384d369
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/uwp-createfile-getfilesize.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/uwp-createfile-getfilesize-addendum.patch"
|
||||
)
|
||||
|
||||
if (VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
||||
set(CRT_LIB_STATIC 0)
|
||||
elseif (VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
|
13
ports/libsndfile/uwp-createfile-getfilesize-addendum.patch
Normal file
13
ports/libsndfile/uwp-createfile-getfilesize-addendum.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/src/file_io.c b/src/file_io.c
|
||||
index 47351bc..54741c9 100644
|
||||
--- a/src/file_io.c
|
||||
+++ b/src/file_io.c
|
||||
@@ -799,6 +799,8 @@ psf_open_handle (PSF_FILE * pfile)
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
+
|
||||
+ return handle;
|
||||
#else
|
||||
if (pfile->use_wchar)
|
||||
handle = CreateFileW (
|
58
ports/libsndfile/uwp-createfile-getfilesize.patch
Normal file
58
ports/libsndfile/uwp-createfile-getfilesize.patch
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user