[mapcode] 35/56: Ready for release 2.0

Stefan Fritsch sf at moszumanska.debian.org
Wed Nov 2 23:27:29 UTC 2016


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

sf pushed a commit to annotated tag v2.0.2
in repository mapcode.

commit a40520a973c6e5027fd599a57da6f97cdddb47c9
Author: Rijn Buve <rijn at buve.nl>
Date:   Thu Jul 2 16:22:08 2015 +0200

    Ready for release 2.0
---
 README.md             |   6 +--
 mapcode_library_c.doc | Bin 95232 -> 130048 bytes
 mapcodelib/basics.h   | 114 +++++++++++++++++++++++++-------------------------
 mapcodelib/mapcoder.c |  56 +++++++------------------
 mapcodelib/mapcoder.h |  34 +++++++--------
 utility/mapcode.cpp   |  22 +++-------
 6 files changed, 96 insertions(+), 136 deletions(-)

diff --git a/README.md b/README.md
index 9b82e05..98a7993 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ of how to use the library.
 To build the original Mapcode tool, execute:
 
   cd utility
-  gcc mapcode.cpp -o mapcode
+  gcc -Wall -O mapcode.cpp -o mapcode
 
 For help, simply execute the binary file 'mapcode' without no arguments.
 This tool provides a rather extensive command-line interface to encode and
@@ -48,9 +48,9 @@ decode Mapcodes.
 
 * 2.0
 
-    Support for up to 8 character extensions (10 micron accuracy).
+    Support for high-precision mapcodes, with up to 8 character extensions (up to 10 micron accuracy).
     
-    Fixes to the data rectangles for ISO proposal, see Word document for details.
+    Fixes to the data rectangles (primarily intended for ISO proposal), see Word document for details.
 
 * 1.50.1
 
diff --git a/mapcode_library_c.doc b/mapcode_library_c.doc
index 7eed7b0..62040aa 100644
Binary files a/mapcode_library_c.doc and b/mapcode_library_c.doc differ
diff --git a/mapcodelib/basics.h b/mapcodelib/basics.h
index 015a9e8..cca1032 100644
--- a/mapcodelib/basics.h
+++ b/mapcodelib/basics.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014-2015 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.
  * You may obtain a copy of the License at
@@ -16,11 +16,11 @@
 
 #define UWORD unsigned short int // 2-byte unsigned integer
 
-#define mapcode_cversion "1.81"
+#define mapcode_cversion "1.85"
 #define MAXWIDE 10
 #define BASEX 31
 #define MAXFITLONG 6
-#define XSIDE3 168
+#define XSIDE3 168 
 #define YSIDE3 176
 
 #define ALIASES "2UK=2UT,2CG=2CT,1GU=GUM,1UM=UMI,1VI=VIR,1PR=PRI,1AS=ASM,1MP=MNP,4CX=CXR,4CC=CCK,4NF=NFK,4HM=HMD,COL=5CL,5ME=5MX,MEX=5MX,5TM=TAM,5AG=AGU,5BC=BCN,5BS=BCS,5CM=CAM,5CS=CHP,5CH=CHH,5CO=COA,5DF=DIF,5DG=DUR,5GT=GUA,5GR=GRO,5HG=HID,5JA=JAL,5MI=MIC,5MO=MOR,5NA=NAY,5NL=NLE,5OA=OAX,5PB=PUE,5QE=QUE,5QR=ROO,5SL=SLP,5SI=SIN,5SO=SON,5TB=TAB,5TL=TLA,5VE=VER,5YU=YUC,5ZA=ZAC,811=8BJ,812=8TJ,813=8HE,814=8SX,815=8NM,821=8LN,822=8JL,823=8HL,831=8SH,832=8JS,833=8ZJ,834=8AH,835=8FJ,836=8JX,837 [...]
