Tizen 2.1 base
[platform/core/telephony/tel-plugin-imc.git] / packaging / 0012-Fix-EFsmsp-size-error.patch
1 From 3b7a430088ee269c53bb3d107ad13da23e795a7b Mon Sep 17 00:00:00 2001
2 From: Caiwen Zhang <caiwen.zhang@intel.com>
3 Date: Fri, 28 Sep 2012 18:31:58 +0800
4 Subject: [PATCH 12/23] Fix EFsmsp size error
5 Content-Type: text/plain; charset="utf-8"
6 Content-Transfer-Encoding: 8bit
7
8 EFsmsp record size 28 + Y (Y is the bytes remained for saving alpha
9 id). Y always be (record size - 28), it doesn't depends on the alpha
10 string length, if the alpha string is longer than Y, the string should
11 be cut short, if it is shorter than Y, should padding with 0xFF.
12 ---
13  src/s_sms.c |   15 ++++++++++-----
14  1 file changed, 10 insertions(+), 5 deletions(-)
15
16 diff --git a/src/s_sms.c b/src/s_sms.c
17 index 2b3cd4f..20067a3 100644
18 --- a/src/s_sms.c
19 +++ b/src/s_sms.c
20 @@ -3046,6 +3046,7 @@ static TReturn set_sms_params(CoreObject *obj, UserRequest *ur)
21         char *encoded_data = NULL;
22         unsigned char *temp_data = NULL;
23         int SMSPRecordLen = 0;
24 +       int *smsp_record_len;
25  
26         TcoreHal *hal = NULL;
27         TcoreATRequest *atreq = NULL;
28 @@ -3067,11 +3068,15 @@ static TReturn set_sms_params(CoreObject *obj, UserRequest *ur)
29                 return TCORE_RETURN_ENOSYS;
30         }
31  
32 -       //EFsmsp file size is 28 +Y bytes (Y is alpha id size)
33 -       SMSPRecordLen = 28 + setSmsParams->params.alphaIdLen;
34 -       temp_data = calloc(SMSPRecordLen,1);
35 -       encoded_data = calloc(SMSPRecordLen*2 + 1,1);
36 -       
37 +       // EFsmsp file size is 28 +Y bytes (Y is alpha id size)
38 +       smsp_record_len = tcore_plugin_ref_property(tcore_object_ref_plugin(obj), "SMSPRECORDLEN");
39 +       SMSPRecordLen = *smsp_record_len;
40 +       if (SMSPRecordLen < nDefaultSMSPWithoutAlphaId)
41 +               return FALSE;
42 +
43 +       temp_data = calloc(SMSPRecordLen, 1);
44 +       encoded_data = calloc(SMSPRecordLen * 2 + 1, 1);
45 +
46         _tcore_util_sms_encode_smsParameters(&(setSmsParams->params), temp_data, SMSPRecordLen);
47  
48         util_byte_to_hex((const char *)temp_data, (char *)encoded_data,SMSPRecordLen);
49 -- 
50 1.7.10.4
51