diff --git a/binarysearcharray.c b/binarysearcharray.c index 750c4181f..237ddfaf0 100644 --- a/binarysearcharray.c +++ b/binarysearcharray.c @@ -45,7 +45,6 @@ osmid_t binary_search_get(struct binary_search_array * array, int key) { return array->array[idx].value; } - exit(1); } void binary_search_remove(struct binary_search_array * array, int key) diff --git a/build_geometry.cpp b/build_geometry.cpp index bb160abd2..a1f9f2147 100644 --- a/build_geometry.cpp +++ b/build_geometry.cpp @@ -242,12 +242,14 @@ size_t get_wkt_split(osmNode *nodes, int count, int polygon, double split_at) { char * get_wkt(size_t index) { // return wkts[index].c_str(); - char *result; - result = (char*) std::malloc( wkts[index].length() + 1); - // At least give some idea of why we about to seg fault - if (!result) std::cerr << std::endl << "Unable to allocate memory: " << (wkts[index].length() + 1) << std::endl; - std::strcpy(result, wkts[index].c_str()); - return result; + char *result; + result = (char*) std::malloc( wkts[index].length() + 1); + // At least give some idea of why we about to seg fault + if (!result) + std::cerr << std::endl << "Unable to allocate memory: " << (wkts[index].length() + 1) << std::endl; + else + std::strcpy(result, wkts[index].c_str()); + return result; } double get_area(size_t index) diff --git a/parse-pbf.c b/parse-pbf.c index a726a1d06..665e8fbd0 100644 --- a/parse-pbf.c +++ b/parse-pbf.c @@ -29,7 +29,6 @@ #include #include -#include #include "osmtypes.h" #include "output.h" @@ -156,30 +155,8 @@ static size_t uncompress_blob(Blob *bmsg, void *buf, int32_t max_size) return bmsg->raw_size; } else if (bmsg->has_bzip2_data) { - int ret; - bz_stream strm; - strm.bzalloc = NULL; - strm.bzfree = NULL; - strm.opaque = NULL; - strm.avail_in = bmsg->bzip2_data.len; - strm.next_in = (char *) bmsg->bzip2_data.data; - strm.avail_out = bmsg->raw_size; - strm.next_out = buf; - - ret = BZ2_bzDecompressInit(&strm, 0, 0); - if (ret != BZ_OK) { - fprintf(stderr, "Bzip2 init failed\n"); - return 0; - } - - (void)BZ2_bzDecompressEnd(&strm); - - if (ret != BZ_STREAM_END) { - fprintf(stderr, "Bzip2 compression failed\n"); - return 0; - } - - return bmsg->raw_size; + fprintf(stderr, "Can't uncompress bz2 data\n"); + return 0; } else if (bmsg->has_lzma_data) { fprintf(stderr, "Can't uncompress LZMA data\n"); return 0;