From 322085f90e328dd588c967f9623d3cd5faf8892a Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sun, 2 Jul 2023 22:17:54 +0200 Subject: [PATCH] Windows: Remove unused FileName member, disable two warnings --- CMakeLists.txt | 6 ++++-- taglib/fileref.cpp | 2 +- taglib/toolkit/tiostream.cpp | 16 ---------------- taglib/toolkit/tiostream.h | 3 --- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f65ba75..e6812e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,10 @@ if(MSVC) # Disable warnings for internal invocations of API functions # that have been marked with TAGLIB_DEPRECATED # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") + # Also disable C4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation + # and C4251: needs to have dll-interface to be used by clients. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4910 /wd4251") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4910 /wd4251") endif() # Read version information from file taglib/toolkit/taglib.h into variables diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp index 46f3945a..7465221a 100644 --- a/taglib/fileref.cpp +++ b/taglib/fileref.cpp @@ -68,7 +68,7 @@ namespace AudioProperties::ReadStyle audioPropertiesStyle) { #ifdef _WIN32 - if(::strlen(fileName) == 0 && ::wcslen(fileName) == 0) + if(::wcslen(fileName) == 0) return 0; #else if(::strlen(fileName) == 0) diff --git a/taglib/toolkit/tiostream.cpp b/taglib/toolkit/tiostream.cpp index de0bd505..3bc3cc5b 100644 --- a/taglib/toolkit/tiostream.cpp +++ b/taglib/toolkit/tiostream.cpp @@ -49,22 +49,17 @@ namespace } } -// m_name is no longer used, but kept for backward compatibility. - FileName::FileName(const wchar_t *name) : - m_name(), m_wname(name) { } FileName::FileName(const char *name) : - m_name(), m_wname(ansiToUnicode(name)) { } FileName::FileName(const FileName &name) : - m_name(), m_wname(name.m_wname) { } @@ -74,21 +69,11 @@ FileName::operator const wchar_t *() const return m_wname.c_str(); } -FileName::operator const char *() const -{ - return m_name.c_str(); -} - const std::wstring &FileName::wstr() const { return m_wname; } -const std::string &FileName::str() const -{ - return m_name; -} - String FileName::toString() const { return String(m_wname.c_str()); @@ -111,4 +96,3 @@ IOStream::~IOStream() void IOStream::clear() { } - diff --git a/taglib/toolkit/tiostream.h b/taglib/toolkit/tiostream.h index 4e8b6704..d47e57a9 100644 --- a/taglib/toolkit/tiostream.h +++ b/taglib/toolkit/tiostream.h @@ -42,15 +42,12 @@ namespace TagLib { FileName(const FileName &name); operator const wchar_t *() const; - operator const char *() const; const std::wstring &wstr() const; - const std::string &str() const; String toString() const; private: - const std::string m_name; const std::wstring m_wname; }; #else