[Scummvm-git-logs] scummvm master -> ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f

bluegr bluegr at gmail.com
Mon Apr 15 23:55:47 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ab0fab9bf9 POSIX: Move implementation of exists, isReadable and isWritable into posix-fs.cpp


Commit: ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f
    https://github.com/scummvm/scummvm/commit/ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-04-16T00:55:43+03:00

Commit Message:
POSIX: Move implementation of exists, isReadable and isWritable into posix-fs.cpp

Changed paths:
    backends/fs/chroot/chroot-fs-factory.cpp
    backends/fs/chroot/chroot-fs.cpp
    backends/fs/posix/posix-fs-factory.cpp
    backends/fs/posix/posix-fs.cpp
    backends/fs/posix/posix-fs.h
    backends/fs/psp2/psp2-fs-factory.cpp
    backends/platform/sdl/psp2/psp2.cpp
    backends/saves/posix/posix-saves.cpp


diff --git a/backends/fs/chroot/chroot-fs-factory.cpp b/backends/fs/chroot/chroot-fs-factory.cpp
index dadc50b..ac8d9b6 100644
--- a/backends/fs/chroot/chroot-fs-factory.cpp
+++ b/backends/fs/chroot/chroot-fs-factory.cpp
@@ -29,6 +29,8 @@
 #define FORBIDDEN_SYMBOL_EXCEPTION_random
 #define FORBIDDEN_SYMBOL_EXCEPTION_srandom
 
+#include <unistd.h>
+
 #include "backends/fs/chroot/chroot-fs-factory.h"
 #include "backends/fs/chroot/chroot-fs.h"
 
diff --git a/backends/fs/chroot/chroot-fs.cpp b/backends/fs/chroot/chroot-fs.cpp
index c10cc0b..3bbee27 100644
--- a/backends/fs/chroot/chroot-fs.cpp
+++ b/backends/fs/chroot/chroot-fs.cpp
@@ -22,16 +22,6 @@
 
 #if defined(POSIX)
 
-// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
-// Also with clock() in sys/time.h in some Mac OS X SDKs.
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
-#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
-#define FORBIDDEN_SYMBOL_EXCEPTION_exit     //Needed for IRIX's unistd.h
-#define FORBIDDEN_SYMBOL_EXCEPTION_random
-#define FORBIDDEN_SYMBOL_EXCEPTION_srandom
-
 #include "backends/fs/chroot/chroot-fs.h"
 
 ChRootFilesystemNode::ChRootFilesystemNode(const Common::String &root, POSIXFilesystemNode *node) {
diff --git a/backends/fs/posix/posix-fs-factory.cpp b/backends/fs/posix/posix-fs-factory.cpp
index 6ef5fce..9495992 100644
--- a/backends/fs/posix/posix-fs-factory.cpp
+++ b/backends/fs/posix/posix-fs-factory.cpp
@@ -34,6 +34,8 @@
 #include "backends/fs/posix/posix-fs-factory.h"
 #include "backends/fs/posix/posix-fs.h"
 
+#include <unistd.h>
+
 AbstractFSNode *POSIXFilesystemFactory::makeRootFileNode() const {
 	return new POSIXFilesystemNode("/");
 }
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index b0c8889..9d2416a 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -38,6 +38,9 @@
 
 #include <sys/param.h>
 #include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/types.h>
+#endif
 #ifdef PSP2
 #include "backends/fs/psp2/psp2-dirent.h"
 #define mkdir sceIoMkdir
@@ -47,6 +50,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #ifdef __OS2__
 #define INCL_DOS
@@ -54,6 +58,18 @@
 #endif
 
 
+bool POSIXFilesystemNode::exists() const {
+	return access(_path.c_str(), F_OK) == 0;
+}
+
+bool POSIXFilesystemNode::isReadable() const {
+	return access(_path.c_str(), R_OK) == 0;
+}
+
+bool POSIXFilesystemNode::isWritable() const {
+	return access(_path.c_str(), W_OK) == 0;
+}
+
 void POSIXFilesystemNode::setFlags() {
 	struct stat st;
 
diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h
index 5a6b6bd..5ad26ff 100644
--- a/backends/fs/posix/posix-fs.h
+++ b/backends/fs/posix/posix-fs.h
@@ -25,11 +25,6 @@
 
 #include "backends/fs/abstract-fs.h"
 
-#ifdef MACOSX
-#include <sys/types.h>
-#endif
-#include <unistd.h>
-
 /**
  * Implementation of the ScummVM file system API based on POSIX.
  *
@@ -59,13 +54,13 @@ public:
 	 */
 	POSIXFilesystemNode(const Common::String &path);
 
-	virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
+	virtual bool exists() const;
 	virtual Common::String getDisplayName() const { return _displayName; }
 	virtual Common::String getName() const { return _displayName; }
 	virtual Common::String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
-	virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
-	virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
+	virtual bool isReadable() const;
+	virtual bool isWritable() const;
 
 	virtual AbstractFSNode *getChild(const Common::String &n) const;
 	virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
diff --git a/backends/fs/psp2/psp2-fs-factory.cpp b/backends/fs/psp2/psp2-fs-factory.cpp
index 946eb10..fcd7709 100644
--- a/backends/fs/psp2/psp2-fs-factory.cpp
+++ b/backends/fs/psp2/psp2-fs-factory.cpp
@@ -20,13 +20,6 @@
  *
  */
 
-// Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
-// Also with clock() in sys/time.h in some Mac OS X SDKs.
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
-#define FORBIDDEN_SYMBOL_EXCEPTION_exit		//Needed for IRIX's unistd.h
-
 #include "backends/fs/posix/posix-fs-factory.h"
 #include "backends/fs/posix/posix-fs.h"
 #include "backends/fs/psp2/psp2-fs-factory.h"
diff --git a/backends/platform/sdl/psp2/psp2.cpp b/backends/platform/sdl/psp2/psp2.cpp
index 80604a6..28b0edf 100644
--- a/backends/platform/sdl/psp2/psp2.cpp
+++ b/backends/platform/sdl/psp2/psp2.cpp
@@ -22,7 +22,6 @@
 
 #define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h	// sys/stat.h includes sys/time.h
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
 
 #include "common/scummsys.h"
 #include "common/config-manager.h"
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 9c2206b..444aa63 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -24,11 +24,8 @@
 // Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h.
 // Also with clock() in sys/time.h in some Mac OS X SDKs.
 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h	//On IRIX, sys/stat.h includes sys/time.h
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
 #define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
 #define FORBIDDEN_SYMBOL_EXCEPTION_getenv
-#define FORBIDDEN_SYMBOL_EXCEPTION_random
-#define FORBIDDEN_SYMBOL_EXCEPTION_srandom
 
 #include "common/scummsys.h"
 





More information about the Scummvm-git-logs mailing list