don't use errno on win32
authorJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 13 Jun 2002 07:00:36 +0000 (07:00 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 13 Jun 2002 07:00:36 +0000 (07:00 +0000)
src/libFLAC/metadata_iterators.c

index c67a573..3f7e936 100644 (file)
  * Boston, MA  02111-1307, USA.
  */
 
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
 #include <errno.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -295,12 +298,17 @@ static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *it
        iterator->is_writable = false;
 
        if(0 == (iterator->file = fopen(iterator->filename, "r+b"))) {
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
                if(errno == EACCES) {
+#endif
                        if(0 == (iterator->file = fopen(iterator->filename, "rb"))) {
                                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
                                return false;
                        }
+#if !defined _MSC_VER && !defined __MINGW32__
                }
+#endif
                else {
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
                        return false;
@@ -1906,11 +1914,18 @@ unsigned seek_to_first_metadata_block_(FILE *f)
        FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == 4);
 
        /* skip any id3v2 tag */
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
        errno = 0;
+#endif
        n = fread(buffer, 1, 4, f);
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
        if(errno)
                return 1;
-       else if(n != 4)
+       else
+#endif
+       if(n != 4)
                return 2;
        else if(0 == memcmp(buffer, "ID3", 3)) {
                unsigned tag_length = 0;
@@ -1932,11 +1947,18 @@ unsigned seek_to_first_metadata_block_(FILE *f)
                        return 1;
 
                /* read the stream sync code */
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
                errno = 0;
+#endif
                n = fread(buffer, 1, 4, f);
+#if !defined _MSC_VER && !defined __MINGW32__
+/*@@@ don't know how to resolve errno without using LIBC.LIB; must use MSVCRT.LIB only for plugins */
                if(errno)
                        return 1;
-               else if(n != 4)
+               else
+#endif
+               if(n != 4)
                        return 2;
        }