diff options
Diffstat (limited to 'navit/bookmarks.c')
-rw-r--r-- | navit/bookmarks.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c index 07fff8d89..ae4fcf1ad 100644 --- a/navit/bookmarks.c +++ b/navit/bookmarks.c @@ -19,7 +19,10 @@ #include <glib.h> #include <stdlib.h> +#include "config.h" +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include "file.h" #include "debug.h" #include "projection.h" @@ -32,6 +35,19 @@ #include "navit.h" #include "navit_nls.h" +/* FIXME: Move this to support directory */ +#ifdef _MSC_VER +#include <windows.h> +static int ftruncate(int fd, __int64 length) +{ + HANDLE fh = (HANDLE)_get_osfhandle(fd); + if (!fh || _lseeki64(fd, length, SEEK_SET)) { + return -1; + } + return SetEndOfFile(fh) ? 0 : -1; +} +#endif /* _MSC_VER */ + struct bookmarks { //data storage struct map *bookmark; @@ -648,7 +664,7 @@ bookmarks_append_coord(struct bookmarks *this_, char *file, struct pcoord *c, in const char *prostr; if (limit != 0 && (f=fopen(file, "r"))) { - int offsets[limit]; + int *offsets=g_alloca(sizeof(int)*limit); int offset_pos=0; int offset; char buffer[4096]; |