]> granicus.if.org Git - taglib/commitdiff
win32 compile / warnings--
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>
Sat, 28 Apr 2007 16:17:30 +0000 (16:17 +0000)
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>
Sat, 28 Apr 2007 16:17:30 +0000 (16:17 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@658838 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

CMakeLists.txt
ConfigureChecks.cmake
taglib/CMakeLists.txt
taglib/toolkit/tfile.cpp

index 73ff8faef245780819f4ae7b0171d794b4f9665c..84b5b0dd6d1d472d4cb9784fb0691ed76bc014a1 100644 (file)
@@ -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)
 
index b8f19e84f722e011eb6951a2eba69636f8dbd7d3..54eae95b41cd63f4258a6770d29d6d99c9643ad5 100644 (file)
@@ -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)
index 1d1bf06d2be301c85e3391e164c4a3d48be78dd2..1fcf47d1373e60dbc356151031a9404ed7af62e8 100644 (file)
@@ -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 )
index ac4fd533d4e486af35d6056ca482270144b4fc34..1828223cb671edcdb18d4426bffc0352bb78eb65 100644 (file)
 
 #include <stdio.h>
 #include <sys/stat.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <io.h>
+# define ftruncate _chsize
+#else
+ #include <unistd.h>
+#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)