aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-08-02 14:29:43 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-08-02 15:13:29 +0200
commit5bd35c74cbe3aed1dc8010f42c593e3b2f0add99 (patch)
tree90f180b8d6b89b3b01e0ee0dffbed7885d2af789
parentbb5f109e0d256a54dfda990478f8586e50c7a270 (diff)
downloadexternal_libsamsung-ipc-5bd35c74cbe3aed1dc8010f42c593e3b2f0add99.zip
external_libsamsung-ipc-5bd35c74cbe3aed1dc8010f42c593e3b2f0add99.tar.gz
external_libsamsung-ipc-5bd35c74cbe3aed1dc8010f42c593e3b2f0add99.tar.bz2
call: Size function for helpers that return data with non-explicit size
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--include/call.h2
-rw-r--r--samsung-ipc/call.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/include/call.h b/include/call.h
index e3f2dc7..4f5d152 100644
--- a/include/call.h
+++ b/include/call.h
@@ -148,6 +148,8 @@ unsigned char ipc_call_list_count_extract(const void *data, size_t size);
struct ipc_call_list_entry *ipc_call_list_entry_extract(const void *data,
size_t size, unsigned int index);
char *ipc_call_list_entry_number_extract(const struct ipc_call_list_entry *entry);
+size_t ipc_call_burst_dtmf_size_setup(const struct ipc_call_burst_dtmf_request_entry *entries,
+ unsigned char count);
void *ipc_call_burst_dtmf_setup(const struct ipc_call_burst_dtmf_request_entry *entries,
unsigned char count);
diff --git a/samsung-ipc/call.c b/samsung-ipc/call.c
index 37bdc20..b0720ad 100644
--- a/samsung-ipc/call.c
+++ b/samsung-ipc/call.c
@@ -106,6 +106,19 @@ char *ipc_call_list_entry_number_extract(const struct ipc_call_list_entry *entry
return number;
}
+size_t ipc_call_burst_dtmf_size_setup(const struct ipc_call_burst_dtmf_request_entry *entries,
+ unsigned char count)
+{
+ size_t size;
+
+ if (entries == NULL)
+ return 0;
+
+ size = sizeof(struct ipc_call_burst_dtmf_request_header) + count * sizeof(struct ipc_call_burst_dtmf_request_entry);
+
+ return size;
+}
+
void *ipc_call_burst_dtmf_setup(const struct ipc_call_burst_dtmf_request_entry *entries,
unsigned char count)
{
@@ -116,7 +129,9 @@ void *ipc_call_burst_dtmf_setup(const struct ipc_call_burst_dtmf_request_entry *
if (entries == NULL)
return NULL;
- size = sizeof(struct ipc_call_burst_dtmf_request_header) + count * sizeof(struct ipc_call_burst_dtmf_request_entry);
+ size = ipc_call_burst_dtmf_size_setup(entries, count);
+ if (size == 0)
+ return NULL;
data = calloc(1, size);