Permalink
Browse files

Intermediate commit: some -Wall cleanups, integrating pt_diagrams

  • Loading branch information...
1 parent 9b10f48 commit f76bccab25026ae2c77579f03bdd4403823bbc23 Roland Olbricht committed May 30, 2011
View
@@ -1,4 +1,4 @@
-bin_PROGRAMS = osm3s_query dispatcher sketch_route_svg web_query update_database update_from_dir
+bin_PROGRAMS = osm3s_query dispatcher web_query update_database update_from_dir sketch_route_svg draw_route_svg uncgi bbox_brim_query
dist_bin_SCRIPTS = apply_osc_to_db.sh fetch_osc.sh
escape_xml_cc = ../expat/escape_xml.cc
@@ -27,3 +27,9 @@ dispatcher_LDADD = -lrt
sketch_route_svg_SOURCES = ${expat_cc} ${escape_xml_cc} ../pt_diagrams/sketch-route-svg.cc
sketch_route_svg_LDADD = -lexpat
+draw_route_svg_SOURCES = ${expat_cc} ${escape_xml_cc} ../pt_diagrams/read_input.cc ../pt_diagrams/topographic.cc
+draw_route_svg_LDADD = -lexpat
+uncgi_SOURCES = ${expat_cc} ../pt_diagrams/uncgi.cc
+uncgi_LDADD = -lexpat
+bbox_brim_query_SOURCES = ${expat_cc} ../pt_diagrams/bbox-brim-query.cc
+bbox_brim_query_LDADD = -lexpat
View
@@ -4,6 +4,7 @@ BUF=$QUERY_STRING\&
SKETCH_PARAMS=
BRIM_PARAMS=
+BIN_DIR=../bin
while [[ -n $BUF ]]; do
{
@@ -14,12 +15,12 @@ while [[ -n $BUF ]]; do
if [[ $KEY == "network" && -n $VALUE ]]; then
{
NETWORK=$VALUE
- NETWORK_=`echo $VALUE | ../bin/uncgi`
+ NETWORK_=`echo $VALUE | $BIN_DIR/uncgi`
};
elif [[ $KEY == "ref" && -n $VALUE ]]; then
{
REF=$VALUE
- REF_=`echo $VALUE | ../bin/uncgi`
+ REF_=`echo $VALUE | $BIN_DIR/uncgi`
};
elif [[ $KEY == "pivot-lon" && -n $VALUE ]]; then
SKETCH_PARAMS="$SKETCH_PARAMS --pivot-lon=$VALUE"
@@ -36,7 +37,7 @@ done
BASEDIR=`mktemp -d`
echo -e "\
-data=<osm-script> \
+<osm-script> \
\
<union> \
<query type=\"relation\"> \
@@ -62,7 +63,7 @@ if [[ -z $REF ]]; then
};
fi
-CORRESPONDENCES=`../bin/bbox-brim-query --only-corrs $BRIM_PARAMS`
+CORRESPONDENCES=`$BIN_DIR/bbox_brim_query --only-corrs $BRIM_PARAMS`
if [[ $CORRESPONDENCES -gt 0 ]]; then
{
@@ -80,21 +81,21 @@ else
echo
REQUEST_METHOD=
- /home/roland/osm-3s/build/bin/osm3s_query --no-mime <$BASEDIR/request.1 2>&1
+ $BIN_DIR/osm3s_query --no-mime <$BASEDIR/request.1 2>&1
echo
- echo "../bin/draw_route_svg $SKETCH_PARAMS"
+ echo "$BIN_DIR/draw_route_svg $SKETCH_PARAMS"
};
else
{
REQUEST_METHOD=
- /home/roland/osm-3s/build/bin/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
+ $BIN_DIR/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
};
fi;
echo "Content-Type: image/svg+xml; charset=utf-8"
echo
- ../bin/draw_route_svg $SKETCH_PARAMS <$BASEDIR/answer.1
+ $BIN_DIR/draw_route_svg $SKETCH_PARAMS <$BASEDIR/answer.1
};
fi
@@ -4,6 +4,7 @@ BUF=$QUERY_STRING\&
SKETCH_PARAMS=
BRIM_PARAMS=
+BIN_DIR=../bin
while [[ -n $BUF ]]; do
{
@@ -14,12 +15,12 @@ while [[ -n $BUF ]]; do
if [[ $KEY == "network" && -n $VALUE ]]; then
{
NETWORK=$VALUE
- NETWORK_=`echo $VALUE | ../bin/uncgi`
+ NETWORK_=`echo $VALUE | $BIN_DIR/uncgi`
};
elif [[ $KEY == "ref" && -n $VALUE ]]; then
{
REF=$VALUE
- REF_=`echo $VALUE | ../bin/uncgi`
+ REF_=`echo $VALUE | $BIN_DIR/uncgi`
};
elif [[ $KEY == "width" && -n $VALUE ]]; then
SKETCH_PARAMS="$SKETCH_PARAMS --width=$VALUE"
@@ -52,7 +53,7 @@ done
BASEDIR=`mktemp -d`
echo -e "\
-data=<osm-script> \
+<osm-script> \
\
<union> \
<query type=\"relation\"> \
@@ -76,13 +77,13 @@ if [[ -z $REF ]]; then
};
fi
-CORRESPONDENCES=`../bin/bbox-brim-query --only-corrs $BRIM_PARAMS`
+CORRESPONDENCES=`$BIN_DIR/bbox_brim_query --only-corrs $BRIM_PARAMS`
if [[ $CORRESPONDENCES -gt 0 ]]; then
{
REQUEST_METHOD=
- /home/roland/osm-3s/build/bin/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
- ../bin/bbox-brim-query $BRIM_PARAMS <$BASEDIR/answer.1 >$BASEDIR/request.2
+ $BIN_DIR/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
+ $BIN_DIR/bbox_brim_query $BRIM_PARAMS <$BASEDIR/answer.1 >$BASEDIR/request.2
if [[ $DEBUG == "full-query" ]]; then
{
@@ -94,7 +95,7 @@ if [[ $CORRESPONDENCES -gt 0 ]]; then
fi
REQUEST_METHOD=
- /home/roland/osm-3s/build/bin/osm3s_query --quiet --no-mime <$BASEDIR/request.2 >$BASEDIR/answer.3
+ $BIN_DIR/osm3s_query --quiet --no-mime <$BASEDIR/request.2 >$BASEDIR/answer.3
echo "Content-Type: image/svg+xml; charset=utf-8"
echo
@@ -103,17 +104,17 @@ if [[ $CORRESPONDENCES -gt 0 ]]; then
{
cat <$BASEDIR/answer.3
echo
- echo "../bin/sketch_route_svg --ref=\"$REF_\" --network=\"$NETWORK_\" $SKETCH_PARAMS"
+ echo "$BIN_DIR/sketch_route_svg --ref=\"$REF_\" --network=\"$NETWORK_\" $SKETCH_PARAMS"
exit 0;
};
fi
- ../bin/sketch_route_svg --ref="$REF_" --network="$NETWORK_" $SKETCH_PARAMS <$BASEDIR/answer.3
+ $BIN_DIR/sketch_route_svg --ref="$REF_" --network="$NETWORK_" $SKETCH_PARAMS <$BASEDIR/answer.3
};
else
{
REQUEST_METHOD=
- /home/roland/osm-3s/build/bin/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
+ $BIN_DIR/osm3s_query --quiet --no-mime <$BASEDIR/request.1 >$BASEDIR/answer.1
if [[ $DEBUG == "full-query" ]]; then
{
@@ -127,6 +128,6 @@ else
echo "Content-Type: image/svg+xml; charset=utf-8"
echo
- ../bin/sketch_route_svg $SKETCH_PARAMS <$BASEDIR/answer.1
+ $BIN_DIR/sketch_route_svg $SKETCH_PARAMS <$BASEDIR/answer.1
};
fi
@@ -87,7 +87,7 @@ struct Area
static void calc_vert_aligned_segments
(vector< Aligned_Segment >& aligned_segments,
- uint32 from_lat, uint32 from_lon, uint32 to_lat, uint32 to_lon)
+ uint32 from_lat, int32 from_lon, uint32 to_lat, int32 to_lon)
{
if ((from_lon & 0xfff00000) == (to_lon & 0xfff00000))
{
@@ -101,7 +101,7 @@ struct Area
calc_horiz_aligned_segments
(aligned_segments, from_lat, from_lon,
proportion(from_lon, split_lon - 1, to_lon, from_lat, to_lat), split_lon - 1);
- for (; split_lon < (to_lon & 0xfff00000); split_lon += 0x100000)
+ for (; split_lon < (int32)(to_lon & 0xfff00000); split_lon += 0x100000)
calc_horiz_aligned_segments
(aligned_segments,
proportion(from_lon, split_lon, to_lon, from_lat, to_lat), split_lon,
@@ -118,7 +118,7 @@ struct Area
calc_horiz_aligned_segments
(aligned_segments, to_lat, to_lon,
proportion(to_lon, split_lon - 1, from_lon, to_lat, from_lat), split_lon - 1);
- for (; split_lon < (from_lon & 0xfff00000); split_lon += 0x100000)
+ for (; split_lon < (int32)(from_lon & 0xfff00000); split_lon += 0x100000)
calc_horiz_aligned_segments
(aligned_segments,
proportion(to_lon, split_lon, from_lon, to_lat, from_lat), split_lon,
@@ -254,7 +254,7 @@ struct Area_Skeleton
Area_Skeleton(void* data)
{
id = *(uint32*)data;
- for (int i(0); i < *((uint32*)data + 1); ++i)
+ for (uint i(0); i < *((uint32*)data + 1); ++i)
used_indices.insert(*((uint32*)data + i + 2));
}
@@ -8,7 +8,7 @@ using namespace std;
string escape_xml(const string& s)
{
string result;
- for (int i(0); i < s.length(); ++i)
+ for (uint i(0); i < s.length(); ++i)
{
if (s[i] == '&')
result += "&amp;";
@@ -7,9 +7,7 @@ using namespace std;
struct Web_Output : public Error_Output
{
- Web_Output(uint log_level_) : encoding_errors(false), parse_errors(false),
- static_errors(false), log_level(log_level_), header_written(false)
- {}
+ Web_Output(uint log_level_) : header_written(false), encoding_errors(false), parse_errors(false), static_errors(false), log_level(log_level_) {}
virtual void add_encoding_error(const string& error);
virtual void add_parse_error(const string& error, int line_number);
@@ -99,7 +99,7 @@ void Bbox_Query_Statement::execute(Resource_Manager& rman)
delete(uint_ranges);
stopwatch.stop(Stopwatch::NO_DISK);
- uint nodes_count;
+ uint nodes_count = 0;
uint32 isouth((south + 91.0)*10000000+0.5);
uint32 inorth((north + 91.0)*10000000+0.5);
@@ -220,10 +220,8 @@ void Make_Area_Statement::add_segment_blocks
const uint64& ll_front(it2->coors.front());
int32 lon_front(lon_(ll_front>>32, ll_front & 0xffffffffull));
- uint32 lat_front(shifted_lat(ll_front>>32, ll_front & 0xffffffffull));
const uint64& ll_back(it2->coors.back());
int32 lon_back(lon_(ll_back>>32, ll_back & 0xffffffffull));
- uint32 lat_back(shifted_lat(ll_back>>32, ll_back & 0xffffffffull));
if (lons.find(lon_front) == lons.end())
lons.insert(lon_front);
else
@@ -290,7 +288,7 @@ void Make_Area_Statement::execute(Resource_Manager& rman)
return;
}
pair< uint32, uint32 > pivot_pair(detect_pivot(mit->second));
- uint32 pivot_type(pivot_pair.first);
+ int pivot_type(pivot_pair.first);
uint32 pivot_id(pivot_pair.second);
stopwatch.stop(Stopwatch::NO_DISK);
@@ -320,7 +318,7 @@ void Make_Area_Statement::execute(Resource_Manager& rman)
// iterate over the result
vector< pair< string, string > > new_tags;
- File_Properties* file_prop;
+ File_Properties* file_prop = 0;
if (pivot_type == NODE)
file_prop = de_osm3s_file_ids::NODE_TAGS_LOCAL;
else if (pivot_type == WAY)
@@ -238,7 +238,7 @@ void Query_Statement::forecast()
sf_out.relation_count = key_value_counts.begin()->first;
declare_used_time(100 + sf_out.relation_count);
}
-/* else if (type == QUERY_AREA)
+ else if (type == QUERY_AREA)
{
if (key_value_counts.empty())
{
@@ -248,7 +248,7 @@ void Query_Statement::forecast()
else
sf_out.area_count = 15;
declare_used_time(30*1000);
- }*
+ }
finish_statement_forecast();
display_full();
@@ -433,7 +433,7 @@ void Query_Statement::execute(Resource_Manager& rman)
}
else if (bbox_restriction != 0)
{
- uint nodes_count;
+ uint nodes_count = 0;
Block_Backend< Uint32_Index, Node_Skeleton > nodes_db
(rman.get_transaction().data_index(de_osm3s_file_ids::NODES));
for (Block_Backend< Uint32_Index, Node_Skeleton >::Range_Iterator
@@ -467,7 +467,7 @@ void Query_Statement::execute(Resource_Manager& rman)
}
else
{
- uint nodes_count;
+ uint nodes_count = 0;
Block_Backend< Uint32_Index, Node_Skeleton > nodes_db
(rman.get_transaction().data_index(de_osm3s_file_ids::NODES));
for (Block_Backend< Uint32_Index, Node_Skeleton >::Discrete_Iterator
@@ -510,7 +510,7 @@ void Query_Statement::execute(Resource_Manager& rman)
areas.clear();
stopwatch.stop(Stopwatch::NO_DISK);
- uint ways_count;
+ uint ways_count = 0;
Block_Backend< Uint31_Index, Way_Skeleton > ways_db
(rman.get_transaction().data_index(de_osm3s_file_ids::WAYS));
for (Block_Backend< Uint31_Index, Way_Skeleton >::Discrete_Iterator
@@ -1,14 +1,10 @@
-/*****************************************************************
- * Must be used with Expat compiled for UTF-8 output.
- */
+#include "../expat/expat_justparse_interface.h"
+#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
-#include <math.h>
-#include "../expat_justparse_interface.h"
-
using namespace std;
const double PI = acos(0)*2;
@@ -1,11 +1,7 @@
-/*****************************************************************
- * Must be used with Expat compiled for UTF-8 output.
- */
+#include "../expat/expat_justparse_interface.h"
#include <iostream>
-#include "../expat_justparse_interface.h"
-
using namespace std;
char hex_digit(char c)
@@ -13,7 +13,6 @@
#include <cstdlib>
#include <cstring>
#include <fstream>
-#include <iostream>
using namespace std;
@@ -135,7 +134,7 @@ void Dispatcher::write_start(pid_t pid)
bool lock_obtained = false;
try
{
- pid_t locked_pid;
+ pid_t locked_pid = 0;
ifstream lock((shadow_name + ".lock").c_str());
lock>>locked_pid;
if (locked_pid == pid)
@@ -295,7 +294,7 @@ void write_to_index_empty_file(const vector< bool >& footprint, string filename)
Raw_File file(filename, O_RDWR|O_CREAT|O_TRUNC,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, "write_to_index_empty_file:1");
- int foo(write(file.fd, buffer.ptr, ((uint8*)pos) - ((uint8*)buffer.ptr))); foo = 0;
+ int foo(write(file.fd(), buffer.ptr, ((uint8*)pos) - ((uint8*)buffer.ptr))); foo = 0;
}
void Dispatcher::write_index_of_empty_blocks()
Oops, something went wrong.

0 comments on commit f76bcca

Please sign in to comment.