add ports/taglib

This commit is contained in:
Joshua Helm 2017-04-27 11:12:00 -04:00
parent 0bc4987644
commit e7aadfa216
5 changed files with 114 additions and 0 deletions

4
ports/taglib/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: taglib
Version: 1.11.1
Description: TagLib Audio Meta-Data Library
Build-Depends: zlib

24
ports/taglib/copyright Normal file
View File

@ -0,0 +1,24 @@
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library 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 this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/

View File

@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a59efc9..8ac3266 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,11 @@ if(MSVC AND ENABLE_STATIC_RUNTIME)
endforeach(flag_var)
endif()
+# disable error on usage of vsprintf() for UWP builds
+if(MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
+endif()
+
# Read version information from file taglib/toolkit/taglib.h into variables
# TAGLIB_LIB_MAJOR_VERSION, TAGLIB_LIB_MINOR_VERSION, TAGLIB_LIB_PATCH_VERSION.
foreach(version_part MAJOR MINOR PATCH)

View File

@ -0,0 +1,41 @@
# taglib
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/taglib-1.11.1)
vcpkg_download_distfile(ARCHIVE
URLS "http://taglib.org/releases/taglib-1.11.1.tar.gz"
FILENAME "taglib-1.11.1.tar.gz"
SHA512 7846775c4954ea948fe4383e514ba7c11f55d038ee06b6ea5a0a1c1069044b348026e76b27aa4ba1c71539aa8143e1401fab39184cc6e915ba0ae2c06133cb98
)
vcpkg_extract_source_archive(${ARCHIVE})
#patches for UWP
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/ignore_c4996_error.patch
${CMAKE_CURRENT_LIST_DIR}/replace_non-uwp_functions.patch
)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
# remove the debug/include files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# copyright file
file(COPY ${CURRENT_PORT_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/taglib)
# remove bin directory for static builds (taglib creates a cmake batch file there)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

View File

@ -0,0 +1,29 @@
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.");