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:
Lubomir I. Ivanov 2013-12-19 15:00:50 +02:00 committed by Dirk Hohndel
parent cad0d45fe1
commit f487953ad3
4 changed files with 157 additions and 0 deletions

7
dive.h
View file

@ -5,6 +5,7 @@
#include <stdint.h>
#include <time.h>
#include <math.h>
#include <zip.h>
/* Windows has no MIN/MAX macros - so let's just roll our own */
#define MIN(x, y) ({ \
@ -633,6 +634,12 @@ extern void save_dives_logic(const char *filename, bool select_only);
extern void save_dive(FILE *f, struct dive *dive);
extern void export_dives_uddf(const char *filename, const bool selected);
extern int subsurface_open(const char *path, int oflags, mode_t mode);
extern FILE *subsurface_fopen(const char *path, const char *mode);
extern void *subsurface_opendir(const char *path);
extern struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp);
extern int subsurface_zip_close(struct zip *zip);
extern void shift_times(const timestamp_t amount);
extern xsltStylesheetPtr get_stylesheet(const char *name);