diff options
author | Kyeonghun Lee <kh9090.lee@samsung.com> | 2016-06-16 17:51:45 +0900 |
---|---|---|
committer | Kyeonghun Lee <kh9090.lee@samsung.com> | 2016-06-16 17:51:45 +0900 |
commit | ca7ecee4c05ef7d5e50ea8e533033ac1bed5f4e2 (patch) | |
tree | 088083ce9a17f0714bcee33de726e24a871580d6 /utils | |
parent | 27d5d95f853801c518270e83f3558e66ded53e50 (diff) | |
download | msg-service-ca7ecee4c05ef7d5e50ea8e533033ac1bed5f4e2.tar.gz msg-service-ca7ecee4c05ef7d5e50ea8e533033ac1bed5f4e2.tar.bz2 msg-service-ca7ecee4c05ef7d5e50ea8e533033ac1bed5f4e2.zip |
apply tizen c++ coding rule
Change-Id: If5b90dc8e774ccfc723f305267c9f1fd96755b9e
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/MsgIpcSocket.cpp | 14 | ||||
-rwxr-xr-x | utils/MsgMmsMessage.cpp | 4 | ||||
-rwxr-xr-x | utils/MsgSmil.cpp | 11 | ||||
-rwxr-xr-x | utils/MsgSqliteWrapper.cpp | 3 | ||||
-rwxr-xr-x | utils/MsgUtilMime.cpp | 6 | ||||
-rwxr-xr-x | utils/MsgUtilStorage.cpp | 16 | ||||
-rwxr-xr-x | utils/MsgVMessage.cpp | 83 |
7 files changed, 61 insertions, 76 deletions
diff --git a/utils/MsgIpcSocket.cpp b/utils/MsgIpcSocket.cpp index c7ac95e..b34ea2b 100755 --- a/utils/MsgIpcSocket.cpp +++ b/utils/MsgIpcSocket.cpp @@ -227,8 +227,7 @@ bool MsgIpcClientSocket::wait_for_reply() if (err == -1) { MSG_FATAL("select error[%d] fd[%d]", errno, sockfd); return false; - } - else if (err == 0) { + } else if (err == 0) { MSG_FATAL("select timeout fd[%d]", sockfd); return false; } @@ -262,8 +261,7 @@ int MsgIpcClientSocket::read(char** buf, unsigned int* len) if (n == CLOSE_CONNECTION_BY_SIGNAL) { /* if msgfw gets down, it signals to all IPC clients */ MSG_FATAL("sockfd [%d] CLOSE_CONNECTION_BY_SIGNAL", sockfd); return n; - } - else if (n != sizeof(int)) { + } else if (n != sizeof(int)) { MSG_FATAL("WARNING: read header_size[%d] not matched [%d]", n, sizeof(int)); return CUSTOM_SOCKET_ERROR; } @@ -443,9 +441,9 @@ int MsgIpcServerSocket::readn(int fd, char *buf, unsigned int len ) if (nread < 0) { MSG_FATAL("read: %s", g_strerror(errno)); return nread; - } - else if (nread == 0) + } else if (nread == 0) { break; + } if (nleft >= (unsigned int)nread) nleft -= nread; @@ -479,9 +477,7 @@ int MsgIpcServerSocket::read(int fd, char** buf, int* len ) if (n == CLOSE_CONNECTION_BY_SIGNAL) { MSG_FATAL("fd %d CLOSE_CONNECTION_BY_SIGNAL", fd); return n; - } - - else if (n != sizeof(int)) { + } else if (n != sizeof(int)) { MSG_FATAL("readn %d(%d)", n, sizeof(int)); return CUSTOM_SOCKET_ERROR; } diff --git a/utils/MsgMmsMessage.cpp b/utils/MsgMmsMessage.cpp index 27af827..64a7c71 100755 --- a/utils/MsgMmsMessage.cpp +++ b/utils/MsgMmsMessage.cpp @@ -753,9 +753,9 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa offset += sizeof(MMS_ATTACH_S); MSG_SEC_DEBUG("[#%2d][%5d][%d attach] drm type [%d], attach filepath = [%s], content type = [%s]", serial_index++, offset, i, pAttach->drmType, pAttach->szFilePath, pAttach->szContentType); - if (strlen(pAttach->szFilePath) >0) + if (strlen(pAttach->szFilePath) >0) { pMsgData->attachlist = g_list_append(pMsgData->attachlist, pAttach); - else { + } else { free(pAttach); pAttach = NULL; } diff --git a/utils/MsgSmil.cpp b/utils/MsgSmil.cpp index afd42ab..bc935b0 100755 --- a/utils/MsgSmil.cpp +++ b/utils/MsgSmil.cpp @@ -939,8 +939,9 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) } MsgSmilInsertNode(pstLayoutList, pstRootLayoutList, pstRegion); - } else + } else { MSG_DEBUG("There is no attribute in <region> node"); + } MSG_END(); return true; @@ -1754,13 +1755,13 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) case ATTRIBUTE_VALUE: - if (paramType == ATTRIBUTE_SIZE && gCmd[ELEMENT_TEXT] && gMedia) + if (paramType == ATTRIBUTE_SIZE && gCmd[ELEMENT_TEXT] && gMedia) { gMedia->sMedia.sText.nSize = MsgSmilGetFontSizeValue((char *)pAttr->children->content); - else if (paramType == ATTRIBUTE_FGCOLOR && gCmd[ELEMENT_TEXT] && gMedia) + } else if (paramType == ATTRIBUTE_FGCOLOR && gCmd[ELEMENT_TEXT] && gMedia) { gMedia->sMedia.sText.nColor = MsgSmilGetColorValue(pAttr->children->content); - else if (paramType == ATTRIBUTE_BGCOLOR && gCmd[ELEMENT_TEXT] && gMedia) + } else if (paramType == ATTRIBUTE_BGCOLOR && gCmd[ELEMENT_TEXT] && gMedia) { gMedia->sMedia.sText.nBgColor = MsgSmilGetColorValue(pAttr->children->content); - else if (paramType == ATTRIBUTE_TEXTFORMAT && gCmd[ELEMENT_TEXT] && gMedia) { + } else if (paramType == ATTRIBUTE_TEXTFORMAT && gCmd[ELEMENT_TEXT] && gMedia) { MmsSmilFontType fontType; fontType = MsgSmilGetFontTypeValue((char *)pAttr->children->content); diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp index 3aecc02..21cb34a 100755 --- a/utils/MsgSqliteWrapper.cpp +++ b/utils/MsgSqliteWrapper.cpp @@ -446,8 +446,7 @@ void MsgDbHandler::shm_mutex_timedlock(int sec) if (err == EOWNERDEAD) { err = pthread_mutex_consistent(mmapMx); MSG_DEBUG("Previous owner is dead with lock. Fix mutex"); - } - else if (err != 0) { + } else if (err != 0) { MSG_FATAL("pthread_mutex_timedlock error [%d]", errno); return; } diff --git a/utils/MsgUtilMime.cpp b/utils/MsgUtilMime.cpp index aa1ccb6..77acc47 100755 --- a/utils/MsgUtilMime.cpp +++ b/utils/MsgUtilMime.cpp @@ -604,8 +604,9 @@ int __MimeGetTableIndexString(const char *szMime) type = __MimeGetMainTypeName(szType); szTmpStart = &szTmpStart[i]; break; - } else + } else { szType[j++] = c; + } } i = 0; @@ -629,8 +630,9 @@ int __MimeGetTableIndexString(const char *szMime) if (!strcasecmp(szSubType, "x")) subtype = MIME_SUB_TYPE_X; break; - } else + } else { szSubType[j++] = c; + } } diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index defb17c..735bb28 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -868,8 +868,8 @@ msg_error_t MsgStoClearConversationTable(MsgDbHandler *pDbHandle) memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s \ - WHERE CONV_ID NOT IN (SELECT CONV_ID FROM %s) AND CONV_ID <> 0;", + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s " + "WHERE CONV_ID NOT IN (SELECT CONV_ID FROM %s) AND CONV_ID <> 0;", MSGFW_CONVERSATION_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); err = pDbHandle->execQuery(sqlQuery); @@ -1407,8 +1407,7 @@ bool MsgExistAddress(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg, msg_thr if (err == MSG_ERR_DB_NORECORD) { pDbHandle->freeTable(); return false; - } - else if (err != MSG_SUCCESS) { + } else if (err != MSG_SUCCESS) { pDbHandle->freeTable(); return false; } @@ -2359,8 +2358,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s C, %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND ", MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); - } - else { + } else { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND ", MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); @@ -2476,8 +2474,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND ((A.MSG_TEXT LIKE ? ESCAPE '%c' OR A.SUBJECT LIKE ? ESCAPE '%c' OR (C.NAME LIKE ? ESCAPE '%c' AND A.MSG_ID = C.MSG_ID AND C.CONTENT_TYPE <> 'application/smil'))) ", MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR); - } - else { + } else { snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND ((A.MSG_TEXT LIKE ? ESCAPE '%c' OR A.SUBJECT LIKE ? ESCAPE '%c')) ", MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR); @@ -2492,8 +2489,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND ((A.MSG_TEXT LIKE ? ESCAPE '%c' OR A.SUBJECT LIKE ? ESCAPE '%c' OR (C.NAME LIKE ? ESCAPE '%c' AND A.MSG_ID = C.MSG_ID AND C.CONTENT_TYPE <> 'application/smil')) ", MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR); - } - else { + } else { snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND ((A.MSG_TEXT LIKE ? ESCAPE '%c' OR A.SUBJECT LIKE ? ESCAPE '%c') ", MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR); diff --git a/utils/MsgVMessage.cpp b/utils/MsgVMessage.cpp index 6d5542e..3a8850c 100755 --- a/utils/MsgVMessage.cpp +++ b/utils/MsgVMessage.cpp @@ -261,8 +261,7 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch *r = '\\'; r++; *r = 'n'; - } - else { + } else { *r = *s; } break; @@ -272,9 +271,9 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch str_len++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); @@ -293,9 +292,9 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch str_len++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); @@ -310,9 +309,9 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch str_len++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); @@ -324,17 +323,16 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch s++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); } } *r = *s; - } - else { + } else { *r = *s; } break; @@ -345,9 +343,9 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch str_len++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); @@ -359,17 +357,16 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch s++; if (*buf_size < str_len+len+1) { *buf_size = *buf_size * 2; - if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) + if (NULL == (tmp = (char *)realloc(*buf, *buf_size))) { return -1; - else { + } else { int pos_temp = r-(*buf+len); *buf = tmp; r = (char *)(*buf+len+pos_temp); } } *r = *s; - } - else { + } else { *r = *s; } break; @@ -381,8 +378,7 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch s++; } len_temp = str_len; - } - else { + } else { len_temp = snprintf(*buf+len, *buf_size-len+1, "%s", safe_str); } len += len_temp; @@ -638,8 +634,7 @@ static inline int __msgsvc_vmsg_add_folding(char **buf, int *buf_size, int buf_l if (NULL == (tmp = (char *)realloc(buf_copy, *buf_size))) { free(buf_copy); return -1; - } - else { + } else { buf_copy = tmp; r = (buf_copy + result_len); } @@ -652,9 +647,9 @@ static inline int __msgsvc_vmsg_add_folding(char **buf, int *buf_size, int buf_l encode_64 = true; } - if ('\r' == *s) + if ('\r' == *s) { len--; - else if ('\n' == *s) { + } else if ('\n' == *s) { len = -1; char_len = 0; content_start = false; @@ -1110,9 +1105,9 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) char* msgText = NULL; #if 0 char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; - if(pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) + if(pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { pFileData = MsgOpenAndReadMmsFile(pMsg->msgData, 0, -1, &fileSize); - else { + } else { err = MsgStoGetMmsRawFilePath(pDbHandle, pMsg->msgId, filePath); if (err != MSG_SUCCESS) @@ -1431,8 +1426,7 @@ static inline char* __msgsvc_vmsg_translate_charset(char *src, int len) val += sizeof("CHARSET"); break; } - } - else if (':' == *val) { + } else if (':' == *val) { return NULL; } val++; @@ -1488,8 +1482,7 @@ static void __msgsvc_vmsg_get_prefix(char **prefix, char *src) long len = (long)temp - (long)src; *prefix = (char *)calloc(len+1, sizeof(char)); snprintf(*prefix, len+1, "%s", src); - } - else { + } else { *prefix = NULL; } } @@ -1548,8 +1541,7 @@ static char* __msgsvc_vmsg_get_val(int ver, char *src, char **prefix, char **des cursor++; } - } - else { + } else { while (*cursor) { if ('\r' == *cursor && '\n' == *(cursor+1) && ' ' != *(cursor+2)) break; @@ -1564,8 +1556,7 @@ static char* __msgsvc_vmsg_get_val(int ver, char *src, char **prefix, char **des if (src == cursor) { *dest = NULL; return NULL; - } - else { + } else { int len = 0; char temp = *cursor; char *new_dest; @@ -1604,9 +1595,9 @@ static int __msgsvc_vmsg_check_content_type(char **vcard) break; } - if (VMSG_MAXIMUM_VALUE == i) + if (VMSG_MAXIMUM_VALUE == i) { return VMSG_VALUE_NONE; - else { + } else { *vcard = new_start; return i; } @@ -1767,8 +1758,7 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_box(MSG_MESSAGE_INFO_S *pMsg, ch pMsg->folderId = MSG_DRAFT_ID; pMsg->direction = MSG_DIRECTION_TYPE_MO; pMsg->networkStatus = MSG_NETWORK_NOT_SEND; - } - else if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_INBOX]) == 0) { + } else if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_INBOX]) == 0) { pMsg->folderId = MSG_INBOX_ID; pMsg->direction = MSG_DIRECTION_TYPE_MT; pMsg->networkStatus = MSG_NETWORK_RECEIVED; @@ -1776,8 +1766,9 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_box(MSG_MESSAGE_INFO_S *pMsg, ch pMsg->folderId = MSG_SENTBOX_ID; pMsg->direction = MSG_DIRECTION_TYPE_MO; pMsg->networkStatus = MSG_NETWORK_SEND_SUCCESS; - } else + } else { return MSG_ERR_INVALID_PARAMETER; + } MSG_DEBUG("pMsg->folderId = %d", pMsg->folderId); return MSG_SUCCESS; @@ -1796,12 +1787,11 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_type(MSG_MESSAGE_INFO_S *pMsg, c pMsg->msgType.mainType = MSG_SMS_TYPE; pMsg->msgType.subType = MSG_NORMAL_SMS; pMsg->msgType.classType = MSG_CLASS_NONE; - } - else if (strcmp(temp, content_name[VMSG_INDICATION_MESSAGE_TYPE_INET]) == 0) { + } else if (strcmp(temp, content_name[VMSG_INDICATION_MESSAGE_TYPE_INET]) == 0) { /* To do */ - } - else + } else { return MSG_ERR_INVALID_PARAMETER; + } MSG_DEBUG("pMsg->msgType.subType = %d", pMsg->msgType.subType); return MSG_SUCCESS; @@ -1984,9 +1974,9 @@ static inline msg_error_t __msgsvc_vmsg_get_msg(int ver, char *vmsg, MSG_MESSAGE if (new_start) { cursor = new_start; continue; - } - else + } else { break; + } } } @@ -2041,8 +2031,9 @@ static inline msg_error_t __msgsvc_vmsg_get_msg(int ver, char *vmsg, MSG_MESSAGE g_free(val); g_free(prefix); return MSG_SUCCESS; - } else + } else { break; + } default: MSG_ERR("Invalid parameter : __msgsvc_vmsg_check_content_type() Failed(%d)", type); g_free(val); |