[mapcode] 01/11: New upstream version 2.5.4

Bas Couwenberg sebastic at debian.org
Sun Jan 28 18:34:57 UTC 2018


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapcode.

commit f3ceaff621c5aaaf8c57769d332ee93f2b3bbed2
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Jan 28 19:07:08 2018 +0100

    New upstream version 2.5.4
---
 CMakeLists.txt                              |  2 +-
 NOTICE                                      |  2 +-
 README.md                                   | 16 +++++++--
 mapcodelib/internal_alphabet_recognizer.h   |  2 +-
 mapcodelib/internal_data.h                  |  2 +-
 mapcodelib/internal_iso3166_data.h          |  2 +-
 mapcodelib/internal_territory_alphabets.h   |  2 +-
 mapcodelib/internal_territory_names_af.h    |  2 +-
 mapcodelib/internal_territory_names_ar.h    |  2 +-
 mapcodelib/internal_territory_names_be.h    |  2 +-
 mapcodelib/internal_territory_names_cn.h    |  2 +-
 mapcodelib/internal_territory_names_cs.h    |  2 +-
 mapcodelib/internal_territory_names_da.h    |  2 +-
 mapcodelib/internal_territory_names_de.h    |  2 +-
 mapcodelib/internal_territory_names_en.h    |  2 +-
 mapcodelib/internal_territory_names_es.h    |  2 +-
 mapcodelib/internal_territory_names_fi.h    |  2 +-
 mapcodelib/internal_territory_names_fr.h    |  2 +-
 mapcodelib/internal_territory_names_he.h    |  2 +-
 mapcodelib/internal_territory_names_hi.h    |  2 +-
 mapcodelib/internal_territory_names_hr.h    |  2 +-
 mapcodelib/internal_territory_names_id.h    |  2 +-
 mapcodelib/internal_territory_names_it.h    |  2 +-
 mapcodelib/internal_territory_names_ja.h    |  2 +-
 mapcodelib/internal_territory_names_ko.h    |  2 +-
 mapcodelib/internal_territory_names_local.h |  2 +-
 mapcodelib/internal_territory_names_nl.h    |  2 +-
 mapcodelib/internal_territory_names_no.h    |  2 +-
 mapcodelib/internal_territory_names_pl.h    |  2 +-
 mapcodelib/internal_territory_names_pt.h    |  2 +-
 mapcodelib/internal_territory_names_ru.h    |  2 +-
 mapcodelib/internal_territory_names_sv.h    |  2 +-
 mapcodelib/internal_territory_names_sw.h    |  2 +-
 mapcodelib/internal_territory_names_tr.h    |  2 +-
 mapcodelib/internal_territory_names_uk.h    |  2 +-
 mapcodelib/internal_territory_search.h      |  2 +-
 mapcodelib/mapcode_alphabets.h              |  2 +-
 mapcodelib/mapcode_legacy.c                 |  2 +-
 mapcodelib/mapcode_legacy.h                 |  2 +-
 mapcodelib/mapcode_territories.h            |  2 +-
 mapcodelib/mapcoder.c                       | 25 +++++++++++---
 mapcodelib/mapcoder.h                       | 41 +++++++++++++++++++---
 test/decode_test.h                          |  2 +-
 test/run_compare.sh                         |  4 +--
 test/run_gcov.sh                            |  2 +-
 test/run_gprof.sh                           |  2 +-
 test/run_sanitizer.sh                       |  2 +-
 test/run_valgrind.sh                        |  2 +-
 test/test_territories.h                     |  2 +-
 test/unittest.c                             | 53 ++++++++++++++++++++++++++++-
 utility/mapcode.cpp                         |  6 ++--
 51 files changed, 172 insertions(+), 63 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a560b00..7742073 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+# Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/NOTICE b/NOTICE
index bbd5f4d..1bac6aa 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,4 +1,4 @@
 Original C library created by Pieter Geelen. Work on Java version
 of the Mapcode library by Rijn Buve (original port by Matthew Lowden).
 
-Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
diff --git a/README.md b/README.md
index 7cb9d89..fc7e19f 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
 # Mapcode Library for C/C++
 
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d2e3d7a469484bfd8b801ce94d3f1737)](https://www.codacy.com/app/rijnb/mapcode-cpp?utm_source=github.com&utm_medium=referral&utm_content=mapcode-foundation/mapcode-cpp&utm_campaign=Badge_Grade)
 [![License](http://img.shields.io/badge/license-APACHE2-blue.svg)]()
 
-**Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)**
+**Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)**
 
 
 **Online documentation: http://mapcode-foundation.github.io/mapcode-cpp/**
@@ -64,7 +65,7 @@ decode Mapcodes.
 This produces the following help text:
 
     MAPCODE (version 2.5.2)
-    Copyright (C) 2014-2016 Stichting Mapcode Foundation
+    Copyright (C) 2014-2017 Stichting Mapcode Foundation
     
     Usage:
         mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
@@ -178,6 +179,17 @@ The list of support languages may grow over time.
 
 ## Release Notes
 
+### 2.5.4
+
+* Added `encodeLatLonToSelectedMapcode` as a convenience for languages that use the
+C library, but have difficulties dealing with multi-dimensional arrays (like Swift).
+
+### 2.5.3
+
+* Cleaned up code after running Codacy code reviews.
+
+* Fixed copyright message.
+
 ### 2.5.2
 
 * Added unit test for floating point error with code "40822.schol".
diff --git a/mapcodelib/internal_alphabet_recognizer.h b/mapcodelib/internal_alphabet_recognizer.h
index 91c1b00..a4e5e30 100644
--- a/mapcodelib/internal_alphabet_recognizer.h
+++ b/mapcodelib/internal_alphabet_recognizer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_data.h b/mapcodelib/internal_data.h
index bf742ef..b75f087 100644
--- a/mapcodelib/internal_data.h
+++ b/mapcodelib/internal_data.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_iso3166_data.h b/mapcodelib/internal_iso3166_data.h
index ff6f4aa..1a2ace2 100644
--- a/mapcodelib/internal_iso3166_data.h
+++ b/mapcodelib/internal_iso3166_data.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_alphabets.h b/mapcodelib/internal_territory_alphabets.h
index 3846586..1981e84 100644
--- a/mapcodelib/internal_territory_alphabets.h
+++ b/mapcodelib/internal_territory_alphabets.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_af.h b/mapcodelib/internal_territory_names_af.h
index 0b13e58..e99ec55 100644
--- a/mapcodelib/internal_territory_names_af.h
+++ b/mapcodelib/internal_territory_names_af.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_ar.h b/mapcodelib/internal_territory_names_ar.h
index e7cbcf6..8437e8a 100644
--- a/mapcodelib/internal_territory_names_ar.h
+++ b/mapcodelib/internal_territory_names_ar.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_be.h b/mapcodelib/internal_territory_names_be.h
index ad146e2..c057cfe 100644
--- a/mapcodelib/internal_territory_names_be.h
+++ b/mapcodelib/internal_territory_names_be.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_cn.h b/mapcodelib/internal_territory_names_cn.h
index a64a7a3..ff40848 100644
--- a/mapcodelib/internal_territory_names_cn.h
+++ b/mapcodelib/internal_territory_names_cn.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_cs.h b/mapcodelib/internal_territory_names_cs.h
index 4099891..5f0820f 100644
--- a/mapcodelib/internal_territory_names_cs.h
+++ b/mapcodelib/internal_territory_names_cs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_da.h b/mapcodelib/internal_territory_names_da.h
index 2614602..b350447 100644
--- a/mapcodelib/internal_territory_names_da.h
+++ b/mapcodelib/internal_territory_names_da.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_de.h b/mapcodelib/internal_territory_names_de.h
index 75638c9..55024d6 100644
--- a/mapcodelib/internal_territory_names_de.h
+++ b/mapcodelib/internal_territory_names_de.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_en.h b/mapcodelib/internal_territory_names_en.h
index a1e2859..333524a 100644
--- a/mapcodelib/internal_territory_names_en.h
+++ b/mapcodelib/internal_territory_names_en.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_es.h b/mapcodelib/internal_territory_names_es.h
index bedb147..2403744 100644
--- a/mapcodelib/internal_territory_names_es.h
+++ b/mapcodelib/internal_territory_names_es.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_fi.h b/mapcodelib/internal_territory_names_fi.h
index 72a9bc7..ae24f71 100644
--- a/mapcodelib/internal_territory_names_fi.h
+++ b/mapcodelib/internal_territory_names_fi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_fr.h b/mapcodelib/internal_territory_names_fr.h
index 9673a0f..dc8f444 100644
--- a/mapcodelib/internal_territory_names_fr.h
+++ b/mapcodelib/internal_territory_names_fr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_he.h b/mapcodelib/internal_territory_names_he.h
index bce487d..d271209 100644
--- a/mapcodelib/internal_territory_names_he.h
+++ b/mapcodelib/internal_territory_names_he.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_hi.h b/mapcodelib/internal_territory_names_hi.h
index b600b03..0e6bbbe 100644
--- a/mapcodelib/internal_territory_names_hi.h
+++ b/mapcodelib/internal_territory_names_hi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_hr.h b/mapcodelib/internal_territory_names_hr.h
index 70afe16..494a567 100644
--- a/mapcodelib/internal_territory_names_hr.h
+++ b/mapcodelib/internal_territory_names_hr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_id.h b/mapcodelib/internal_territory_names_id.h
index bdbb422..3e6a306 100644
--- a/mapcodelib/internal_territory_names_id.h
+++ b/mapcodelib/internal_territory_names_id.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_it.h b/mapcodelib/internal_territory_names_it.h
index 31112bf..4ea3e14 100644
--- a/mapcodelib/internal_territory_names_it.h
+++ b/mapcodelib/internal_territory_names_it.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_ja.h b/mapcodelib/internal_territory_names_ja.h
index aebbb48..b9e038c 100644
--- a/mapcodelib/internal_territory_names_ja.h
+++ b/mapcodelib/internal_territory_names_ja.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_ko.h b/mapcodelib/internal_territory_names_ko.h
index d2966e1..ac1fe23 100644
--- a/mapcodelib/internal_territory_names_ko.h
+++ b/mapcodelib/internal_territory_names_ko.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_local.h b/mapcodelib/internal_territory_names_local.h
index d02cad1..1d62c6e 100644
--- a/mapcodelib/internal_territory_names_local.h
+++ b/mapcodelib/internal_territory_names_local.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_nl.h b/mapcodelib/internal_territory_names_nl.h
index 3582724..8e037bf 100644
--- a/mapcodelib/internal_territory_names_nl.h
+++ b/mapcodelib/internal_territory_names_nl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_no.h b/mapcodelib/internal_territory_names_no.h
index 763a893..f5bbed3 100644
--- a/mapcodelib/internal_territory_names_no.h
+++ b/mapcodelib/internal_territory_names_no.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_pl.h b/mapcodelib/internal_territory_names_pl.h
index 99fef6f..c860a92 100644
--- a/mapcodelib/internal_territory_names_pl.h
+++ b/mapcodelib/internal_territory_names_pl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_pt.h b/mapcodelib/internal_territory_names_pt.h
index 46c786f..297bbb4 100644
--- a/mapcodelib/internal_territory_names_pt.h
+++ b/mapcodelib/internal_territory_names_pt.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_ru.h b/mapcodelib/internal_territory_names_ru.h
index f0073da..e491e3c 100644
--- a/mapcodelib/internal_territory_names_ru.h
+++ b/mapcodelib/internal_territory_names_ru.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_sv.h b/mapcodelib/internal_territory_names_sv.h
index 131980d..be6eb96 100644
--- a/mapcodelib/internal_territory_names_sv.h
+++ b/mapcodelib/internal_territory_names_sv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_sw.h b/mapcodelib/internal_territory_names_sw.h
index e700340..91e300b 100644
--- a/mapcodelib/internal_territory_names_sw.h
+++ b/mapcodelib/internal_territory_names_sw.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_tr.h b/mapcodelib/internal_territory_names_tr.h
index 3d45b92..cd4efd4 100644
--- a/mapcodelib/internal_territory_names_tr.h
+++ b/mapcodelib/internal_territory_names_tr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_names_uk.h b/mapcodelib/internal_territory_names_uk.h
index fef42d3..25e4d65 100644
--- a/mapcodelib/internal_territory_names_uk.h
+++ b/mapcodelib/internal_territory_names_uk.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/internal_territory_search.h b/mapcodelib/internal_territory_search.h
index 6a0cb20..f928083 100644
--- a/mapcodelib/internal_territory_search.h
+++ b/mapcodelib/internal_territory_search.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/mapcode_alphabets.h b/mapcodelib/mapcode_alphabets.h
index acbb0d0..830e6a5 100644
--- a/mapcodelib/mapcode_alphabets.h
+++ b/mapcodelib/mapcode_alphabets.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/mapcode_legacy.c b/mapcodelib/mapcode_legacy.c
index 8007bc9..a397696 100644
--- a/mapcodelib/mapcode_legacy.c
+++ b/mapcodelib/mapcode_legacy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/mapcode_legacy.h b/mapcodelib/mapcode_legacy.h
index acbf1de..3330ccd 100644
--- a/mapcodelib/mapcode_legacy.h
+++ b/mapcodelib/mapcode_legacy.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/mapcode_territories.h b/mapcodelib/mapcode_territories.h
index c23c7d1..52e5981 100644
--- a/mapcodelib/mapcode_territories.h
+++ b/mapcodelib/mapcode_territories.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/mapcodelib/mapcoder.c b/mapcodelib/mapcoder.c
index 643f2d8..464dc9e 100644
--- a/mapcodelib/mapcoder.c
+++ b/mapcodelib/mapcoder.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1130,7 +1130,7 @@ static void encodeAutoHeader(char *result, const EncodeRec *enc, const int m, co
     const int codexm = coDex(m);
     ASSERT(result);
     ASSERT(enc);
-    ASSERT((0 <= m) && (m <= MAPCODE_BOUNDARY_MAX));
+    ASSERT((1 <= m) && (m <= MAPCODE_BOUNDARY_MAX));
     ASSERT((0 <= extraDigits) && (extraDigits <= MAX_PRECISION_DIGITS));
 
     while (REC_TYPE(firstindex - 1) > 1 && coDex(firstindex - 1) == codexm) {
@@ -2037,7 +2037,7 @@ static const int STATE_MACHINE[27][6] = {
                                                                                                                 STATE_GO |
                                                                                                                 512, ERR_UNEXPECTED_HYPHEN},
 
-        //13 prefix.LLLLL === 
+        //13 prefix.LLLLL ===
         {22 |
          128,                          ERR_UNEXPECTED_DOT, ERR_INVALID_MAPCODE_FORMAT, ERR_INVALID_VOWEL,       STATE_GO |
                                                                                                                 128, 11 |
@@ -2047,7 +2047,7 @@ static const int STATE_MACHINE[27][6] = {
         {ERR_BAD_TERRITORY_FORMAT,     ERR_UNEXPECTED_DOT, 15,                         15,                              ERR_BAD_TERRITORY_FORMAT, ERR_UNEXPECTED_HYPHEN},
         //15 TC-S === get 2nd state letter
         {ERR_BAD_TERRITORY_FORMAT,     ERR_UNEXPECTED_DOT, 16,                         16,                              ERR_BAD_TERRITORY_FORMAT, ERR_UNEXPECTED_HYPHEN},
-        //16 TC-SS === white:waitprefix | det/vow:TC-SSS 
+        //16 TC-SS === white:waitprefix | det/vow:TC-SSS
         {18 |
          64,                           ERR_UNEXPECTED_DOT, 17,                         17,                              ERR_DOT_MISSING,          ERR_UNEXPECTED_HYPHEN},
         //17 TC-SSS === white:waitprefix
@@ -2159,7 +2159,7 @@ static enum MapcodeError parseMapcodeString(MapcodeElements *mapcodeElements, co
                 cx = getRomanVersionOf((UWORD) w);
             }
             c = decodeChar(cx);
-            if (c < 0) { // vowel or illegal?                
+            if (c < 0) { // vowel or illegal?
                 if (c == -1) { // illegal?
                     return ERR_INVALID_CHARACTER;
                 }
@@ -3053,6 +3053,21 @@ encodeLatLonToSingleMapcode(char *mapcode, double latDeg, double lonDeg, enum Te
 }
 
 
+// PUBLIC - encode lat,lon for territory to a selected mapcode (from all results) with extraDigits accuracy
+int
+encodeLatLonToSelectedMapcode(char *mapcode, double latDeg, double lonDeg, enum Territory territory, int extraDigits, int indexOfSelected) {
+    Mapcodes mapcodes;
+    int nrOfResults = 0;
+    nrOfResults = encodeLatLonToMapcodes(&mapcodes, latDeg, lonDeg, territory, extraDigits);
+    ASSERT(nrOfResults == mapcodes.count);
+    if ((nrOfResults <= 0) || (indexOfSelected < 0) || (indexOfSelected > nrOfResults)) {
+        return 0;
+    }
+    strcpy(mapcode, mapcodes.mapcode[indexOfSelected]);
+    return nrOfResults;
+}
+
+
 // PUBLIC - encode lat,lon for (optional) territory to mapcodes with extraDigits accuracy
 int
 encodeLatLonToMapcodes(Mapcodes *mapcodes, double latDeg, double lonDeg, enum Territory territory, int extraDigits) {
diff --git a/mapcodelib/mapcoder.h b/mapcodelib/mapcoder.h
index e9b88ca..6f13948 100644
--- a/mapcodelib/mapcoder.h
+++ b/mapcodelib/mapcoder.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ extern "C" {
 #define MAPCODE_SUPPORT_LANGUAGE_UK
 #endif
 
-#define MAPCODE_C_VERSION                   "2.5.2"
+#define MAPCODE_C_VERSION                   "2.5.3"
 #define UWORD                               unsigned short int  // 2-byte unsigned integer.
 
 #define MAX_NR_OF_MAPCODE_RESULTS           22                  // Max. number of results ever returned by encoder (e.g. for 26.904899, 95.138515).
@@ -80,7 +80,7 @@ extern "C" {
  * International mapcodes never include a territory ISO3166 code, nor a space.
  */
 typedef struct {
-    int count;                                                              // The number of mapcode results (length of array).
+    int count;                                                               // The number of mapcode results (length of array).
     char mapcode[MAX_NR_OF_MAPCODE_RESULTS][MAX_MAPCODE_RESULT_ASCII_LEN];   // The mapcodes.
 } Mapcodes;
 
@@ -179,8 +179,7 @@ int encodeLatLonToMapcodes(
  *
  * Arguments:
  *      result          - Returned Mapcode. The caller must not allocate or de-allocated this string.
- *                        The resulting string MUST be allocated (and de-allocated) by the caller (contrary to
- *                        encodeLatLonToMapcodes!).
+ *                        The resulting string MUST be allocated (and de-allocated) by the caller.
  *                        The caller should allocate at least MAX_MAPCODE_RESULT_ASCII_LEN characters for the string.
  *      lat             - Latitude, in degrees. Range: -90..90.
  *      lon             - Longitude, in degrees. Range: -180..180.
@@ -202,6 +201,38 @@ int encodeLatLonToSingleMapcode(
 
 
 /**
+ * Encode a latitude, longitude pair (in degrees) to a single Mapcode, selected from all Mapcodes.
+ * This method is offered for languages which have trouble supporting multi-dimensional arrays from C
+ * (like Swift).
+ *
+ * Arguments:
+ *      result          - Returned Mapcode. The caller must not allocate or de-allocated this string.
+ *                        The resulting string MUST be allocated (and de-allocated) by the caller.
+ *                        The caller should allocate at least MAX_MAPCODE_RESULT_ASCII_LEN characters for the string.
+ *      lat             - Latitude, in degrees. Range: -90..90.
+ *      lon             - Longitude, in degrees. Range: -180..180.
+ *      territory       - Territory (e.g. as obtained from getTerritoryCode), used as encoding context.
+ *                        Pass TERRITORY_NONE or TERRITORY_UNKNOWN to get Mapcodes for all territories.
+ *      extraDigits     - Number of extra "digits" to add to the generated mapcode. The preferred default is 0.
+ *                        Other valid values are 1 to 8, which will add extra letters to the mapcodes to
+ *                        make them represent the coordinate more accurately.
+ *      indexOfSelected - Index of selected mapcode. Must be in valid range for number of results.
+ *                        The index is base 0. To fetch all Mapcodes, pass 0 in a first call to retrieve the
+ *                        first Mapcode and the total number of results and iterate over the rest.
+ *
+ * Returns:
+ *      Total number of results available for selection. <=0 if encoding failed, or >0 if it succeeded.
+ */
+int encodeLatLonToSelectedMapcode(
+    char *mapcode,
+    double latDeg,
+    double lonDeg,
+    enum Territory territory,
+    int extraDigits,
+    int indexOfSelected);
+
+
+/**
  * Decode a utf8 or ascii Mapcode to  a latitude, longitude pair (in degrees).
  *
  * Arguments:
diff --git a/test/decode_test.h b/test/decode_test.h
index 5c6c4b8..168818e 100644
--- a/test/decode_test.h
+++ b/test/decode_test.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/test/run_compare.sh b/test/run_compare.sh
index 1fb30e6..2113ed1 100755
--- a/test/run_compare.sh
+++ b/test/run_compare.sh
@@ -10,7 +10,7 @@ OPTS1="--grid 1000000 8"
 OPTS2="--random 1000000 8 1234"
 OPTS3="--random 1000000 8 11223344"
 
-TEST=`which $OLD`
+TEST=$(which $OLD)
 if [ "$TEST" = "" ]
 then
     echo "No $OLD found on this machine - skipping script..."
@@ -30,7 +30,7 @@ cd ../utility
 gcc $OPTS -O3 mapcode.cpp -lm -o mapcode ../mapcodelib/mapcoder.o
 cd ../test
 
-TEST=`which $NEW`
+TEST=$(which $NEW)
 if [ "$TEST" = "" ]
 then
     echo "No $NEW found on this machine - skipping script..."
diff --git a/test/run_gcov.sh b/test/run_gcov.sh
index 8a5a865..c33c270 100755
--- a/test/run_gcov.sh
+++ b/test/run_gcov.sh
@@ -2,7 +2,7 @@
 OPTS="-Wall -Werror -Wextra -Wno-pointer-to-int-cast -fprofile-arcs -ftest-coverage"
 LIB="../mapcodelib/mapcoder.o"
 
-TEST=`which gcov`
+TEST=$(which gcov)
 if [ "$TEST" = "" ]
 then
     echo "No gcov found on this machine - skipping script..."
diff --git a/test/run_gprof.sh b/test/run_gprof.sh
index 61c8c42..558cd24 100755
--- a/test/run_gprof.sh
+++ b/test/run_gprof.sh
@@ -2,7 +2,7 @@
 OPTS="-Wall -Werror -Wextra -Wno-pointer-to-int-cast"
 LIB="../mapcodelib/mapcoder.o"
 
-TEST=`which gprof`
+TEST=$(which gprof)
 if [ "$TEST" = "" ]
 then
     echo "No gprof found on this machine - skipping script..."
diff --git a/test/run_sanitizer.sh b/test/run_sanitizer.sh
index 74b242d..2478dd5 100755
--- a/test/run_sanitizer.sh
+++ b/test/run_sanitizer.sh
@@ -4,7 +4,7 @@ LIB="../mapcodelib/mapcoder.o"
 
 export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true:strict_init_order=true
 
-TEST=`which clang`
+TEST=$(which clang)
 if [ "$TEST" = "" ]
 then
     echo "No clang found on this machine - skipping script..."
diff --git a/test/run_valgrind.sh b/test/run_valgrind.sh
index 3870bc4..4d13ebe 100755
--- a/test/run_valgrind.sh
+++ b/test/run_valgrind.sh
@@ -2,7 +2,7 @@
 OPTS="-Wall -Werror -Wextra -Wno-pointer-to-int-cast"
 LIB="../mapcodelib/mapcoder.o"
 
-TEST=`which valgrind`
+TEST=$(which valgrind)
 if [ "$TEST" = "" ]
 then
     echo "No valgrind found on this machine - skipping script..."
diff --git a/test/test_territories.h b/test/test_territories.h
index 2fd81dc..367a17b 100644
--- a/test/test_territories.h
+++ b/test/test_territories.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/test/unittest.c b/test/unittest.c
index 5b48d62..e3c9362 100644
--- a/test/unittest.c
+++ b/test/unittest.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1711,6 +1711,56 @@ static int testSingleEncodes(void) {
 }
 
 
+static int testSelectedEncodes(void) {
+    int nrTests = 0;
+    char mapcode[MAX_MAPCODE_RESULT_ASCII_LEN];
+    double lat = 52.158993;
+    double lon = 4.492346;
+    int i = 0;
+    int total = 0;
+    do {
+        total = encodeLatLonToSelectedMapcode(mapcode, lat, lon, TERRITORY_NONE, 0, i);
+        if (total != 4) {
+            foundError();
+            printf("*** ERROR *** testSelectedEncodes, expected %d alternatives, but got %d", 4, total);
+        }
+        switch (i) {
+        case 0:
+            if (strcmp(mapcode, "NLD QJM.0G") != 0) {
+                foundError();
+                printf("*** ERROR *** testSelectedEncodes, expected '%s', but got '%s', alternative %d\n", "NLD QJM.0G", mapcode, i);
+            }
+            break;
+        case 1:
+            if (strcmp(mapcode, "NLD CZQ.15C") != 0) {
+                foundError();
+                printf("*** ERROR *** testSelectedEncodes, expected '%s', but got '%s', alternative %d\n", "NLD CZQ.15C", mapcode, i);
+            }
+            break;
+        case 2:
+            if (strcmp(mapcode, "NLD N39J.MZN") != 0) {
+                foundError();
+                printf("*** ERROR *** testSelectedEncodes, expected '%s', but got '%s', alternative %d\n", "NLD N39J.MZN", mapcode, i);
+            }
+            break;
+        case 3:
+            if (strcmp(mapcode, "VHVN4.TZ9S") != 0) {
+                foundError();
+                printf("*** ERROR *** testSelectedEncodes, expected '%s', but got '%s', alternative %d\n", "VHVN4.TZ9S", mapcode, i);
+            }
+            break;
+        default:
+            foundError();
+            printf("*** ERROR *** testSelectedEncodes, expected %d alternatives, but got %d", 4, i);
+            break;
+        }
+        ++i;
+    } while (i < total);
+    ++nrTests;
+    return nrTests;
+}
+
+
 static int testGetFullTerritoryNameLocal(const char *expectedName, enum Territory territory, int alternative) {
     int nrTests = 0;
     int expectedCode = (*expectedName ? 1 : 0);
@@ -2227,6 +2277,7 @@ int main(const int argc, const char **argv) {
 
     printf("-----------------------------------------------------------\nEncode/decode tests\n");
     nrTests += testSingleEncodes();
+    nrTests += testSelectedEncodes();
     nrTests += testEncodeDecode();
 
     printf("-----------------------------------------------------------\nRe-encode tests\n");
diff --git a/utility/mapcode.cpp b/utility/mapcode.cpp
index f1d103e..332bab5 100644
--- a/utility/mapcode.cpp
+++ b/utility/mapcode.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
+ * Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ static double lonLargestNrOfResults = 0.0;
  */
 static void usage(const char *appName) {
     printf("MAPCODE (version %s)\n", MAPCODE_C_VERSION);
-    printf("Copyright (C) 2014-2016 Stichting Mapcode Foundation\n");
+    printf("Copyright (C) 2014-2017 Stichting Mapcode Foundation\n");
     printf("\n");
 
     printf("Usage:\n");
@@ -447,7 +447,7 @@ int main(const int argc, const char **argv) {
                (strcmp(cmd, "--encode") == 0) || (strcmp(cmd, "--encode0") == 0) ||
                (strcmp(cmd, "--encode1") == 0) || (strcmp(cmd, "--encode2") == 0) ||
                (strcmp(cmd, "--encode3") == 0) || (strcmp(cmd, "--encode4") == 0) ||
-               (strcmp(cmd, "--encode5") == 0) || (strcmp(cmd, "--encode5") == 0) ||
+               (strcmp(cmd, "--encode5") == 0) || (strcmp(cmd, "--encode6") == 0) ||
                (strcmp(cmd, "--encode7") == 0) || (strcmp(cmd, "--encode8") == 0)) {
 
         // ------------------------------------------------------------------

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapcode.git



More information about the Pkg-grass-devel mailing list