Skip to content

Commit

Permalink
remove some pedantic warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
abeylot committed Feb 19, 2024
1 parent 93c535a commit 7db3379
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 60 deletions.
10 changes: 5 additions & 5 deletions CompiledDataManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Tags

unsigned char tag_size = 0;
unsigned char value_size = 0;

tag_size = (unsigned char) data[used];
used++;
tag = data + used;
Expand Down Expand Up @@ -165,7 +165,7 @@ public :
std::map<std::string, std::string>* symbols;
std::map<std::string, std::string>* charconvs;
//std::map<std::string, std::string>* patterns;

std::string path;

CompiledDataManager(std::string name,std::vector<IndexDesc*>* conf, std::map<std::string, std::string>* symbs = NULL, std::map<std::string, std::string>* convs = NULL)
Expand All @@ -183,7 +183,7 @@ public :
relMembers= new fidx::FileRawData<GeoMember>((name + "/relMembers").c_str(),false);
baliseTags = new fidx::FileRawVarData<GeoString>((name + "/baliseTags").c_str(),false);



textIndexNode = new fidx::FileIndex<IndexEntry,uint64_t> ((name + "/textIndexNode" ).c_str(), false);
textIndexWay = new fidx::FileIndex<IndexEntry,uint64_t> ((name + "/textIndexWay" ).c_str(), false);
Expand Down Expand Up @@ -216,7 +216,7 @@ public :
//Relation* loadRelation(uint64_t id);
Relation* loadRelationFast(uint64_t id);
Relation* loadRelation(uint64_t id, short recurs = 2, bool fast = false);


inline void load(Relation*& r, uint64_t id, bool fast)
{
Expand All @@ -228,7 +228,7 @@ public :
w = loadWay(id, fast);
}

inline void load(Point*& p, uint64_t id, bool fast)
inline void load(Point*& p, uint64_t id, [[maybe_unused]] bool fast)
{
p = loadPoint(id);
}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GIT_VERSION = "$(shell git describe --tags)"

CC= g++
cc=$(CC) -O2 -g -Wall -std=c++17 -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(GIT_VERSION)\"
cc=$(CC) -O2 -g -Wall -Wextra -pedantic-errors -std=c++17 -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(GIT_VERSION)\"

#cc=$(CC) -g -Wall -std=c++17 -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(GIT_VERSION)\"

Expand Down
16 changes: 8 additions & 8 deletions compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,20 @@ struct shp_file
struct ShpVisitor
{
std::vector<shp_file> shpFiles;
void log(uint64_t done){};
void startTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void log([[maybe_unused]] uint64_t done){};
void startTag([[maybe_unused]] std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if (b->baliseName == "shp_file")
{
shpFiles.push_back({b->keyValues["name"], b->keyValues["tag"], b->keyValues["value"], b->keyValues["projection"]});
}

}
void endTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void endTag([[maybe_unused]] std::vector<SeqBalise*>& tagStack, [[maybe_unused]] SeqBalise* b)
{
}

void stringNode(const std::vector<SeqBalise*>& tagStack, std::string& s)
void stringNode([[maybe_unused]] const std::vector<SeqBalise*>& tagStack,[[maybe_unused]] std::string& s)
{
}
};
Expand Down Expand Up @@ -202,7 +202,7 @@ struct XmlVisitor
uint64_t wayid;
uint64_t nodid;

bool isRel = false;;
bool isRel = false;
bool isWay = false;
bool isNod = false;

Expand Down Expand Up @@ -266,11 +266,11 @@ struct XmlVisitor
std::cerr << " done " << (done >> UINT64_C(20)) << "Mio.\t relations " << relationIndex->itemCount << "\tways " << wayIndex->itemCount << "\tnodes " << nodeIndex->itemCount<< "\n" << std::flush;
}

