made some code dependent on HAVE_SYS_STAT_H.
authorkramm <kramm>
Mon, 29 Oct 2001 16:14:06 +0000 (16:14 +0000)
committerkramm <kramm>
Mon, 29 Oct 2001 16:14:06 +0000 (16:14 +0000)
src/swfdump.c

index 7f58a1f..df55e9b 100644 (file)
@@ -7,8 +7,9 @@
 \r
    This file is distributed under the GPL, see file COPYING for details */\r
 \r
+#ifdef HAVE_SYS_STAT_H\r
 #include <sys/stat.h>\r
-#include <sys/types.h>\r
+#endif\r
 #include <unistd.h>\r
 #include <stdio.h>\r
 #include <fcntl.h>\r
@@ -59,7 +60,9 @@ int main (int argc,char ** argv)
 { \r
     SWF swf;\r
     TAG*tag;\r
+#ifdef HAVE_SYS_STAT_H\r
     struct stat statbuf;\r
+#endif\r
     int f;\r
     char prefix[128];\r
     prefix[0] = 0;\r
@@ -68,7 +71,6 @@ int main (int argc,char ** argv)
     processargs(argc, argv);\r
 \r
     f = open(filename,O_RDONLY);\r
-    fstat(f, &statbuf);\r
 \r
     if (f<0)\r
     { \r
@@ -81,13 +83,18 @@ int main (int argc,char ** argv)
         close(f);\r
        exit(1);\r
     }\r
-    close(f);\r
 \r
-    printf("[HEADER]        File version: %d\n", swf.FileVersion);\r
-    printf("[HEADER]        File size: %d\n", swf.FileSize);\r
+#ifdef HAVE_SYS_STAT_H\r
+    fstat(f, &statbuf);\r
     if(statbuf.st_size != swf.FileSize)\r
        fprintf(stderr, "Error: Real Filesize (%d) doesn't match header Filesize (%d)",\r
                statbuf.st_size, swf.FileSize);\r
+#endif\r
+\r
+    close(f);\r
+\r
+    printf("[HEADER]        File version: %d\n", swf.FileVersion);\r
+    printf("[HEADER]        File size: %d\n", swf.FileSize);\r
     printf("[HEADER]        Frame rate: %f\n",swf.FrameRate/256.0);\r
     printf("[HEADER]        Frame count: %d\n",swf.FrameCount);\r
     printf("[HEADER]        Movie width: %.3f\n",(swf.MovieSize.xmax-swf.MovieSize.xmin)/20.0);\r