mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-29 18:29:07 +08:00
Merge pull request #1251 from evpobr/fix-taglib-createfile2
Fix TagLib port configuration under Win 7 and lower
This commit is contained in:
commit
bb303ac11b
@ -1,4 +1,4 @@
|
||||
Source: taglib
|
||||
Version: 1.11.1-2
|
||||
Version: 1.11.1-3
|
||||
Description: TagLib Audio Meta-Data Library
|
||||
Build-Depends: zlib
|
@ -1,18 +0,0 @@
|
||||
diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
|
||||
index b267aaa..3db0521 100644
|
||||
--- a/taglib/toolkit/tfilestream.cpp
|
||||
+++ b/taglib/toolkit/tfilestream.cpp
|
||||
@@ -54,7 +54,12 @@ namespace
|
||||
if(!path.wstr().empty())
|
||||
return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
else if(!path.str().empty())
|
||||
- return CreateFile2(std::wstring(path.str().cbegin(), path.str().end()).c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
+ {
|
||||
+ auto size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path.str().data(), path.str().size(), NULL, 0);
|
||||
+ std::wstring tmp(size, L'\0');
|
||||
+ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path.str().data(), path.str().size(), &tmp[0], tmp.size());
|
||||
+ return CreateFile2(tmp.c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
+ }
|
||||
else
|
||||
return InvalidFileHandle;
|
||||
}
|
@ -1,29 +1,21 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/taglib-1.11.1)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO taglib/taglib
|
||||
REF v1.11.1
|
||||
SHA512 7846775c4954ea948fe4383e514ba7c11f55d038ee06b6ea5a0a1c1069044b348026e76b27aa4ba1c71539aa8143e1401fab39184cc6e915ba0ae2c06133cb98
|
||||
REF 662f340f933077a926de443c9882f483973570e3
|
||||
SHA512 34087f77bb099f1f8ec82926a212a562bf589fc13f54eac50a56730c4411af2f4dbf1b7d09877087899048c3070325aea02297c6a94d0ad43fbf6742363dd2b6
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
if(NOT VCPKG_USE_HEAD_VERSION) # these have been fixed upstream after 1.11.1
|
||||
# patches for UWP
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/replace_non-uwp_functions.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/dont-assume-latin-1.patch
|
||||
)
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(WINRT_OPTIONS -DHAVE_VSNPRINTF=1 -DPLATFORM_WINRT=1)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DHAVE_VSNPRINTF=1 # taglib/ConfigureChecks.cmake doesn't properly detect MSVC vsnprintf() on UWP
|
||||
OPTIONS ${WINRT_OPTIONS}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
@ -1,29 +0,0 @@
|
||||
diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
|
||||
index 5205bae..b267aaa 100644
|
||||
--- a/taglib/toolkit/tfilestream.cpp
|
||||
+++ b/taglib/toolkit/tfilestream.cpp
|
||||
@@ -52,9 +52,9 @@ namespace
|
||||
const DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE);
|
||||
|
||||
if(!path.wstr().empty())
|
||||
- return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
+ return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
else if(!path.str().empty())
|
||||
- return CreateFileA(path.str().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
+ return CreateFile2(std::wstring(path.str().cbegin(), path.str().end()).c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
else
|
||||
return InvalidFileHandle;
|
||||
}
|
||||
@@ -437,9 +437,10 @@ long FileStream::length()
|
||||
#ifdef _WIN32
|
||||
|
||||
SetLastError(NO_ERROR);
|
||||
- const DWORD fileSize = GetFileSize(d->file, NULL);
|
||||
+ LARGE_INTEGER fileSize;
|
||||
+ GetFileSizeEx(d->file, &fileSize);
|
||||
if(GetLastError() == NO_ERROR) {
|
||||
- return static_cast<long>(fileSize);
|
||||
+ return fileSize.QuadPart;
|
||||
}
|
||||
else {
|
||||
debug("FileStream::length() -- Failed to get the file size.");
|
Loading…
Reference in New Issue
Block a user