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:
authorvng <viktor.govako@gmail.com>2013-04-17 23:57:02 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:53:23 +0300
commita4c3b66546d1fdcb423bedcf9af9e837e44d8c32 (patch)
treef10dd14318d87da792ce49b10460a26b88c9e77e /api
parent4db207edffc1454db0c311587a77006ee51ced8f (diff)
Fix reserving of buffer size for url encoding.
Diffstat (limited to 'api')
-rw-r--r--api/src/c/api-client.c5
-rw-r--r--api/src/c/api-client.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/api/src/c/api-client.c b/api/src/c/api-client.c
index a9b0654c83..aa14648dfa 100644
--- a/api/src/c/api-client.c
+++ b/api/src/c/api-client.c
@@ -164,6 +164,11 @@ void MapsWithMe_AppendString(char * buf, int bufSize, int * bytesAppended, char
*bytesAppended += size;
}
+int MapsWithMe_GetMaxBufferSize(int nameSize)
+{
+ return ((nameSize == 0) ? 17 : 17 + 3 * nameSize + 1);
+}
+
int MapsWithMe_GenShortShowMapUrl(double lat, double lon, double zoom, char const * name, char * buf, int bufSize)
{
// URL format:
diff --git a/api/src/c/api-client.h b/api/src/c/api-client.h
index 9335a8950b..c2abea96d3 100644
--- a/api/src/c/api-client.h
+++ b/api/src/c/api-client.h
@@ -38,6 +38,10 @@ typedef struct
char * MapsWithMe_GenShowMapUrl(MapsWithMe_ShowMapRequest const * request);
*/
+// Helper function to calculate maximum buffer size for
+// MapsWithMe_GenShortShowMapUrl (with null-terminator).
+int MapsWithMe_GetMaxBufferSize(int nameSize);
+
// Helper method to generate short url.
// Returns the number of bytes required to fit the whole URL or an error_code < 0 on error.
int MapsWithMe_GenShortShowMapUrl(double lat, double lon, double zoomLevel, char const * name, char * buf, int bufSize);