From 1d52e6f67c762fdb60f4dc324ee9d69acc4884d1 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 28 Apr 2007 16:17:30 +0000 Subject: [PATCH] win32 compile / warnings-- git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@658838 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- CMakeLists.txt | 3 +++ ConfigureChecks.cmake | 1 + taglib/CMakeLists.txt | 15 ++++++++++++++- taglib/toolkit/tfile.cpp | 18 +++++++++++++++--- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73ff8fae..84b5b0dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,9 @@ if (CMAKE_COMPILER_IS_GNUCXX) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") endif (CMAKE_SYSTEM_NAME MATCHES Linux) endif (CMAKE_COMPILER_IS_GNUCXX) +if(MSVC) + add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE ) +endif(MSVC) include(ConfigureChecks.cmake) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index b8f19e84..54eae95b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -12,6 +12,7 @@ include(CheckTypeSize) include(CheckCXXSourceCompiles) #check for libz using the cmake supplied FindZLIB.cmake +FIND_PACKAGE(ZLIB REQUIRED) IF(ZLIB_FOUND) SET(HAVE_ZLIB 1) diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt index 1d1bf06d..1fcf47d1 100644 --- a/taglib/CMakeLists.txt +++ b/taglib/CMakeLists.txt @@ -1,6 +1,19 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/toolkit ${CMAKE_CURRENT_SOURCE_DIR}/mpeg ${CMAKE_CURRENT_SOURCE_DIR}/ogg ${CMAKE_CURRENT_SOURCE_DIR}/flac ${CMAKE_CURRENT_SOURCE_DIR}/mpc ${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2/ ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1 ${CMAKE_CURRENT_SOURCE_DIR}/ape ${CMAKE_CURRENT_BINARY_DIR}/taglib/ ${CMAKE_CURRENT_BINARY_DIR}/.. ) +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/toolkit + ${CMAKE_CURRENT_SOURCE_DIR}/mpeg + ${CMAKE_CURRENT_SOURCE_DIR}/ogg + ${CMAKE_CURRENT_SOURCE_DIR}/flac + ${CMAKE_CURRENT_SOURCE_DIR}/mpc + ${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis + ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2 + ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1 + ${CMAKE_CURRENT_SOURCE_DIR}/ape + ${CMAKE_CURRENT_BINARY_DIR}/taglib + ${CMAKE_CURRENT_BINARY_DIR}/.. + ${ZLIB_INCLUDE_DIR} +) ADD_SUBDIRECTORY( toolkit ) ADD_SUBDIRECTORY( mpeg ) diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp index ac4fd533..1828223c 100644 --- a/taglib/toolkit/tfile.cpp +++ b/taglib/toolkit/tfile.cpp @@ -25,7 +25,19 @@ #include #include -#include +#ifdef _WIN32 +# include +# define ftruncate _chsize +#else + #include +#endif + +#ifndef R_OK +# define R_OK 4 +#endif +#ifndef W_OK +# define W_OK 2 +#endif using namespace TagLib; @@ -421,12 +433,12 @@ bool File::isReadable(const char *file) bool File::isOpen() const { - return d->file; + return (d->file != NULL); } bool File::isValid() const { - return d->file && d->valid; + return isOpen() && d->valid; } void File::seek(long offset, Position p) -- 2.40.0