Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorYury Melnichek <melnichek@gmail.com>2013-03-20 02:51:59 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:51:50 +0300
commitcf123901ff0029c94c29512a94a4b240855f3c37 (patch)
tree6d6852568bebc1db4878a087253e40bb35fa56ed /api
parent450952b9c8edefdd0e296737834cc0a207106ea3 (diff)
[api] Minor rename.
Diffstat (limited to 'api')
-rw-r--r--api/src/c/api-client.c11
-rw-r--r--api/tests/c/api-client-test.c12
2 files changed, 12 insertions, 11 deletions
diff --git a/api/src/c/api-client.c b/api/src/c/api-client.c
index f09132c1c2..ffb1023e31 100644
--- a/api/src/c/api-client.c
+++ b/api/src/c/api-client.c
@@ -2,13 +2,14 @@
#include <assert.h>
#include <math.h>
-#define MAPSWITHME_MAX_COORD_BYTES 10
-#define MAPSWITHME_MAX_COORD_BITS (MAPSWITHME_MAX_COORD_BYTES * 3)
+// Max number of base64 bytes to encode a geo point.
+#define MAPSWITHME_MAX_POINT_BYTES 10
+#define MAPSWITHME_MAX_COORD_BITS (MAPSWITHME_MAX_POINT_BYTES * 3)
char MapsWithMe_Base64Char(int x)
{
assert(x >= 0 && x < 64);
- return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"[x];
+ return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"[x];
}
// Map latitude: [-90, 90] -> [0, maxValue]
@@ -46,8 +47,8 @@ int MapsWithMe_LonToInt(double lon, int maxValue)
void MapsWithMe_LatLonToString(double lat, double lon, int nBytes, char * s)
{
- if (nBytes > MAPSWITHME_MAX_COORD_BYTES)
- nBytes = MAPSWITHME_MAX_COORD_BYTES;
+ if (nBytes > MAPSWITHME_MAX_POINT_BYTES)
+ nBytes = MAPSWITHME_MAX_POINT_BYTES;
int const latI = MapsWithMe_LatToInt(lat, (1 << MAPSWITHME_MAX_COORD_BITS) - 1);
int const lonI = MapsWithMe_LonToInt(lon, (1 << MAPSWITHME_MAX_COORD_BITS) - 1);
diff --git a/api/tests/c/api-client-test.c b/api/tests/c/api-client-test.c
index bd13891cec..86e4c4373d 100644
--- a/api/tests/c/api-client-test.c
+++ b/api/tests/c/api-client-test.c
@@ -7,7 +7,7 @@ double MapsWithMe_LonIn180180(double lon);
int MapsWithMe_LonToInt(double lon, int maxValue);
void MapsWithMe_LatLonToString(double lat, double lon, int nBytes, char * s);
-static const int MAX_COORD_BYTES = 10;
+static const int MAX_POINT_BYTES = 10;
static const int TEST_COORD_BYTES = 9;
char const * TestLatLonToStr(double lat, double lon)
@@ -25,7 +25,7 @@ FCT_BGN()
fct_chk_eq_int('A', MapsWithMe_Base64Char(0));
fct_chk_eq_int('B', MapsWithMe_Base64Char(1));
fct_chk_eq_int('9', MapsWithMe_Base64Char(61));
- fct_chk_eq_int('.', MapsWithMe_Base64Char(62));
+ fct_chk_eq_int('-', MapsWithMe_Base64Char(62));
fct_chk_eq_int('_', MapsWithMe_Base64Char(63));
}
FCT_QTEST_END();
@@ -195,13 +195,13 @@ FCT_BGN()
{
for (double lon = -190; lon < 190; lon += 0.9)
{
- char prevStepS[MAX_COORD_BYTES + 1] = {0};
- MapsWithMe_LatLonToString(lat, lon, MAX_COORD_BYTES, prevStepS);
+ char prevStepS[MAX_POINT_BYTES + 1] = {0};
+ MapsWithMe_LatLonToString(lat, lon, MAX_POINT_BYTES, prevStepS);
- for (int len = MAX_COORD_BYTES - 1; len > 0; --len)
+ for (int len = MAX_POINT_BYTES - 1; len > 0; --len)
{
// Test that the current string is a prefix of the previous one.
- char s[MAX_COORD_BYTES] = {0};
+ char s[MAX_POINT_BYTES] = {0};
MapsWithMe_LatLonToString(lat, lon, len, s);
prevStepS[len] = 0;
fct_chk_eq_str(s, prevStepS);