void stringNode(const std::vector<SeqBalise*>& tagStack, std::string& s)
void stringNode([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, [[maybe_unused]] std::string& s)
{
}

void startTag(const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void startTag([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if ((b->baliseName == BALISENAME_TAG)&&(isNod || isWay || isRel))
{
Expand Down Expand Up @@ -371,7 +371,7 @@ struct XmlVisitor
}
}

void endTag(const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void endTag([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if (b->baliseName == BALISENAME_TAG)
{
Expand Down
18 changes: 9 additions & 9 deletions helpers/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct CssClass
}
return result;
}
std::string makeClass(std::string clName, double ppm, bool evenOdd)
std::string makeClass(std::string clName, double ppm)
{
std::string result = "";
//std::string result = "/*" + tagValue + "*/\n";
Expand Down Expand Up @@ -120,20 +120,20 @@ struct IndexDesc
struct ParmsXmlVisitor
{
std::map<std::string, std::string> parameters;
void log(uint64_t done){};
void startTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void log([[maybe_unused]] uint64_t done){};
void startTag([[maybe_unused]] std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if (b->baliseName == "parameter")
{
parameters[ b->keyValues["name"] ] = b->keyValues["value"];
}

}
void endTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void endTag([[maybe_unused]] std::vector<SeqBalise*>& tagStack, [[maybe_unused]] SeqBalise* b)
{
}

void stringNode(std::vector<SeqBalise*>& tagStack, std::string& s)
void stringNode([[maybe_unused]] std::vector<SeqBalise*>& tagStack, [[maybe_unused]] std::string& s)
{
}

Expand Down Expand Up @@ -197,11 +197,11 @@ struct XmlVisitor
~XmlVisitor()
{
}
void log(uint64_t done)
void log([[maybe_unused]] uint64_t done)
{
}

void startTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void startTag([[maybe_unused]]std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if (b->baliseName == "style")
{
Expand Down Expand Up @@ -323,7 +323,7 @@ struct XmlVisitor
}
}

void endTag(std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void endTag([[maybe_unused]] std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if ( symbolId != "")
{
Expand Down Expand Up @@ -360,7 +360,7 @@ struct XmlVisitor
}
}

void stringNode(std::vector<SeqBalise*>& tagStack, std::string& s)
void stringNode([[maybe_unused]] std::vector<SeqBalise*>& tagStack, std::string& s)
{
if(symbolId != "")
{
Expand Down
18 changes: 9 additions & 9 deletions renumber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ struct XmlVisitor
{
std::cerr << " done " << (done >> UINT64_C(20)) << "Mio.\t relations " << relid << "\tways " << wayid << "\tnodes " << nodid<< "\n" << std::flush;
}
void startTag(const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void startTag([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, [[maybe_unused]] SeqBalise* b)
{
}
void stringNode(const std::vector<SeqBalise*>& tagStack, std::string& s)
void stringNode([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, [[maybe_unused]] std::string& s)
{
}
void endTag(const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
void endTag([[maybe_unused]] const std::vector<SeqBalise*>& tagStack, SeqBalise* b)
{
if (b->baliseName == BALISENAME_RELATION)
{
Expand All @@ -72,23 +72,23 @@ struct XmlVisitor
wayIdIndex->append(atoll((b->keyValues["id"]).c_str()), wayid++);
tags=0;
}

else if (b->baliseName == BALISENAME_TAG)
{

tags++;;
}

else if (b->baliseName == BALISENAME_NODE)
{

if(tags)
{
nodeIdIndex->append(atoll((b->keyValues["id"]).c_str()),
(GeoPointNumberIndex){ nodid++, Coordinates::toNormalizedLon(b->keyValues["lon"]), Coordinates::toNormalizedLat(b->keyValues["lat"])});
GeoPointNumberIndex pt{ nodid++, Coordinates::toNormalizedLon(b->keyValues["lon"]), Coordinates::toNormalizedLat(b->keyValues["lat"])};
nodeIdIndex->append(atoll((b->keyValues["id"]).c_str()),pt);
} else {
nodeIdIndex->append(atoll((b->keyValues["id"]).c_str()),
(GeoPointNumberIndex){ 0, Coordinates::toNormalizedLon(b->keyValues["lon"]), Coordinates::toNormalizedLat(b->keyValues["lat"])});
GeoPointNumberIndex pt{ 0, Coordinates::toNormalizedLon(b->keyValues["lon"]), Coordinates::toNormalizedLat(b->keyValues["lat"])};
nodeIdIndex->append(atoll((b->keyValues["id"]).c_str()),pt);
}
tags = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

ParmsXmlVisitor params;
volatile bool sigstop;
void sig_handler(int sig)
void sig_handler([[maybe_unused]]int sig)
{
sigstop = true;
}
Expand Down
2 changes: 1 addition & 1 deletion services/IdxList.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "IdxList.hpp"
Msg* IdxList::processRequest(Msg* request, CompiledDataManager& mger)
Msg* IdxList::processRequest([[maybe_unused]] Msg* request, CompiledDataManager& mger)
{
std::string resp = "<!DOCTYPE html><html> <head> <meta charset=\"UTF-8\"></head> <body>";
Msg* rep = new Msg;
Expand Down
26 changes: 13 additions & 13 deletions services/MapDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ MapDisplay::~MapDisplay()
{
}

Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
Msg* MapDisplay::processRequest(Msg* request, [[maybe_unused]] CompiledDataManager& mger)
{
bool pin = false;
std::string longitude = "-1.554136";
std::string latitude = "47.218637";
std::string zoom = "12";

std::string resp =
"<!DOCTYPE html>"
"<html>"
Expand Down Expand Up @@ -42,8 +42,8 @@ Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
"</style>"
"</head>"
"<body>"
"<div id=\"form\">"

"<div id=\"form\">"
"<form method=\"post\" action=\"/geoloc\" accept-charset=\"utf-8\">"
"<label>Locate :"
"<input name=\"name\" >"
Expand All @@ -55,21 +55,21 @@ Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
"<option value=\"xml\">xml</option>"
"</select>"
"</form></div>"


"<div id=\"map\"></div>"

"<script type=\"text/javascript\">"
"var map = L.map('map', {zoomControl: false}).setView([#lat#, #lon#], #zoom#);"
"L.tileLayer('/{z}/{x}/{y}.svg', {"
" attribution: 'Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>)',"
" maxZoom: 19"
"}).addTo(map);#pin#"
"</script>"
"</body>"
"</body>"
"</html>";


if (request->getRecord(2)->getNamedValue("lattitude") != "")
{
latitude = request->getRecord(2)->getNamedValue("lattitude");
Expand All @@ -78,7 +78,7 @@ Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
{
latitude = request->getRecord(1)->getNamedValue("lattitude");
}

if (request->getRecord(2)->getNamedValue("longitude") != "")
{
longitude = request->getRecord(2)->getNamedValue("longitude");
Expand All @@ -87,7 +87,7 @@ Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
{
longitude = request->getRecord(1)->getNamedValue("longitude");
}

if (request->getRecord(2)->getNamedValue("zoom") != "")
{
zoom = request->getRecord(2)->getNamedValue("zoom");
Expand All @@ -101,7 +101,7 @@ Msg* MapDisplay::processRequest(Msg* request, CompiledDataManager& mger)
{
pin = true;
}

resp.replace(resp.find("#lon#"),5,longitude);
resp.replace(resp.find("#lat#"),5,latitude);
resp.replace(resp.find("#zoom#"),6,zoom);
Expand Down
2 changes: 1 addition & 1 deletion services/Ping.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Ping.hpp"
Msg* Ping::processRequest(Msg* request, CompiledDataManager& mger)
Msg* Ping::processRequest([[maybe_unused]] Msg* request, [[maybe_unused]] CompiledDataManager& mger)
{
std::string resp = "<!DOCTYPE html><html> <head> <meta charset=\"UTF-8\"></head> <body>Ping!</body></html>";
Msg* rep = new Msg;
Expand Down
2 changes: 1 addition & 1 deletion services/RelationList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "../common/constants.hpp"
#include <stdlib.h>

Msg* RelationList::processRequest(Msg* request, CompiledDataManager& mger)
Msg* RelationList::processRequest([[maybe_unused]] Msg* request, CompiledDataManager& mger)
{
//GeoBox geoBox;
// DataManager mger;
Expand Down
Loading

0 comments on commit 7db3379

Please sign in to comment.