]> granicus.if.org Git - taglib/commitdiff
Fix compilation on MSVC/Windows
authorLukáš Lalinský <lalinsky@gmail.com>
Tue, 19 Feb 2008 19:52:04 +0000 (19:52 +0000)
committerLukáš Lalinský <lalinsky@gmail.com>
Tue, 19 Feb 2008 19:52:04 +0000 (19:52 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@777124 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

examples/CMakeLists.txt
examples/framelist.cpp
examples/tagwriter.cpp
taglib/mpeg/id3v2/id3v2framefactory.cpp
taglib/toolkit/tfile.cpp

index 1c06f7cfba533bb492d3370e83bc38a925f63f8a..50711d071f3e46bfae4083706ec0973d0e7ddafd 100644 (file)
@@ -1,6 +1,7 @@
 if(BUILD_EXAMPLES)
 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib
                     ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit
+                    ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape
                     ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
                     ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1
                     ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
index 58a4c32c467478fd24c8f312e9fb8e70088c95a8..dbe80feb8286b46c427989b76e84f6b0a87bbc62 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <iostream>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include <tbytevector.h>
 
index 0f81e8db80781ef15cecd010dc1bb6574d41c13e..63163fbedc5cad8d0cb5a2fcbd9a082937cb5aa9 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <stdlib.h>
 
 #include <tlist.h>
@@ -46,7 +45,11 @@ bool isArgument(const char *s)
 bool isFile(const char *s)
 {
   struct stat st;
+#ifdef _WIN32
+  return ::stat(s, &st) == 0 && (st.st_mode & (S_IFREG));
+#else
   return ::stat(s, &st) == 0 && (st.st_mode & (S_IFREG | S_IFLNK));
+#endif
 }
 
 void usage()
index 5d245cb28712b4770dbc95c4630edbc5c30957ad..48a202216c189e9454a23648c30013102cc19677 100644 (file)
@@ -98,7 +98,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
   // characters.  Also make sure that there is data in the frame.
 
   if(!frameID.size() == (version < 3 ? 3 : 4) ||
-     header->frameSize() <= (header->dataLengthIndicator() ? 4 : 0) ||
+     header->frameSize() <= uint(header->dataLengthIndicator() ? 4 : 0) ||
      header->frameSize() > data.size())
   {
     delete header;
index 4869a17a879b0257a0df2a6bb3f5d03f8a8461db..dcb86a288d26294a7b89faae933951fb7aa4650d 100644 (file)
@@ -91,18 +91,23 @@ File::FilePrivate::FilePrivate(FileName fileName) :
 
 #ifdef _WIN32
 
-  file = _wfopen(name, L"rb+");
+  if(wcslen((const wchar_t *) fileName) > 0) {
 
-  if(file)
-    readOnly = false;
-  else
-    file = _wfopen(name, L"rb");
+    file = _wfopen(name, L"rb+");
 
-  if(file)
-    return;
+    if(file)
+      readOnly = false;
+    else
+      file = _wfopen(name, L"rb");
+
+    if(file)
+      return;
+
+  }
 
 #endif
 
+  debug("trying ot use char");
   file = fopen(name, "rb+");
 
   if(file)