0027105: Make code ISO-compliant [-Wpedantic fixes]
[occt.git] / src / OSD / OSD_Disk.cxx
index 8b77c13..20a3bba 100644 (file)
@@ -3,8 +3,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#ifndef _WIN32
 
-#ifndef WNT
 
-#include <OSD_Disk.ixx>
+#include <OSD_Disk.hxx>
+#include <OSD_OSDError.hxx>
+#include <OSD_Path.hxx>
 #include <OSD_WhoAmI.hxx>
 
 const OSD_WhoAmI Iam = OSD_WDisk;
@@ -27,28 +26,25 @@ const OSD_WhoAmI Iam = OSD_WDisk;
 extern "C" {
 #endif
 
-  //#include <sys/types.h>
-
-#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H)
-# include <sys/statvfs.h>
-#elif defined(HAVE_STATFS) && defined(HAVE_SYS_VFS_H)
-  // Note: we want to use the "vfs" method on HP, not elsewhere
-# include <sys/vfs.h>
-#elif defined(HAVE_STATFS)
-# include <sys/param.h>
-# include <sys/mount.h>
+#if defined(__ANDROID__)
+  #include <sys/vfs.h>
+  #define statvfs  statfs
+  #define fstatvfs fstatfs
+#else
+  #include <sys/statvfs.h>
+  #ifdef __GNU_LIBRARY__
+    int statvfs(const char *, struct statvfs *) __THROW;
+  #else
+    int statvfs(const char *, struct statvfs *);
+  #endif
 #endif
 
 #ifdef __cplusplus
 }
-#endif                                                       
+#endif
 
 #include <errno.h>
 
-#if defined(HAVE_STATVFS)
-extern "C" {int statvfs(const char *, struct statvfs *); }
-#endif
-
 OSD_Disk::OSD_Disk() : myQuotaSize(0) {}
 
 
@@ -76,18 +72,6 @@ OSD_Path OSD_Disk::Name()const{
 
 Standard_Integer OSD_Disk::DiskSize(){
 
-#if !defined(HAVE_STATVFS)
-
-struct statfs buffer;
-  if ( statfs (DiskName.ToCString(),&buffer) == 0 ){
-    long BSize512 = buffer.f_bsize / 512 ;
-    return buffer.f_blocks * BSize512 ;
-  }
-  else {
-    myError.SetValue(errno, Iam, "OSD_Disk: statfs failed.");
-
-#else
-
 struct statvfs buffer;
 
   if ( statvfs(DiskName.ToCString(),&buffer) == 0 ){
@@ -96,28 +80,10 @@ struct statvfs buffer;
   }
   else {
     myError.SetValue(errno, Iam, "OSD_Disk: statvfs failed.");
-
-#endif
     return 0;
   }
 }
 
-#if !defined(HAVE_STATVFS)
-Standard_Integer OSD_Disk::DiskFree(){
-
-struct statfs buffer;
-  if ( statfs (DiskName.ToCString(),&buffer) == 0 ){
-    long BSize512 = buffer.f_bsize / 512 ;
-    return buffer.f_bavail * BSize512 ;
-  }
-  else {
-    myError.SetValue(errno, Iam, "OSD_Disk: statfs failed.");
-    return 0;
-  }
-}
-
-#else
-
 Standard_Integer OSD_Disk::DiskFree(){
 
 struct statvfs buffer;
@@ -131,8 +97,6 @@ struct statvfs buffer;
   }
 }
 
-#endif
-
 Standard_Integer OSD_Disk::DiskQuota(){
 //@@@ A faire
 return 0;
@@ -197,7 +161,11 @@ Standard_Integer OSD_Disk::Error()const{
 //-------------------------------------------------------------------------------
 
 #define STRICT
-#include <OSD_Disk.ixx>
+
+
+#include <OSD_Disk.hxx>
+#include <OSD_OSDError.hxx>
+#include <OSD_Path.hxx>
 #include <Standard_ProgramError.hxx>
 
 #include <windows.h>