source: remove build warning on lib directory 56/51356/3
authorSooyoung Ha <yoosah.ha@samsung.com>
Fri, 6 Nov 2015 08:10:32 +0000 (17:10 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Mon, 9 Nov 2015 06:46:02 +0000 (15:46 +0900)
I have a plan to apply -Werror option. By the way, vmodem code has so
many build warnings. This could occur problems, I will remove these
warnings before applying -Werror option.
It would be hard to understand or review if I upload changes at one
commit. So I split them.

This is the first. I remove build warnings on lib directories. And I
add some missing prototypes.

There are many problems about code convention like indentations,
whitespaces, tabs, and so on. These should be aligned later, not this
commit.

Change-Id: If5f0db177e5cd3a8c92a4e7d4ef01f05638eee4b
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
19 files changed:
lib/libcommon/fileio.c
lib/libcommon/process.c
lib/libsms/sms_tool.c
lib/libsms/sms_tool.h [new file with mode: 0644]
lib/libsms/sms_util.h
libvmodem/libvgsm_gprs.c
libvmodem/lxtutil.c
vmodem/include/at/at_func.h
vmodem/include/at/at_rx_func.h
vmodem/include/at/at_rx_sms.h
vmodem/include/at/at_tx_display.h
vmodem/include/at/at_tx_security.h
vmodem/include/db/db_ss.h
vmodem/include/oem/oem_rx_security.h
vmodem/include/oem/oem_tx_display.h
vmodem/include/oem/oem_tx_security.h
vmodem/include/server/server_common_call.h
vmodem/include/server/server_rx_call.h
vmodem/include/server/server_rx_security.h

index 3e36098..6f9d470 100644 (file)
@@ -386,7 +386,6 @@ char *find_exec_path_by_bash_profile(char *target_path)
 char *find_ld_path(char *line) {
     int loc;
     char *ldpath = NULL;
-    char *start_p = NULL;
     int find_loc = 0;
 
     ldpath = strstr(line, "LD_LIBRARY_PATH");
@@ -407,7 +406,6 @@ char *find_ld_path(char *line) {
            return NULL;
        }
        if (ldpath[loc] == '=') {
-           start_p = &ldpath[loc];
            break;
        }
     }
index d9a103a..22b8600 100644 (file)
@@ -260,10 +260,18 @@ int write_pidfile(const char *filename)
     }
 
     /* clear old contents */
-    ftruncate(fd, 0);
+    if (ftruncate(fd, 0) < 0) {
+        log_msg(MSGL_ERROR, "%s at %s(%d)\n", strerror(errno), __FILE__, __LINE__);
+        close(fd);
+        return -1;
+    }
     memset(buf, 0, sizeof(buf));
     sprintf(buf, "%d", (int)getpid());
-    write(fd, buf, strlen(buf));
+    if (write(fd, buf, strlen(buf)) < 0) {
+        log_msg(MSGL_ERROR, "%s at %s(%d)\n", strerror(errno), __FILE__, __LINE__);
+        close(fd);
+        return -1;
+    }
 
 #ifndef _WIN32
     chmod(pidfname, S_IRWXU | S_IRWXG | S_IRWXO);
index 5f2948b..2243147 100644 (file)
@@ -34,6 +34,7 @@
 #include <time.h>
 
 #include "sms_util.h"
+#include "sms_tool.h"
 
 
 
@@ -187,7 +188,7 @@ int MsgConvertGSM7bitToUCS2(unsigned char *pDestText, int maxLength, const unsig
            i++;
            ucs2Buf[0] = (g_GSM7BitToUCS2TableExt[ pSrcText[i] ] & 0xFF00) >> 8;
            ucs2Buf[1] = g_GSM7BitToUCS2TableExt[ pSrcText[i] ] & 0x00FF;
-           MsgConvertUCS2toUTF8(&utf8Buf, 256, ucs2Buf, 2);
+           MsgConvertUCS2toUTF8(utf8Buf, 256, ucs2Buf, 2);
            pDestText[outTextLen++] = utf8Buf[0];
        }
        else
