summaryrefslogtreecommitdiff
path: root/navit/bookmarks.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-01-25 14:57:21 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-01-25 14:57:21 +0000
commitca32f2fde4465e1205df6d41f255042154563e0e (patch)
tree9ffb6b6629b9df03e452cafcd880e644b9273404 /navit/bookmarks.c
parent1f31e8b70844254d1f5f9ccbe9431f15b2f1716d (diff)
downloadnavit-svn-ca32f2fde4465e1205df6d41f255042154563e0e.tar.gz
Fix:Core:MSVC fixes|Thanks chollya
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4017 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/bookmarks.c')
-rw-r--r--navit/bookmarks.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c
index 07fff8d8..ae4fcf1a 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];