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)
include(CheckCXXSourceCompiles)
#check for libz using the cmake supplied FindZLIB.cmake
+FIND_PACKAGE(ZLIB REQUIRED)
IF(ZLIB_FOUND)
SET(HAVE_ZLIB 1)
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 )
#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;
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)