@@ -200,7 +201,7 @@ int MsgConvertGSM7bitToUCS2(unsigned char *pDestText, int maxLength, const unsig
                fprintf(stderr, "upperByte is not 0x00\n");
                ucs2Buf[0] = upperByte;
                ucs2Buf[1] = lowerByte;
-               MsgConvertUCS2toUTF8(&utf8Buf, 256, ucs2Buf, 2);
+               MsgConvertUCS2toUTF8(utf8Buf, 256, ucs2Buf, 2);
                pDestText[outTextLen++] = utf8Buf[0];
                pDestText[outTextLen++] = utf8Buf[1];
                fprintf(stderr,"upperByte:%x, lowerByte:%x\n", upperByte, lowerByte);
@@ -361,8 +362,7 @@ byte length of converted UCS2 characters
  */
 int MsgConvertUTF8toUCS2(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText, int srcTextLen)
 {
-    int i, j;
-    int textLen;       
+    int textLen;
     unsigned char *unicodeTemp = (unsigned char*)pDestText;
     int ucs2Length = 0;
     int remainedBuffer = maxLength;
@@ -373,13 +373,11 @@ int MsgConvertUTF8toUCS2(unsigned char *pDestText, int maxLength, const unsigned
     const unsigned char * pTempDestText = pDestText;
 #endif
 
-    i = j = 0; 
-
     if(maxLength == 0 || pSrcText == NULL || pDestText ==  NULL)
     {
        fprintf(stderr, "UTF8 to UCS2 Failed as text length is 0\n");
        return -1;
-    }  
+    }
 
     // null terminated string
     if ( srcTextLen == -1 )
@@ -399,7 +397,12 @@ int MsgConvertUTF8toUCS2(unsigned char *pDestText, int maxLength, const unsigned
 
     if (cd > 0)
     {
-       err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&unicodeTemp, (gsize*)&remainedBuffer);
+        err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&unicodeTemp, (gsize*)&remainedBuffer);
+        if (err < 0) {
+            fprintf(stderr, "g_iconv has failed\n");
+            g_iconv_close(cd);
+            return err;
+        }
     }
 
     ucs2Length = maxLength - remainedBuffer;
@@ -428,7 +431,6 @@ byte length of converted UTF8 characters
  */
 int MsgConvertUCS2toUTF8(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText,  int srcTextLen)
 {
-    int i , j ;
     int remainedBuffer = maxLength;
     int utf8Length;
 
@@ -438,12 +440,11 @@ int MsgConvertUCS2toUTF8(unsigned char *pDestText, int maxLength, const unsigned
 #endif
     unsigned char * pTempDestText = pDestText;
 
-    i= j = 0;
     if(srcTextLen == 0 || pSrcText == NULL || pDestText ==  NULL || maxLength == 0)
     {
        fprintf(stderr, "UCS2 to UTF8 Failed as text length is 0\n");
        return FALSE;
-    }          
+    }
 
     GIConv cd;
     int err=0;
@@ -452,7 +453,12 @@ int MsgConvertUCS2toUTF8(unsigned char *pDestText, int maxLength, const unsigned
 
     if (cd > 0)
     {
-       err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
+        err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
+        if (err < 0) {
+            fprintf(stderr, "g_iconv has failed\n");
+            g_iconv_close(cd);
+            return err;
+        }
     }
 
     utf8Length = maxLength - remainedBuffer;
@@ -512,7 +518,8 @@ bytelength of UTF8 text
  */
 int MsgConvertGSM7bitToUTF8(unsigned char *pDestText, int maxLength,  const unsigned char *pSrcText, int srcTextLen)
 {
-    int utf8Length = 0;
+    // FIXME: I don't know why this function returns ucs2 instead of utf8. should check later.
+    //int utf8Length = 0;
     int ucs2Length = 0;
     int maxUCS2Length = srcTextLen;            // max # of UCS2 chars, NOT bytes. when all gsm7 chars are only one byte(-there is no extenstion), UCS2Length is maxUCS2 Length. otherwise(ex: gsm7 char starts with 0x1b) UCS2Length must be less than gsm7 legnth
     unsigned short pUCS2Text[maxUCS2Length];
@@ -661,7 +668,7 @@ BOOL EncodeSmsDeliverTpdu(SmsAddressInfo SCA, TPDU_SMS_DELIVER tpdu_deliver, cha
            size = strlen((char*)tpdu_deliver.userData);
            packet[index++] = size + 1;
            memset(tmp_buff, '\0', BUFF_SIZE);
-           pos = MsgConvertUTF8ToGSM7bit ( tmp_buff, BUFF_SIZE, (char*)tpdu_deliver.userData, size);
+           pos = MsgConvertUTF8ToGSM7bit ( tmp_buff, BUFF_SIZE, (unsigned char*)tpdu_deliver.userData, size);
            if(pos < 0) {
                fprintf(stderr, "EncodeSmsDeliverTpdu: UTF8 to GSM7bit Failed as text length is 0\n");
                *rawdata_len = index;
@@ -680,7 +687,7 @@ BOOL EncodeSmsDeliverTpdu(SmsAddressInfo SCA, TPDU_SMS_DELIVER tpdu_deliver, cha
            size = strlen((char*)tpdu_deliver.userData) * 2;
            packet[index++] = size; //one unicode has 2 bytes
            memset(tmp_buff, '\0', BUFF_SIZE);
-           pos = MsgConvertUTF8toUCS2 ( tmp_buff, BUFF_SIZE, (char*)tpdu_deliver.userData, size );
+           pos = MsgConvertUTF8toUCS2 ( tmp_buff, BUFF_SIZE, (unsigned char*)tpdu_deliver.userData, size );
            if(pos < 0) {
                fprintf(stderr, "EncodeSmsDeliverTpdu: UTF8 to UCS2 Failed as text length is 0\n");
                *rawdata_len = index;
@@ -860,10 +867,9 @@ int DecodeSmsSubmitTpdu(TPDU_SMS_SUBMIT *tpdu_submit, int pdu_len , char * pPDU,
     }
 
     switch(tpdu_submit->dcs.alphabetType) {
-       case TAPI_NETTEXT_ALPHABET_DEFAULT:             
+       case TAPI_NETTEXT_ALPHABET_DEFAULT:
            //size = SmsUtilUnpackGSMCode((char *)tpdu_submit->userData, inData, (UINT8) tpdu_submit->udl);
            {
-               int i;
                BYTE    tmpData[TAPI_NETTEXT_SMDATA_SIZE_MAX+1];
                memset( tmpData, 0x00, TAPI_NETTEXT_SMDATA_SIZE_MAX + 1 );
                memcpy( (void*) tmpData, (void*)(inData + udhl), tpdu_submit->udl - udhl);
@@ -878,18 +884,18 @@ int DecodeSmsSubmitTpdu(TPDU_SMS_SUBMIT *tpdu_submit, int pdu_len , char * pPDU,
 
            memset(tmp_buff, '\0', BUFF_SIZE);
            //MsgConvertGSM7bitToUTF8( tmp_buff, BUFF_SIZE, (char *)tpdu_submit->userData, size );
-           MsgConvertGSM7bitToUTF8( tmp_buff, BUFF_SIZE, (char *)(tpdu_submit->userData + udhl), size );
+           MsgConvertGSM7bitToUTF8( tmp_buff, BUFF_SIZE, (unsigned char *)(tpdu_submit->userData + udhl), size );
            memcpy(tpdu_submit->userData, inData, udhl);
            memcpy(tpdu_submit->userData + udhl, tmp_buff, size);
-           break;      
+           break;
        case TAPI_NETTEXT_ALPHABET_8BIT:
            SmsUtilUnpackGSM8Code((char *)tpdu_submit->userData, inData, (UINT8) tpdu_submit->udl);
            break;
-       case TAPI_NETTEXT_ALPHABET_UCS2:        
+       case TAPI_NETTEXT_ALPHABET_UCS2:
            //size = SmsUtilUnpackUCS2Code((char *)tpdu_submit->userData, inData, (UINT8) tpdu_submit->udl);
            memcpy((void*)tpdu_submit->userData, (void*) inData, tpdu_submit->udl );
            memset(tmp_buff, '\0', BUFF_SIZE);
-           MsgConvertUCS2toUTF8( tmp_buff, BUFF_SIZE, (char *)tpdu_submit->userData, (UINT8) tpdu_submit->udl );
+           MsgConvertUCS2toUTF8( tmp_buff, BUFF_SIZE, (unsigned char *)tpdu_submit->userData, (UINT8) tpdu_submit->udl );
            //memcpy(tpdu_submit->userData, tmp_buff, size);
            break;
        default:
@@ -1127,7 +1133,7 @@ BOOL EncodeCB_GSM(CELLBROADCASTING cb_msg, char *rawdata, int *rawdata_len)
 
     memset( tmp_buff, '\0', BUFF_SIZE);
     size = strlen((char*)cb_msg.message);
-    MsgConvertUTF8ToGSM7bit ( tmp_buff, BUFF_SIZE, (char *)cb_msg.message, size );
+    MsgConvertUTF8ToGSM7bit(tmp_buff, BUFF_SIZE, (unsigned char *)cb_msg.message, size);
     memcpy( cb_msg.message, tmp_buff, size );
     pos =SmsUtilPackGSMCode( packet + index, (char *)cb_msg.message, strlen((char *)cb_msg.message));
     index += pos;
diff --git a/lib/libsms/sms_tool.h b/lib/libsms/sms_tool.h
new file mode 100644 (file)
index 0000000..28bbbf0
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ *  telephony-emulator
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sooyoung Ha <yoosah.ha@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef        _SMS_TOOL_H_
+#define _SMS_TOOL_H_
+
+int MsgConvertGSM7bitToUCS2(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText, int srcTextLen);
+int MsgConvertGSM7bitToUTF8(unsigned char *pDestText, int maxLength,  const unsigned char *pSrcText, int srcTextLen);
+int MsgConvertLocaleToUTF8(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText, int srcTextLen);
+int MsgConvertUCS2toGSM7bit(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText, int srcTextLen, BOOL *bUnknown);
+int MsgConvertUCS2toUTF8(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText,  int srcTextLen);
+int MsgConvertUTF8ToGSM7bit(unsigned char *pDestText, int maxLength,  const unsigned char *pSrcText, int srcTextLen);
+int MsgConvertUTF8toUCS2(unsigned char *pDestText, int maxLength, const unsigned char *pSrcText, int srcTextLen);
+
+#endif /* _SMS_TOOL_H_ */
index 25c1d0d..41b658e 100644 (file)
@@ -348,5 +348,13 @@ void SmsUtilEncodeDCS( BYTE* pDCS, TapiNetTextCodingScheme* pCodingScheme);
 
 UINT8 SmsUtilEncodeValidity( BYTE* pValidity, TapiNetTextVP* pVP );
 
+char* SmsUtilUnpackGSM8Code( char* szData, const BYTE* pIn, int in_len );
+int SmsUtilpackGSM8Code( BYTE* pOut, const char* szData, int in_len );
+void SmsUtilDecodeAddrField_sca(char *diallingNum, unsigned char* pAddrField, int *result_ton, int *result_npi );
+void SmsUtilDecodeAddrField_dst(char *diallingNum, unsigned char* pAddrField, int *result_ton, int *result_npi );
+int SmsReadSMSCfromSIM(unsigned char* pAddrFiled);
+int SmsUtilEncodeAddrField_sca(unsigned char* pAddrField, unsigned char* diallingNum, int dialnumLen, int ton, int npi);
+int SmsUtilEncodeAddrField_dst(unsigned char* pAddrField, unsigned char* diallingNum, int dialnumLen, int ton, int npi );
+
 #endif /* _SMS_UTIL_H_ */
 
index 008c2e9..a64a9b3 100644 (file)
@@ -77,5 +77,5 @@ int vgsm_gprs_ip_configuration(LXT_HANDLE* handle, gsm_GprsConfList list)
     if (pdata)
        free(pdata);
 
-    return 0;
+    return (nretn < 0 ? nretn : 0);
 }
index 31a08ad..45c3178 100644 (file)
@@ -134,7 +134,7 @@ void lxt_util_rawdataPrint(void *rawdata, int rawdatasize, const char *title)
        return;
     }
 
-    printf(title);
+    printf("%s", title);
 
     // save pointer
     p = (unsigned char *)rawdata;
index 73971b1..f5e085b 100644 (file)
@@ -247,6 +247,9 @@ typedef enum{
 
 /********************************* Functions ****************************************/
 char *readline(void);
+char* read_cmd_line(void);
+char* find_new_line(char* ptr, bool sms);
+
 void prv_byte_to_char(unsigned char aByte, char* hexaCharP);
 void prv_bytes_to_hexadecimal_string(unsigned char* bytesP, int bytesSize, char* hexaStringP, int* hexaStringSize);
 
index 6fbc103..11d7945 100644 (file)
@@ -43,6 +43,7 @@
 
 /////////////////////////////////////////////////////////////////////
 int RxPWR_DefaultPower(char* atmsg);
+int at_RxPWR_DefaultPower(char* atmsg);
 int at_rx_power_up_exec(char* atmsg);
 int at_rx_online_exec(char* atmsg);
 
index 4edf042..602bd1b 100644 (file)
@@ -50,5 +50,4 @@ int at_rx_sms_svc_option_set(char* atmsg);
 
 unsigned char* at_rx_sms_param_get(unsigned char* len);
 int at_rx_sms_param_set(char* atmsg);
-static void at_rx_sms_param_init(void);
 int sms_param_set_vconf(void);
index 8564a1d..cb0ec11 100644 (file)
@@ -32,6 +32,7 @@
 
 int at_tx_display_icon_info_noti(void *data, int len);
 int at_tx_display_icon_info_resp(void *data, int len);
+int at_tx_display_rssi_info_noti(void *data, int len);
 
 #endif
 
index 5fc2058..2e454e8 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "logmsg.h"
 
+int at_tx_sim_sec_check_password_res(void* ptr_data);
+
 int at_tx_sim_sec_get_imsi_res(void* ptr_data, int data_len);
 
 int at_tx_sim_sec_set_pin_status_res(int error);
index 43f72b4..5aefe9d 100644 (file)
@@ -62,5 +62,15 @@ void clear_callbarring_pwd_fail_count(void);
 //090225
 int  vgsm_ss_sqlite_cw_check_exist (int);
 
+int get_incoming_video_call_barring_state(void);
+int get_outgoing_video_call_barring_state(void);
+int get_incoming_voice_call_barring_state(void);
+int get_outgoing_voice_call_barring_state(void);
+int send_call_barring_entry(call_barring_entry_t* entry);
+void set_incoming_video_call_barring_state(int state);
+void set_outgoing_video_call_barring_state(int state);
+void set_incoming_voice_call_barring_state(int state);
+void set_outgoing_voice_call_barring_state(int state);
+
 #endif
 
index c479bc4..baada2d 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef        _OEM_RX_SECURITY_H_
 #define        _OEM_RX_SECURITY_H_
 
+int oem_rx_sim_sec_check_password_req(void* ptr_data, int data_len);
 
 int oem_rx_sim_sec_get_imsi_req(void* ptr_data, int data_len);
 
index 9cfa9ab..25d10d0 100644 (file)
@@ -31,6 +31,7 @@
 
 int oem_tx_display_icon_info_noti(void *data, int len);
 int oem_tx_display_icon_info_resp(void *data, int len);
+int oem_tx_display_rssi_info_noti(void *data, int len);
 
 #endif
 
index 5637479..ec11015 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef        _OEM_TX_SECURITY_H_
 #define        _OEM_TX_SECURITY_H_
 
+int oem_tx_sim_sec_check_password_res(void* ptr_data);
 
 int oem_tx_sim_sec_get_imsi_res(void* ptr_data, int data_len);
 
index 257cd2b..da128a4 100644 (file)
@@ -28,6 +28,7 @@
 
 #ifndef        _SERVER_COMMON_CALL_H_
 #define _SERVER_COMMON_CALL_H_
+#include <stdbool.h>
 #include "vgsm_call.h"
 #include "vgsm_ss.h"
 #include "at_recv.h"
@@ -39,6 +40,8 @@ void clear_call_list(void);
 void get_call_list( gsm_call_list_t *list );
 int release_all_held_call(void);
 int release_all_active_call(void);
+int release_incoming_call(void);
+int active_waiting_or_held_call(bool onWaiting);
 int drop_call( int call_id );
 int is_prev_ss_state(ss_hold_act_state_e_type prev_state);
 void set_ss_state(ss_hold_act_state_e_type state);
index 0796f0d..f3ed7f3 100644 (file)
@@ -39,6 +39,7 @@ int server_rx_call_release_exec(void);
 /* APIs for ss_manage_call */
 int server_rx_call_release_all_held(void);
 int server_rx_call_release_all_active(void);
+int server_rx_call_release_incoming(void);
 int server_rx_call_release_single(int call_id);
 int server_rx_call_swap(void);
 int server_rx_call_split_conf(int call_id);
index 67e6fa9..bef1461 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _SERVER_RX_SECURITY_H_
 #define _SERVER_RX_SECURITY_H_
 
+int server_rx_sim_sec_check_password_req(void* ptr_data, int data_len);
+
 int server_rx_sim_sec_get_imsi_req(void* ptr_data, int data_len);
 
 int server_rx_sim_sec_set_pin_status_req(void* ptr_data, int data_len);