@@ -168,59 +168,59 @@ static const char encode_chars[34] = {
 
 
 static const UWORD data_start[MAX_CCODE+1] = {
-0, 3, 6, 10, 14, 17, 19, 20, 31, 32,
-34, 36, 38, 43, 45, 48, 52, 59, 63, 65,
-67, 71, 73, 81, 87, 95, 97, 132, 139, 149,
-151, 153, 156, 161, 173, 181, 188, 190, 192, 197,
-200, 207, 212, 214, 216, 220, 222, 229, 235, 239,
-243, 246, 250, 252, 281, 283, 290, 292, 297, 317,
-325, 329, 333, 335, 340, 348, 353, 364, 368, 373,
-377, 386, 400, 404, 409, 413, 429, 435, 440, 448,
-456, 472, 476, 480, 487, 498, 535, 539, 565, 571,
-589, 601, 637, 703, 738, 777, 789, 798, 826, 842,
-876, 892, 926, 962, 991, 1015, 1026, 1081, 1139, 1153,
-1215, 1239, 1268, 1336, 1414, 1467, 1546, 1631, 1683, 1758,
-1834, 1895, 1937, 1962, 2010, 2053, 2098, 2159, 2245, 2332,
-2383, 2446, 2531, 2622, 2707, 2766, 2881, 2984, 3077, 3161,
-3259, 3321, 3425, 3491, 3586, 3682, 3768, 3856, 3946, 4053,
-4199, 4301, 4405, 4436, 4473, 4550, 4586, 4620, 4656, 4708,
-4772, 4823, 4838, 4873, 5020, 5106, 5156, 5232, 5257, 5325,
-5382, 5417, 5499, 5550, 5623, 5716, 5751, 5829, 5888, 5954,
-6011, 6064, 6121, 6158, 6249, 6380, 6430, 6460, 6512, 6608,
-6641, 6722, 6770, 6850, 6893, 6987, 7021, 7066, 7173, 7177,
-7249, 7293, 7379, 7419, 7446, 7503, 7589, 7663, 7702, 7789,
-7865, 7973, 8051, 8125, 8195, 8252, 8334, 8416, 8475, 8502,
-8540, 8594, 8670, 8783, 8863, 8927, 8984, 9038, 9118, 9189,
-9275, 9325, 9389, 9533, 9537, 9542, 9547, 9552, 9558, 9563,
-9571, 9579, 9590, 9598, 9613, 9622, 9633, 9666, 9675, 9683,
-9698, 9708, 9718, 9726, 9734, 9750, 9758, 9768, 9779, 9789,
-9799, 9808, 9817, 9828, 9869, 9910, 9928, 10025, 10176, 10267,
-10349, 10544, 10547, 10550, 10553, 10563, 10568, 10571, 10583, 10596,
-10607, 10623, 10632, 10638, 10672, 10700, 10719, 10787, 10879, 10894,
-10898, 10934, 11021, 11032, 11050, 11067, 11131, 11163, 11204, 11224,
-11329, 11409, 11473, 11527, 11586, 11642, 11702, 11709, 11751, 11755,
-11758, 11768, 11783, 11794, 11832, 11895, 11941, 11946, 11953, 11958,
-11977, 11987, 11994, 12002, 12016, 12032, 12039, 12047, 12056, 12104,
-12113, 12124, 12174, 12185, 12195, 12214, 12230, 12243, 12255, 12274,
-12308, 12317, 12329, 12341, 12345, 12351, 12357, 12369, 12380, 12389,
-12395, 12409, 12429, 12440, 12482, 12533, 12583, 12639, 12652, 12665,
-12728, 12788, 12849, 12914, 12985, 13050, 13119, 13194, 13262, 13341,
-13418, 13432, 13447, 13492, 13505, 13533, 13547, 13560, 13576, 13592,
-13604, 13646, 13658, 13669, 13704, 13719, 13731, 13748, 13756, 13794,
-13807, 13822, 13942, 13988, 14032, 14072, 14096, 14137, 14176, 14196,
-14212, 14230, 14242, 14256, 14264, 14275, 14292, 14305, 14360, 14361,
-14362, 14363, 14403, 14409, 14414, 14419, 14424, 14430, 14437, 14443,
-14452, 14458, 14466, 14472, 14479, 14488, 14496, 14505, 14517, 14526,
-14534, 14545, 14556, 14565, 14575, 14582, 14632, 14666, 14675, 14687,
-14698, 14737, 14748, 14762, 14779, 14791, 14804, 14818, 14833, 14846,
-14867, 14875, 14894, 14903, 14915, 14926, 14940, 14955, 14968, 14982,
-14995, 15009, 15024, 15042, 15062, 15074, 15094, 15107, 15122, 15136,
-15154, 15170, 15184, 15197, 15214, 15234, 15251, 15269, 15284, 15298,
-15314, 15325, 15341, 15354, 15369, 15384, 15430, 15444, 15453, 15463,
-15476, 15490, 15501, 15514, 15530, 15545, 15546, 15573, 15579, 15587,
-15593, 15609, 15646, 15663, 15687, 15710, 15727, 15747, 15773, 15799,
-15818, 15835, 15888, 15929, 15951, 15978, 15998, 16019, 16037, 16068,
-16094, 16114, 16135, 16153, 16171, 16190, 16206, 16222, 16276, 16302,
+0, 3, 6, 10, 14, 17, 19, 20, 31, 32, 
+34, 36, 38, 43, 45, 48, 52, 59, 63, 65, 
+67, 71, 73, 81, 87, 95, 97, 132, 139, 149, 
+151, 153, 156, 161, 173, 181, 188, 190, 192, 197, 
+200, 207, 212, 214, 216, 220, 222, 229, 235, 239, 
+243, 246, 250, 252, 281, 283, 290, 292, 297, 317, 
+325, 329, 333, 335, 340, 348, 353, 364, 368, 373, 
+377, 386, 400, 404, 409, 413, 429, 435, 440, 448, 
+456, 472, 476, 480, 487, 498, 535, 539, 565, 571, 
+589, 601, 637, 703, 738, 777, 789, 798, 826, 842, 
+876, 892, 926, 962, 991, 1015, 1026, 1081, 1139, 1153, 
+1215, 1239, 1268, 1336, 1414, 1467, 1546, 1631, 1683, 1758, 
+1834, 1895, 1937, 1962, 2010, 2053, 2098, 2159, 2245, 2332, 
+2383, 2446, 2531, 2622, 2707, 2766, 2881, 2984, 3077, 3161, 
+3259, 3321, 3425, 3491, 3586, 3682, 3768, 3856, 3946, 4053, 
+4199, 4301, 4405, 4436, 4473, 4550, 4586, 4620, 4656, 4708, 
+4772, 4823, 4838, 4873, 5020, 5106, 5156, 5232, 5257, 5325, 
+5382, 5417, 5499, 5550, 5623, 5716, 5751, 5829, 5888, 5954, 
+6011, 6064, 6121, 6158, 6249, 6380, 6430, 6460, 6512, 6608, 
+6641, 6722, 6770, 6850, 6893, 6987, 7021, 7066, 7173, 7177, 
+7249, 7293, 7379, 7419, 7446, 7503, 7589, 7663, 7702, 7789, 
+7865, 7973, 8051, 8125, 8195, 8252, 8334, 8416, 8475, 8502, 
+8540, 8594, 8670, 8783, 8863, 8927, 8984, 9038, 9118, 9189, 
+9275, 9325, 9389, 9533, 9537, 9542, 9547, 9552, 9558, 9563, 
+9571, 9579, 9590, 9598, 9613, 9622, 9633, 9666, 9675, 9683, 
+9698, 9708, 9718, 9726, 9734, 9750, 9758, 9768, 9779, 9789, 
+9799, 9808, 9817, 9828, 9869, 9910, 9928, 10025, 10176, 10267, 
+10349, 10544, 10547, 10550, 10553, 10563, 10568, 10571, 10583, 10596, 
+10607, 10623, 10632, 10638, 10672, 10700, 10719, 10787, 10879, 10894, 
+10898, 10934, 11021, 11032, 11050, 11067, 11131, 11163, 11204, 11224, 
+11329, 11409, 11473, 11527, 11586, 11642, 11702, 11709, 11751, 11755, 
+11758, 11768, 11783, 11794, 11832, 11895, 11941, 11946, 11953, 11958, 
+11977, 11987, 11994, 12002, 12016, 12032, 12039, 12047, 12056, 12104, 
+12113, 12124, 12174, 12185, 12195, 12214, 12230, 12243, 12255, 12274, 
+12308, 12317, 12329, 12341, 12345, 12351, 12357, 12369, 12380, 12389, 
+12395, 12409, 12429, 12440, 12482, 12533, 12583, 12639, 12652, 12665, 
+12728, 12788, 12849, 12914, 12985, 13050, 13119, 13194, 13262, 13341, 
+13418, 13432, 13447, 13492, 13505, 13533, 13547, 13560, 13576, 13592, 
+13604, 13646, 13658, 13669, 13704, 13719, 13731, 13748, 13756, 13794, 
+13807, 13822, 13942, 13988, 14032, 14072, 14096, 14137, 14176, 14196, 
+14212, 14230, 14242, 14256, 14264, 14275, 14292, 14305, 14360, 14361, 
+14362, 14363, 14403, 14409, 14414, 14419, 14424, 14430, 14437, 14443, 
+14452, 14458, 14466, 14472, 14479, 14488, 14496, 14505, 14517, 14526, 
+14534, 14545, 14556, 14565, 14575, 14582, 14632, 14666, 14675, 14687, 
+14698, 14737, 14748, 14762, 14779, 14791, 14804, 14818, 14833, 14846, 
+14867, 14875, 14894, 14903, 14915, 14926, 14940, 14955, 14968, 14982, 
+14995, 15009, 15024, 15042, 15062, 15074, 15094, 15107, 15122, 15136, 
+15154, 15170, 15184, 15197, 15214, 15234, 15251, 15269, 15284, 15298, 
+15314, 15325, 15341, 15354, 15369, 15384, 15430, 15444, 15453, 15463, 
+15476, 15490, 15501, 15514, 15530, 15545, 15546, 15573, 15579, 15587, 
+15593, 15609, 15646, 15663, 15687, 15710, 15727, 15747, 15773, 15799, 
+15818, 15835, 15888, 15929, 15951, 15978, 15998, 16019, 16037, 16068, 
+16094, 16114, 16135, 16153, 16171, 16190, 16206, 16222, 16276, 16302, 
 16309, 16311, 16312, 16344
 };
 
@@ -14634,7 +14634,7 @@ static const mminforec mminfo[NR_RECS+1] = {
 {-95321564, 16074172, -92551001, 18755362, 0x0a9e891},
 {-94351867, 14531918, -91611095, 17213108, 0x0a9f091},
 {-118403860, 14531918, -86600000, 32719000, 0x0010217},
-{37538141, 55705730, 37690940, 55792220, 0x001000a},
+{37538581, 55705755, 37691380, 55792245, 0x001000a},
 {37174200, 55508961, 37975000, 56000000, 0x001000c},
 {37159175, 55614980, 37987247, 56106020, 0x001688c},
 {37166258, 55123940, 37983914, 55614980, 0x001b08c},
diff --git a/mapcodelib/mapcoder.c b/mapcodelib/mapcoder.c
index 741c18b..adda0d3 100644
--- a/mapcodelib/mapcoder.c
+++ b/mapcodelib/mapcoder.c
@@ -18,18 +18,6 @@
 #include <stdlib.h> // atof
 #include <ctype.h>  // toupper
 #include "mapcoder.h"
-
-#undef SUPPORT_HIGH_PRECISION
-
-/*
-  no threadsafe:
-    disambiguate_iso3
-*/
-
-
-#ifndef RELEASENEAT
-#else
-
 #include "basics.h"
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -148,7 +136,6 @@ static const char *get_entity_iso3(char *entity_iso3_result,int ccode)
   return entity_iso3_result;
 }
 
-// static char disambiguate_iso3[4] = { '1','?','?',0 } ; // cache for disambiguation
 static int disambiguate_str( const char *s, int len ) // returns disambiguation >=1, or negative if error
 {
   int res;
@@ -1039,9 +1026,6 @@ static int stateletter(int ccode) // parent
 }
 
 
-
-
-
 // returns -1 (error), or m (also returns *result!=0 in case of success)
 static int encodeNameless( char *result, const encodeRec* enc, int input_ctry, int codexm, int extraDigits, int m )
 {
@@ -1417,6 +1401,11 @@ static void encoderEngine( int ccode, const encodeRec *enc, int stop_with_one_re
 }
 
 
+
+
+
+
+
 // returns nonzero if error
 static int decoderEngine( decodeRec *dec )
 {
@@ -1668,7 +1657,6 @@ static int decoderEngine( decodeRec *dec )
 }
 
 
-
 #ifdef SUPPORT_FOREIGN_ALPHABETS
 
 // WARNING - these alphabets have NOT yet been released as standard! use at your own risk! check www.mapcode.com for details.
@@ -1949,21 +1937,15 @@ static int encodeLatLonToMapcodes_internal( char **v, Mapcodes *mapcodes, double
 }
 
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-//  Wrapper for LBS team
-//
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 // threadsafe
-char* getTerritoryIsoName(char *result, int tc, int format) // formats: 0=full 1=short (returns empty string in case of error)
+char* getTerritoryIsoName(char *result, int territoryCode, int format) // formats: 0=full 1=short (returns empty string in case of error)
 {
-  if (tc<1 || tc>MAX_MAPCODE_TERRITORY_CODE)
+  if (territoryCode<1 || territoryCode>MAX_MAPCODE_TERRITORY_CODE)
     *result=0;
   else {
-    int p=stateletter(tc-1);
+    int p=stateletter(territoryCode-1);
     char iso3[4];
-    const char *ei = get_entity_iso3(iso3,tc-1);
+    const char *ei = get_entity_iso3(iso3,territoryCode-1);
     if (*ei>='0' && *ei<='9') ei++;
     if (format==0 && p)
     {
@@ -1980,7 +1962,6 @@ char* getTerritoryIsoName(char *result, int tc, int format) // formats: 0=full 1
 }
 
 
-
 int getParentCountryOf(int tc) // returns negative if tc is not a code that has a parent country
 {
     int parentccode=ParentTerritoryOf(tc-1); // returns parent ccode or -1
@@ -2022,7 +2003,6 @@ int convertTerritoryIsoNameToCode(const char *string,int optional_tc) // optiona
 }
 
 
-
 // decode string into lat,lon; returns negative in case of error
 int decodeMapcodeToLatLon( double *lat, double *lon, const char *input, int context_tc ) // context_tc is used to disambiguate ambiguous short mapcode inputs; pass 0 or negative if not available
 {
@@ -2066,21 +2046,20 @@ UWORD* convertToAlphabet(UWORD* unibuf, int maxlength, const char *mapcode,int a
 }
 
 
+// Legacy: NOT threadsafe
 static char asciibuf[MAX_MAPCODE_RESULT_LEN];
 const char *decodeToRoman(const UWORD* s)
 {
   return convertToRoman(asciibuf,MAX_MAPCODE_RESULT_LEN,s);
 }
 
+// Legacy: NOT threadsafe
 static UWORD unibuf[MAX_MAPCODE_RESULT_LEN];
 const UWORD* encodeToAlphabet(const char *mapcode,int alphabet) // 0=roman, 2=cyrillic
 {
   return convertToAlphabet(unibuf,MAX_MAPCODE_RESULT_LEN,mapcode,alphabet);
 }
 
-
-
-
 #endif
 
 int encodeLatLonToSingleMapcode( char *result, double lat, double lon, int tc, int extraDigits )
@@ -2100,17 +2079,17 @@ int encodeLatLonToSingleMapcode( char *result, double lat, double lon, int tc, i
   return 1;
 }
 
-// encodeLatLonToMapcodes is not threadsafe!
-int encodeLatLon( Mapcodes *results, double lat, double lon, int tc, int extraDigits )
+// Threadsafe
+int encodeLatLonToMapcodes( Mapcodes *results, double lat, double lon, int territoryCode, int extraDigits )
 {
-  return encodeLatLonToMapcodes_internal(NULL,results,lat,lon,tc,0,extraDigits);
+  return encodeLatLonToMapcodes_internal(NULL,results,lat,lon,territoryCode,0,extraDigits);
 }
 
 // Legacy: NOT threadsafe
 Mapcodes rglobal;
-int encodeLatLonToMapcodes( char **v, double lat, double lon, int tc, int extraDigits )
+int encodeLatLonToMapcodes_Deprecated( char **v, double lat, double lon, int territoryCode, int extraDigits )
 {
-  return encodeLatLonToMapcodes_internal(v,&rglobal,lat,lon,tc,0,extraDigits);
+  return encodeLatLonToMapcodes_internal(v,&rglobal,lat,lon,territoryCode,0,extraDigits);
 }
 
 // Legacy: NOT threadsafe
@@ -2121,6 +2100,3 @@ const char *convertTerritoryCodeToIsoName(int tc,int format)
   if (makeiso_buf==makeiso_bufbytes) makeiso_buf=makeiso_bufbytes+8; else makeiso_buf=makeiso_bufbytes;
   return (const char*)getTerritoryIsoName(makeiso_buf,tc,format);
 }
-
-
-#endif // RELEASENEAT
diff --git a/mapcodelib/mapcoder.h b/mapcodelib/mapcoder.h
index ca6dff5..5cf603c 100644
--- a/mapcodelib/mapcoder.h
+++ b/mapcodelib/mapcoder.h
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#define RELEASENEAT                         // Use clean code (mapcoder.c).
-#define UWORD           unsigned short int  // 2-byte unsigned integer.
-#define SUPPORT_FOREIGN_ALPHABETS
+#define UWORD                               unsigned short int  // 2-byte unsigned integer.
+
+#define SUPPORT_FOREIGN_ALPHABETS           // Define to support additional alphabets.
+#define SUPPORT_HIGH_PRECISION              // Define to enable high-precision extension logic.
 
 #define MAX_NR_OF_MAPCODE_RESULTS           21          // Max. number of results ever returned by encoder (e.g. for 26.904899, 95.138515).
 #define MAX_PROPER_MAPCODE_LEN              10          // Max. number of characters in a proper mapcode (including the dot).
@@ -26,7 +27,6 @@
 #define MAX_MAPCODE_RESULT_LEN              (MAX_ISOCODE_LEN + 1 + MAX_CLEAN_MAPCODE_LEN + 1)    // Max. number of characters to store a single result (including zero-terminator).
 #define COMPARE_MAPCODE_MISSING_CHARACTERS  -999        // Used for compareWithMapcodeFormat.
 
-
 /**
  * The type Mapcodes hold a number of mapcodes, for example from an encoding call.
  * If a result contains a space, it splits the territory alphacode from the mapcode.
@@ -61,7 +61,7 @@ int encodeLatLonToMapcodes(
     Mapcodes* mapcodes,
     double lat,
     double lon,
-    int tc,
+    int territoryCode,
     int extraDigits);
 
 /**
@@ -88,7 +88,7 @@ int encodeLatLonToMapcodes(
  *      The results are stored as pairs (Mapcode, territory name) in:
  *          (results[0], results[1])...(results[(2 * N) - 2], results[(2 * N) - 1])
  */
-int encodeLatLonToMapcodes(     // Warning: this method is deprecated and not thread-safe.
+int encodeLatLonToMapcodes_Deprecated(     // Warning: this method is deprecated and not thread-safe.
     char**  results,
     double  lat,
     double  lon,
@@ -184,12 +184,12 @@ int convertTerritoryIsoNameToCode(
  *      Pointer to result. Empty if territoryCode illegal.
  */
 char* getTerritoryIsoName(
-    char *result,
-    int tc,
-    int format);
+    char*   result,
+    int     territoryCode,
+    int     format);
 
 // the old, non-threadsafe routine which uses static storage, overwritten at each call:
-const char *convertTerritoryCodeToIsoName(
+const char* convertTerritoryCodeToIsoName(
     int territoryCode,
     int format);
 
@@ -249,7 +249,7 @@ int getParentCountryOf(int territoryCode);
  * Returns:
  *      pointer to asciibuf, which holds the result
  */
-char *convertToRoman(char *asciibuf, int maxlen, const UWORD* string);
+char* convertToRoman(char* asciibuf, int maxlen, const UWORD* string);
 /**
  * old variant, not thread-safe: uses a pre-allocated static buffer, overwritten by the next call
  *      Returns converted string. allocated by the library. String must NOT be
@@ -272,7 +272,7 @@ const char* decodeToRoman(const UWORD* string);
  *      Encoded string. The string is allocated by the library and must NOT be
  *      de-allocated by the caller. It will be overwritten by a subsequent call to this method!
  */
-UWORD* convertToAlphabet(UWORD* unibuf, int maxlength, const char *string,int alphabet);
+UWORD* convertToAlphabet(UWORD* unibuf, int maxlength, const char* string, int alphabet);
 
 /**
  * old variant, not thread-safe: uses a pre-allocated static buffer, overwritten by the next call
@@ -283,15 +283,9 @@ const UWORD* encodeToAlphabet(const char* string, int alphabet);
 
 
 /**
- * list of #defines to support legacy systems
- */
-/*
-*/
-
-/**
- * list of #defines to support legacy systems
+ * List of #defines to support legacy systems.
  */
-#define coord2mc(results, lat, lon, territoryCode)  encodeLatLonToMapcodes(results, lat, lon,territoryCode, 0)
+#define coord2mc(results, lat, lon, territoryCode)  encodeLatLonToMapcodes_Deprecated(results, lat, lon,territoryCode, 0)
 #define coord2mc1(results, lat, lon, territoryCode) encodeLatLonToSingleMapcode(results, lat, lon, territoryCode, 0)
 #define mc2coord decodeMapcodeToLatLon
 #define lookslikemapcode compareWithMapcodeFormat
diff --git a/utility/mapcode.cpp b/utility/mapcode.cpp
index bb4f459..6753ee0 100644
--- a/utility/mapcode.cpp
+++ b/utility/mapcode.cpp
@@ -202,7 +202,7 @@ static void selfCheckLatLonToMapcode(const double lat, double lon, const char* t
     char* results[2 * MAX_NR_OF_MAPCODE_RESULTS];
     const double limitLat = (lat < -90.0) ? -90.0 : ((lat > 90.0) ? 90.0 : lat);
     const double limitLon = (lon < -180.0) ? -180.0 : ((lon > 180.0) ? 180.0 : lon);
-    const int nrResults = encodeLatLonToMapcodes(results, limitLat, limitLon, context, extraDigits);
+    const int nrResults = encodeLatLonToMapcodes_Deprecated(results, limitLat, limitLon, context, extraDigits);
     if (nrResults <= 0) {
         fprintf(stderr, "error: encoding lat/lon to mapcode failure; "
             "cannot encode lat=%.12g, lon=%.12g (default territory=%s)\n",
@@ -225,9 +225,9 @@ static void selfCheckLatLonToMapcode(const double lat, double lon, const char* t
             ++foundTerritoryMin;
         }
 
-        found = (((strcasecmp(territory, foundTerritory) == 0) ||
-                    (strcasecmp(territory, foundTerritoryMin) == 0)) &&
-                (strcasecmp(mapcode, foundMapcode) == 0));
+        found = (((strcmp(territory, foundTerritory) == 0) ||
+                    (strcmp(territory, foundTerritoryMin) == 0)) &&
+                (strcmp(mapcode, foundMapcode) == 0));
     }
     if (!found) {
         fprintf(stderr, "error: encoding lat/lon to mapcode failure; "
@@ -295,17 +295,7 @@ static void generateAndOutputMapcodes(double lat, double lon, int iShowError, in
         lat += 180;
     }
 
-#ifndef SUPPORT_HIGH_PRECISION
-    {
-        // Need to truncate lat/lon to microdegrees.
-        long intLon = lon * 1000000.0;
-        long intLat = lat * 1000000.0;
-        lon = (intLon / 1000000.0);
-        lat = (intLat / 1000000.0);
-    }
-#endif
-
-    const int nrResults = encodeLatLonToMapcodes(results, lat, lon, context, extraDigits);
+    const int nrResults = encodeLatLonToMapcodes_Deprecated(results, lat, lon, context, extraDigits);
     if (nrResults <= 0) {
         if (iShowError) {
             fprintf(stderr, "error: cannot encode lat=%.12g, lon=%.12g)\n", lat, lon);
@@ -521,7 +511,7 @@ int main(const int argc, const char** argv)
 
         // Encode the lat/lon to a set of Mapcodes.
         char* results[2 * MAX_NR_OF_MAPCODE_RESULTS];
-        const int nrResults = encodeLatLonToMapcodes(results, lat, lon, context, extraDigits);
+        const int nrResults = encodeLatLonToMapcodes_Deprecated(results, lat, lon, context, extraDigits);
         if (nrResults <= 0) {
             fprintf(stderr, "error: cannot encode lat=%.12g, lon=%.12g (default territory=%s)\n",
                 lat, lon, defaultTerritory);

-- 
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