applied coding rule 65/49365/1
authorGukhwan Cho <gh78.cho@samsung.com>
Tue, 13 Oct 2015 03:14:06 +0000 (12:14 +0900)
committerGukhwan Cho <gh78.cho@samsung.com>
Tue, 13 Oct 2015 03:14:06 +0000 (12:14 +0900)
Change-Id: Ia03861ef4946d97a4507ae3ac50d788b4d74c74a
Signed-off-by: Gukhwan Cho <gh78.cho@samsung.com>
src/phn.c
src/phn_location.c
src/phn_phonenumber_wrapper.cpp
src/phn_region_data.c

index 960793d355ea767f84aeda11d571c39365e59a2a..8e7a1f42df1dc43eb7e9e85a145e499281f539aa 100644 (file)
--- a/src/phn.c
+++ b/src/phn.c
@@ -116,4 +116,3 @@ API int phone_number_get_formatted_number(const char *number, phone_number_regio
        return PHONE_NUMBER_ERROR_NONE;
 }
 
-
index aea8c54cf26c847c8f064f1ef2b5bea64ca3db62..f56283fdc71be537b00e0453e7184f063a679e1f 100644 (file)
@@ -198,7 +198,7 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
 
        int i;
        int telephone_city_count =
-               sizeof(telephone_city_info) /sizeof(struct phn_telephone_city_info);
+               sizeof(telephone_city_info) / sizeof(struct phn_telephone_city_info);
        for (i = 0; i < telephone_city_count; i++) {
                gint8 provice_idx;
                gint16 prefix = telephone_city_info[i].prefix;
@@ -209,15 +209,15 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                        switch (lang_index) {
                        case 0:
                                city_str = telephone_city_info[i].city1;
-                               city_str_len = header.telephone_city_len[0]/2;
+                               city_str_len = header.telephone_city_len[0] / 2;
                                break;
                        case 1:
                                city_str = telephone_city_info[i].city2;
-                               city_str_len = header.telephone_city_len[1]/2;
+                               city_str_len = header.telephone_city_len[1] / 2;
                                break;
                        case 2:
                                city_str = telephone_city_info[i].city3;
-                               city_str_len = header.telephone_city_len[2]/2;
+                               city_str_len = header.telephone_city_len[2] / 2;
                                break;
                        default:
                                ERR("Invalid lang_index(%d)", lang_index);
@@ -229,15 +229,15 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                switch (lang_index) {
                                case 0:
                                        province_str = province_info[provice_idx-1].name1;
-                                       province_str_len = header.province_name_len[0]/2;
+                                       province_str_len = header.province_name_len[0] / 2;
                                        break;
                                case 1:
                                        province_str = province_info[provice_idx-1].name2;
-                                       province_str_len = header.province_name_len[1]/2;
+                                       province_str_len = header.province_name_len[1] / 2;
                                        break;
                                case 2:
                                        province_str = province_info[provice_idx-1].name3;
-                                       province_str_len = header.province_name_len[2]/2;
+                                       province_str_len = header.province_name_len[2] / 2;
                                        break;
                                default:
                                        ERR("Invalid lang_index(%d)", lang_index);
@@ -252,16 +252,16 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                        if (city_temp && province_temp) {
                                int size = strlen(city_temp) + strlen(province_temp);
                                char *location = NULL;
-                               location = calloc(size+3, sizeof(char));
+                               location = calloc(size + 3, sizeof(char));
                                if (location)
-                                       snprintf(location, size+3, "%s, %s", city_temp, province_temp);
+                                       snprintf(location, size + 3, "%s, %s", city_temp, province_temp);
                                *p_location = location;
                        } else if (city_temp) {
                                int size = strlen(city_temp);
                                char *location = NULL;
-                               location = calloc(size+1, sizeof(char));
+                               location = calloc(size + 1, sizeof(char));
                                if (location)
-                                       snprintf(location, size+1, "%s", city_temp);
+                                       snprintf(location, size + 1, "%s", city_temp);
                                *p_location = location;
                        }
 
@@ -306,10 +306,10 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                return PHONE_NUMBER_ERROR_NOT_SUPPORTED;
        }
 
-       char num_prefix_str[PHN_LOCATION_CHINA_MOBILE_PREFIX_LEN+1] = {0};
-       char num_suffix_str[PHN_LOCATION_CHINA_MOBILE_SUFFIX_LEN+1] = {0};
+       char num_prefix_str[PHN_LOCATION_CHINA_MOBILE_PREFIX_LEN + 1] = {0};
+       char num_suffix_str[PHN_LOCATION_CHINA_MOBILE_SUFFIX_LEN + 1] = {0};
        snprintf(num_prefix_str, sizeof(num_prefix_str), "%s", number);
-       snprintf(num_suffix_str, sizeof(num_suffix_str), "%s", number+3);
+       snprintf(num_suffix_str, sizeof(num_suffix_str), "%s", number + 3);
        int num_prefix = atoi(num_prefix_str);
        int num_suffix = atoi(num_suffix_str);
 
@@ -317,8 +317,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        for (i = 0; i < mobile_prefix_index_count; i++) {
                if (num_prefix == mobile_prefix_info[i]) {
                        gint16 mobile_prefix = 0;
-                       ret = lseek(fd, (PHN_LOCATION_CHINA_MOBILE_SUFFIX_OFFSET*sizeof(gint16)*i)
-                                       + (num_suffix*sizeof(gint16)), SEEK_CUR);
+                       ret = lseek(fd, (PHN_LOCATION_CHINA_MOBILE_SUFFIX_OFFSET * sizeof(gint16) * i)
+                                       + (num_suffix * sizeof(gint16)), SEEK_CUR);
                        ret = read(fd, &mobile_prefix, sizeof(gint16));
                        WARN_IF(ret < 0, "read() Fail(%d)", errno);
                        if (0 == mobile_prefix) {
@@ -328,37 +328,37 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
 
                        switch (lang_index) {
                        case 0:
-                               city_str = mobile_city_info[mobile_prefix-1].city1;
-                               city_str_len = header.mobile_city_len[0]/2;
+                               city_str = mobile_city_info[mobile_prefix - 1].city1;
+                               city_str_len = header.mobile_city_len[0] / 2;
                                break;
                        case 1:
-                               city_str = mobile_city_info[mobile_prefix-1].city2;
-                               city_str_len = header.mobile_city_len[1]/2;
+                               city_str = mobile_city_info[mobile_prefix - 1].city2;
+                               city_str_len = header.mobile_city_len[1] / 2;
                                break;
                        case 2:
-                               city_str = mobile_city_info[mobile_prefix-1].city3;
-                               city_str_len = header.mobile_city_len[2]/2;
+                               city_str = mobile_city_info[mobile_prefix - 1].city3;
+                               city_str_len = header.mobile_city_len[2] / 2;
                                break;
                        default:
                                ERR("Invalid lang_index(%d)", lang_index);
                                break;
                        }
 
-                       int province_index = mobile_city_info[mobile_prefix-1].province_index;
+                       int province_index = mobile_city_info[mobile_prefix - 1].province_index;
 
                        if (0 < province_index && province_index <= header.province_count) {
                                switch (lang_index) {
                                case 0:
-                                       province_str = province_info[province_index-1].name1;
-                                       province_str_len = header.province_name_len[0]/2;
+                                       province_str = province_info[province_index - 1].name1;
+                                       province_str_len = header.province_name_len[0] / 2;
                                        break;
                                case 1:
-                                       province_str = province_info[province_index-1].name2;
-                                       province_str_len = header.province_name_len[1]/2;
+                                       province_str = province_info[province_index - 1].name2;
+                                       province_str_len = header.province_name_len[1] / 2;
                                        break;
                                case 2:
-                                       province_str = province_info[province_index-1].name3;
-                                       province_str_len = header.province_name_len[2]/2;
+                                       province_str = province_info[province_index - 1].name3;
+                                       province_str_len = header.province_name_len[2] / 2;
                                        break;
                                default:
                                        ERR("Invalid lang_index(%d)", lang_index);
@@ -373,16 +373,16 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                        if (city_temp && province_temp) {
                                int size = strlen(city_temp) + strlen(province_temp);
                                char *location = NULL;
-                               location = calloc(size+3, sizeof(char));
+                               location = calloc(size + 3, sizeof(char));
                                if (location)
-                                       snprintf(location, size+3, "%s, %s", city_temp, province_temp);
+                                       snprintf(location, size + 3, "%s, %s", city_temp, province_temp);
                                *p_location = location;
                        } else if (city_temp) {
                                int size = strlen(city_temp);
                                char *location = NULL;
-                               location = calloc(size+1, sizeof(char));
+                               location = calloc(size + 1, sizeof(char));
                                if (location)
-                                       snprintf(location, size+1, "%s", city_temp);
+                                       snprintf(location, size + 1, "%s", city_temp);
                                *p_location = location;
                        }
                        close(fd);
index 2ebfece79047c36b1acff3ccc8d539319870ffc8..c29112058e61f6da135c4a5607fc72f72172238d 100644 (file)
@@ -32,12 +32,12 @@ int phn_get_location_from_number(const char *number, const char *region, const c
        PhoneNumber phNumber;
        const PhoneNumberUtil& pn_instance = *PhoneNumberUtil::GetInstance();
        const PhoneNumberUtil::ErrorType status = pn_instance.Parse(
-               number, region, &phNumber);
+                       number, region, &phNumber);
        RETVM_IF(status != PhoneNumberUtil::NO_PARSING_ERROR, PHONE_NUMBER_ERROR_NO_DATA, "parse() failed(%d)", status);
 
        const std::string description =
                PhoneNumberOfflineGeocoder().GetDescriptionForNumber(
-                       phNumber, icu::Locale(language));
+                               phNumber, icu::Locale(language));
        *location = g_strdup((gchar *)description.c_str());
 
        return PHONE_NUMBER_ERROR_NONE;
@@ -48,7 +48,7 @@ int phn_get_formatted_number(const char *number, const char *region, char **form
        const PhoneNumberUtil& pn_instance = *PhoneNumberUtil::GetInstance();
        AsYouTypeFormatter *formatter = pn_instance.GetAsYouTypeFormatter(region);
 
-       int i=0;
+       int i = 0;
        string result;
        while (number[i] && '\0' != number[i]) {
                formatter->InputDigit(number[i++], &result);
index d2c5898aed33d566e232df4edb5e2798b15fdf79..1a70305115e58ef72b30f6d99e4c00818bd1469b 100644 (file)
@@ -300,7 +300,7 @@ int phn_region_data_get_region_str(phone_number_region_e region, char **region_s
                return PHONE_NUMBER_ERROR_NONE;
        }
 
-       for (i = 0; i < sizeof(phn_region_info_table)/sizeof(struct phn_region_info); i++) {
+       for (i = 0; i < sizeof(phn_region_info_table) / sizeof(struct phn_region_info); i++) {
                if (phn_region_info_table[i].region == region) {
                        *region_str = g_strdup(phn_region_info_table[i].region_str);
                        return PHONE_NUMBER_ERROR_NONE;
@@ -326,7 +326,7 @@ int phn_region_data_get_lang_str(phone_number_lang_e lang, char **lang_str)
                return PHONE_NUMBER_ERROR_NONE;
        }
 
-       for (i = 0; i < sizeof(phn_lang_info_table)/sizeof(struct phn_lang_info); i++) {
+       for (i = 0; i < sizeof(phn_lang_info_table) / sizeof(struct phn_lang_info); i++) {
                if (phn_lang_info_table[i].lang == lang) {
                        *lang_str = g_strdup(phn_lang_info_table[i].lang_str);
                        return PHONE_NUMBER_ERROR_NONE;
@@ -339,7 +339,7 @@ bool phn_region_data_find_match_info(phone_number_region_e region,
                phone_number_lang_e lang)
 {
        int i;
-       for (i = 0; i < sizeof(phn_match_info_table)/sizeof(struct phn_match_info); i++) {
+       for (i = 0; i < sizeof(phn_match_info_table) / sizeof(struct phn_match_info); i++) {
                if (phn_match_info_table[i].region == region
                                && phn_match_info_table[i].lang == lang) {
                        return true;
@@ -347,3 +347,4 @@ bool phn_region_data_find_match_info(phone_number_region_e region,
        }
        return false;
 }
+