summaryrefslogtreecommitdiffstats
path: root/macos.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-19 15:00:50 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-19 07:28:20 -0800
commitf487953ad360b941fe225418cd3e5801d5a6508b (patch)
treea284c375543c2de073d4df26500a35d7c30afbe6 /macos.c
parentcad0d45fe17abedcb86bcdae6896d42324efbf96 (diff)
downloadsubsurface-f487953ad360b941fe225418cd3e5801d5a6508b.tar.gz
Files: add wrappers for certain open() methods
Due to filepath encoding issues on win32 we need wrappers for: - open() - fopen() - opendir() - zip_open() (this is readonly on win32) Patch only declares/defines the wrappers in dive.h, windows.c, linux.c, macos.c. Suggestions-by: Thiago Macieira <thiago@macieira.org> Suggestions-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'macos.c')
-rw-r--r--macos.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/macos.c b/macos.c
index 64b23a792..ba461ee4f 100644
--- a/macos.c
+++ b/macos.c
@@ -9,6 +9,9 @@
#include <CoreServices/CoreServices.h>
#include <mach-o/dyld.h>
#include <sys/syslimits.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <dirent.h>
/* macos defines CFSTR to create a CFString object from a constant,
* but no similar macros if a C string variable is supposed to be
@@ -77,3 +80,29 @@ int enumerate_devices (device_callback_t callback, void *userdata)
closedir (dp);
return index;
}
+
+/* NOP wrappers to comform with windows.c */
+int subsurface_open(const char *path, int oflags, mode_t mode)
+{
+ return open(path, oflags, mode);
+}
+
+FILE *subsurface_fopen(const char *path, const char *mode)
+{
+ return fopen(path, mode);
+}
+
+void *subsurface_opendir(const char *path)
+{
+ return (void *)opendir(path);
+}
+
+struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp)
+{
+ return zip_open(path, flags, errorp);
+}
+
+int subsurface_zip_close(struct zip *zip)
+{
+ return zip_close(zip);
+}