-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
baldr: Adjusting code to C++17 #4011
Conversation
In this commit: |
@kevinkreiser I think this is ready. |
sounds good! ill take another look hopefully this evening, sorry again for the delay and thanks again for grinding th rough it! |
@kevinkreiser made the changes |
src/baldr/graphtile.cc
Outdated
uint32_t max_id = tile_level.tiles.ncolumns() > 0 && tile_level.tiles.nrows() > 0 | ||
? tile_level.tiles.ncolumns() * tile_level.tiles.nrows() - 1 | ||
: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same casting here for same reason
src/baldr/graphtileheader.cc
Outdated
strncpy(version_, version.c_str(), kMaxVersionSize); | ||
// reinitializing the version array before copying | ||
version_ = {}; | ||
std::copy(version.begin(), version.begin() + std::min(kMaxVersionSize, sizeof(version.c_str())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous code was a bug because someone could screw with the version string and make it shorter than kMaxVersionSize
and strncpy
would have read past the end, so its good you are fixing it however i think you have a new bug here, this should be:
std::copy(version.begin(), version.begin() + std::min(kMaxVersionSize, sizeof(version.c_str())), | |
std::copy(version.begin(), version.begin() + std::min(kMaxVersionSize, version.size()), |
otherwise it will only ever copy 8 bytes because c_str()
is a pointer which is 64bits wide (these days)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch :-)
@kevinkreiser made the changes |
ok i made it to the bottom of the diff! the only changes i would request are:
|
regarding number 4, i tried it out myself and it just worked for me, this was my diff with master: diff --git a/src/baldr/CMakeLists.txt b/src/baldr/CMakeLists.txt
index 1ce31ea6d..306646f26 100644
--- a/src/baldr/CMakeLists.txt
+++ b/src/baldr/CMakeLists.txt
@@ -30,7 +30,6 @@ set(includes
${VALHALLA_SOURCE_DIR}/valhalla
$<$<BOOL:${WIN32}>:${VALHALLA_SOURCE_DIR}/third_party/dirent/include>
${VALHALLA_SOURCE_DIR}/third_party/rapidjson/include
- ${VALHALLA_SOURCE_DIR}/third_party/date/include
${CMAKE_CURRENT_BINARY_DIR}/src/baldr
)
@@ -114,6 +113,8 @@ valhalla_module(NAME baldr
${includes}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
+ SYSTEM
+ ${VALHALLA_SOURCE_DIR}/third_party/date/include
DEPENDS
valhalla::midgard now in reality it should be slightly more complicated because of the ios includes i guess but only very slightly more complicated. also, did you know that clion now lets you debug cmake scripts!? its awesome you can litterally step through a cmake run in the debugger and watch varaibles and general flow through the script, pretty awesome! |
Doing that is leading to this in my computer (doing
instead of:
Update, I didnt see the indentation, does not work :-( |
…-Werror=stringop-truncation]
…-Werror=stringop-truncation]
* restores to the original CMakelists * updates all the CMakeLists that include third_party/date/include * including the special case for APPLE
0fb92a8
to
6a8c6ae
Compare
Yes |
we missed the one update to the docstring so i just commited it and since its only a comment i will just merge no need to wait for build |
Issue
baldr
part of #4018TODO