Skip to content

Commit 361f788

Browse files
committed
Improved CMakeLists to include address sanitizer for debug mode
1 parent 163b19a commit 361f788

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
# Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
cmake_minimum_required(VERSION 3.3)
216
project(mapcode_cpp)
317

4-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
18+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Werror -fsanitize=address")
19+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
520

621
set(SOURCE_FILES
722
mapcodelib/basics.h

mapcodelib/mapcoder.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,20 +1563,18 @@ static int decoderEngine(decodeRec *dec) {
15631563
}
15641564
}
15651565

1566-
{
1567-
if (codex == 54) {
1568-
// international mapcodes must be in international context
1569-
ccode = ccode_earth;
1570-
} else if (isSubdivision(ccode)) {
1571-
// int mapcodes must be interpreted in the parent of a subdivision
1572-
int parent = parentTerritoryOf(ccode);
1573-
if ((codex == 44) || ((codex == 34 || codex == 43) && (parent == ccode_ind || parent == ccode_mex))) {
1574-
ccode = parent;
1575-
}
1566+
if (codex == 54) {
1567+
// international mapcodes must be in international context
1568+
ccode = ccode_earth;
1569+
} else if (isSubdivision(ccode)) {
1570+
// int mapcodes must be interpreted in the parent of a subdivision
1571+
int parent = parentTerritoryOf(ccode);
1572+
if ((codex == 44) || ((codex == 34 || codex == 43) && (parent == ccode_ind || parent == ccode_mex))) {
1573+
ccode = parent;
15761574
}
1577-
15781575
}
15791576

1577+
15801578
{
15811579
const int from = firstrec(ccode);
15821580
const int upto = lastrec(ccode);

0 commit comments

Comments
 (0)