mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
cad0d45fe1
commit
f487953ad3
4 changed files with 157 additions and 0 deletions
28
linux.c
28
linux.c
|
@ -6,6 +6,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <fnmatch.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char system_divelist_default_font[] = "Sans 8";
|
||||
|
||||
|
@ -97,3 +99,29 @@ int enumerate_devices (device_callback_t callback, void *userdata)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue