summaryrefslogtreecommitdiff
path: root/navit/maptool
diff options
context:
space:
mode:
authorPatrick Höhn <hoehnp@gmx.de>2018-01-20 22:46:10 +0100
committerPatrick Höhn <hoehnp@gmx.de>2018-01-20 22:46:10 +0100
commit95010e97559117e24a0f7ad47ceb1048ff50991e (patch)
treefd8116d6a00eafce4fdbe0e8e11aca3ef4d52129 /navit/maptool
parent852c5e3066af3827fa41013189e2a8f3e6b78397 (diff)
downloadnavit-95010e97559117e24a0f7ad47ceb1048ff50991e.tar.gz
fix:build:fixed compiler warning in maptool module
Diffstat (limited to 'navit/maptool')
-rw-r--r--navit/maptool/buffer.c4
-rw-r--r--navit/maptool/ch.c16
-rw-r--r--navit/maptool/maptool.c29
-rw-r--r--navit/maptool/tile.c5
-rw-r--r--navit/maptool/zip.c7
5 files changed, 49 insertions, 12 deletions
diff --git a/navit/maptool/buffer.c b/navit/maptool/buffer.c
index 2907b0670..be0e269c1 100644
--- a/navit/maptool/buffer.c
+++ b/navit/maptool/buffer.c
@@ -60,7 +60,9 @@ load_buffer(char *filename, struct buffer *b, long long offset, long long size)
fseeko(f, offset, SEEK_SET);
b->base=malloc(b->size);
dbg_assert(b->base != NULL);
- fread(b->base, b->size, 1, f);
+ if (fread(b->base, b->size, 1, f) == 0){
+ dbg(lvl_warning, "fread failed");
+ }
fclose(f);
}
diff --git a/navit/maptool/ch.c b/navit/maptool/ch.c
index b1b0b1bf6..0979cccce 100644
--- a/navit/maptool/ch.c
+++ b/navit/maptool/ch.c
@@ -204,7 +204,10 @@ ch_generate_ddsg(FILE *in, FILE *ref, FILE *idx, FILE *ddsg)
int n1,n2,speed=road_speed(ib->type);
struct item_id road_id;
double l;
- fread(&road_id, sizeof(road_id), 1, ref);
+
+ if (fread(&road_id, sizeof(road_id), 1, ref) == 0){
+ dbg(lvl_warning, "fread failed");
+ }
if (speed) {
struct edge_hash_item *hi=g_slice_new(struct edge_hash_item);
struct item_id *id=g_slice_new(struct item_id);
@@ -229,12 +232,19 @@ ch_generate_sgr(char *suffix)
{
#ifndef HAVE_API_WIN32_CE
char command[1024];
+ int system_result;
sprintf(command,"./contraction-hierarchies-20080621/main -s -p -f ddsg_%s.tmp -o hcn_%s.tmp -l hcn_log_%s.tmp -x 190 -y 1 -e 600 -p 1000 -k 1,3.3,2,10,3,10,5",suffix,suffix,suffix);
printf("%s\n",command);
- system(command);
+ system_result = system(command);
+ if (system_result == -1){
+ dbg(lvl_warning, "Running main failed");
+ }
sprintf(command,"./contraction-hierarchies-20080621/main -c -f ddsg_%s.tmp -h hcn_%s.tmp -k 1,3.3,2,10,3,10,5 -C ch_%s.tmp -O 1 -z sgr_%s.tmp",suffix,suffix,suffix,suffix);
printf("%s\n",command);
- system(command);
+ system_result = system(command);
+ if (system_result == -1){
+ dbg(lvl_warning, "Running main failed");
+ }
#endif
}
diff --git a/navit/maptool/maptool.c b/navit/maptool/maptool.c
index b1db65eeb..9965a9f16 100644
--- a/navit/maptool/maptool.c
+++ b/navit/maptool/maptool.c
@@ -26,6 +26,7 @@
#include <signal.h>
#include <stdio.h>
#include <math.h>
+#include <errno.h>
#ifdef _MSC_VER
#include "getopt_long.h"
#define atoll _atoi64
@@ -130,6 +131,7 @@ progress_time(void)
const int buflen=20;
char buf[buflen];
int pos=1;
+ int write_result;
buf[0]=' ';
#ifdef _WIN32
gettimeofday(&ts, NULL);
@@ -141,7 +143,10 @@ progress_time(void)
seconds%=60;
pos+=assafe_strcp2buf(seconds>9?":":":0", buflen-pos, buf+pos);
pos+=assafe_lltoa(seconds, buflen-pos, buf+pos);
- write(2,buf,pos);
+ write_result = write(2,buf,pos);
+ if (write_result == -1){
+ dbg(lvl_warning, "Writing progress time failed. Error-Code: %d" , errno);
+ }
}
static void
@@ -152,10 +157,14 @@ progress_memory(void)
const int buflen=20;
char buf[buflen];
int pos=1;
+ int write_result;
buf[0]=' ';
pos+=assafe_lltoa(mem/1024/1024, buflen-pos, buf+pos);
pos+=assafe_strcp2buf(" MB", buflen-pos, buf+pos);
- write(2,buf,pos);
+ write_result = write(2,buf,pos);
+ if (write_result == -1){
+ dbg(lvl_warning, "Writing progress memory failed. Error-Code: %d" , errno);
+ }
#endif
}
@@ -165,6 +174,7 @@ sig_alrm_do(int sig)
const int buflen=1024;
char buf[buflen];
int pos=0;
+ int write_result;
#ifndef _WIN32
signal(SIGALRM, sig_alrm_do);
alarm(30);
@@ -182,13 +192,22 @@ sig_alrm_do(int sig)
pos+=assafe_strcp2buf(" relations ", buflen-pos, buf+pos);
pos+=assafe_lltoa(processed_tiles, buflen-pos, buf+pos);
pos+=assafe_strcp2buf(" tiles", buflen-pos, buf+pos);
- write(2,buf,pos);
+ write_result = write(2,buf,pos);
+ if (write_result == -1){
+ dbg(lvl_warning, "Writing sig alrm ailed. Error-Code: %d" , errno);
+ }
progress_time();
progress_memory();
#ifndef _WIN32
- write(2,"\r\n",2);
+ write_result = write(2,"\r\n",2);
+ if (write_result == -1){
+ dbg(lvl_warning, "Writing new line in sig alrm ailed. Error-Code: %d" , errno);
+ }
#else
- write(2,"\n",1);
+ write_result = write(2,"\n",1);
+ if (write_result == -1){
+ dbg(lvl_warning, "Writing new line in sig alrm ailed. Error-Code: %d" , errno);
+ }
#endif
}
diff --git a/navit/maptool/tile.c b/navit/maptool/tile.c
index 9d9f94145..23fd62dad 100644
--- a/navit/maptool/tile.c
+++ b/navit/maptool/tile.c
@@ -405,7 +405,10 @@ write_aux_tiles(struct zip_info *zip_info)
assert(buffer != NULL);
f=fopen(at->filename,"rb");
assert(f != NULL);
- fread(buffer, at->size, 1, f);
+
+ if (fread(buffer, at->size, 1, f) == 0){
+ dbg(lvl_warning, "fread failed");
+ }
fclose(f);
write_zipmember(zip_info, at->name, zip_get_maxnamelen(zip_info), buffer, at->size);
free(buffer);
diff --git a/navit/maptool/zip.c b/navit/maptool/zip.c
index a4e040974..0e8543fa2 100644
--- a/navit/maptool/zip.c
+++ b/navit/maptool/zip.c
@@ -187,10 +187,13 @@ zip_write_index(struct zip_info *info)
{
int size=ftell(info->index);
char *buffer;
-
+
buffer=g_alloca(size);
fseek(info->index, 0, SEEK_SET);
- fread(buffer, size, 1, info->index);
+
+ if (fread(buffer, size, 1, info->index) == 0){
+ dbg(lvl_warning, "fread failed");
+ }
write_zipmember(info, "index", strlen("index"), buffer, size);
info->zipnum++;
}