From 90d98d05dc384128b58cc95631013a6e235b40a1 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 24 Apr 2018 17:05:29 +0200 Subject: [PATCH] fix(c-content): add a cache to handle getBodyAsString --- src/c-wrapper/api/c-content.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/c-wrapper/api/c-content.cpp b/src/c-wrapper/api/c-content.cpp index a75eda44d..f3bc9870b 100644 --- a/src/c-wrapper/api/c-content.cpp +++ b/src/c-wrapper/api/c-content.cpp @@ -47,6 +47,7 @@ L_DECLARE_C_CLONABLE_OBJECT_IMPL_WITH_XTORS(Content, string type; string subtype; string encoding; + string buffer; } mutable cache; ) @@ -116,7 +117,8 @@ void linphone_content_set_buffer (LinphoneContent *content, const uint8_t *buffe } const char *linphone_content_get_string_buffer (const LinphoneContent *content) { - return L_GET_CPP_PTR_FROM_C_OBJECT(content)->getBodyAsUtf8String().c_str(); + content->cache.buffer = L_GET_CPP_PTR_FROM_C_OBJECT(content)->getBodyAsUtf8String(); + return content->cache.buffer.c_str(); } void linphone_content_set_string_buffer (LinphoneContent *content, const char *buffer) {