apply coding style 74/40874/2 accepted/tizen_3.0.2015.q2_common tizen_3.0.2015.q2_common accepted/tizen/3.0.2015.q2/common/20150615.091831 accepted/tizen/common/20150610.144624 accepted/tizen/mobile/20150611.004734 accepted/tizen/tv/20150611.004739 accepted/tizen/wearable/20150611.004759 submit/tizen/20150610.115312 submit/tizen_3.0.2015.q2_common/20150615.075539
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 10 Jun 2015 06:27:12 +0000 (15:27 +0900)
committerJiwon Park <jiwon44.park@samsung.com>
Wed, 10 Jun 2015 10:15:35 +0000 (03:15 -0700)
Change-Id: I7f0dbe61916ef3f04e6f2b7bf3bfca242689865d

doc/phnumber_doc.h
include/phone_number.h
include/phone_number_errors.h
include/phone_number_types.h
src/phn_common.h
src/phn_location.c
src/phn_location.h
src/phn_phonenumber_wrapper.cpp
src/phn_phonenumber_wrapper.h
src/phn_region_data.c
src/phn_region_data.h

index 3670c62f6dc3aa026d7bce1dc37aba69e9292cf9..7ea5ba5290fe93b87fbc6adf9500dc72e14eb727 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_DOC_H__
 #define __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_DOC_H__
 
@@ -33,4 +32,4 @@
  * The phonenumber utils API provides methods for parsing and formatting phone numbers.
  */
 
-#endif //  __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_DOC_H__
+#endif /*  __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_DOC_H__ */
index f90f678bc2daf34febc709e9d118b73bc7a2506b..e2edfb5c56d856aaaef9a6f49e4429c2bd5d2995 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_H__
 #define __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_H__
 
@@ -53,16 +52,17 @@ extern "C"
  * @return     @c 0 on success,
  *             otherwise a negative error value
  *
- * @retval  #PHONE_NUMBER_ERROR_NONE                          Successful
- * @retval  #PHONE_NUMBER_ERROR_OUT_OF_MEMORY                 Out of memory
- * @retval  #PHONE_NUMBER_ERROR_INVALID_PARAMETER             Invalid parameter
- * @retval  #PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE       FS Full
- * @retval  #PHONE_NUMBER_ERROR_PERMISSION_DENIED             Permission denied
- * @retval  #PHONE_NUMBER_ERROR_NOT_SUPPORTED                 Not supported
- * @retval  #PHONE_NUMBER_ERROR_NO_DATA                       Requested data does not exist
+ * @retval  #PHONE_NUMBER_ERROR_NONE                        Successful
+ * @retval  #PHONE_NUMBER_ERROR_OUT_OF_MEMORY               Out of memory
+ * @retval  #PHONE_NUMBER_ERROR_INVALID_PARAMETER           Invalid parameter
+ * @retval  #PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE     FS Full
+ * @retval  #PHONE_NUMBER_ERROR_PERMISSION_DENIED           Permission denied
+ * @retval  #PHONE_NUMBER_ERROR_NOT_SUPPORTED               Not supported
+ * @retval  #PHONE_NUMBER_ERROR_NO_DATA                     Requested data does not exist
  *
  */
-int phone_number_get_location_from_number(const char *number, phone_number_region_e region, phone_number_lang_e language, char **location);
+int phone_number_get_location_from_number(const char *number,
+               phone_number_region_e region, phone_number_lang_e language, char **location);
 
 /**
  * @brief This function gets the formatted number.
@@ -78,16 +78,17 @@ int phone_number_get_location_from_number(const char *number, phone_number_regio
  * @return     @c 0 on success,
  *             otherwise a negative error value
  *
- * @retval  #PHONE_NUMBER_ERROR_NONE                          Successful
- * @retval  #PHONE_NUMBER_ERROR_OUT_OF_MEMORY                 Out of memory
- * @retval  #PHONE_NUMBER_ERROR_INVALID_PARAMETER             Invalid parameter
- * @retval  #PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE       FS Full
- * @retval  #PHONE_NUMBER_ERROR_PERMISSION_DENIED             Permission denied
- * @retval  #PHONE_NUMBER_ERROR_NOT_SUPPORTED                 Not supported
- * @retval  #PHONE_NUMBER_ERROR_NO_DATA                       Requested data does not exist
+ * @retval  #PHONE_NUMBER_ERROR_NONE                        Successful
+ * @retval  #PHONE_NUMBER_ERROR_OUT_OF_MEMORY               Out of memory
+ * @retval  #PHONE_NUMBER_ERROR_INVALID_PARAMETER           Invalid parameter
+ * @retval  #PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE     FS Full
+ * @retval  #PHONE_NUMBER_ERROR_PERMISSION_DENIED           Permission denied
+ * @retval  #PHONE_NUMBER_ERROR_NOT_SUPPORTED               Not supported
+ * @retval  #PHONE_NUMBER_ERROR_NO_DATA                     Requested data does not exist
  *
  */
-int phone_number_get_formatted_number(const char *number, phone_number_region_e region, char **formatted_number);
+int phone_number_get_formatted_number(const char *number, phone_number_region_e region,
+               char **formatted_number);
 
 /**
  * @}
@@ -97,4 +98,4 @@ int phone_number_get_formatted_number(const char *number, phone_number_region_e
 }
 #endif
 
-#endif // __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_H__
\ No newline at end of file
+#endif /* __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_H__ */
index 1c85224792aeae16137584de7a79b8b3db8c915d..419b1390c452a9dc0d03524600b7972201b9f23e 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_ERRORS_H__
 #define __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_ERRORS_H__
 
@@ -38,8 +37,7 @@
  * @since_tizen 2.4
  *
  */
-typedef enum
-{
+typedef enum {
        /* GENERAL */
        PHONE_NUMBER_ERROR_NONE                        = TIZEN_ERROR_NONE,                      /**< Successful */
        PHONE_NUMBER_ERROR_IO_ERROR                    = TIZEN_ERROR_IO_ERROR,                  /**< I/O Error */
@@ -56,4 +54,4 @@ typedef enum
  * @}
  */
 
-#endif // __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_ERRORS_H__
\ No newline at end of file
+#endif /* __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_ERRORS_H__ */
index fae9ba9c0c81d513409198ac752eadd298844c63..3a7a01aae4fba6f74999e57c2dacf4c9919feb04 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_TYPES_H__
 #define __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_TYPES_H__
 
@@ -69,7 +68,7 @@ typedef enum {
        PHONE_NUMBER_LANG_TURKISH,                      /**< Turkish */
        PHONE_NUMBER_LANG_VIETNAMESE,                   /**< Vietnamese */
        PHONE_NUMBER_LANG_MAX,
-}phone_number_lang_e;
+} phone_number_lang_e;
 
 /**
  * @brief Enumeration for region type.
@@ -211,11 +210,11 @@ typedef enum {
        PHONE_NUMBER_REGION_ZAMBIA,                                     /**< Zambia */
        PHONE_NUMBER_REGION_ZIMBABWE,                                   /**< Zimbabwe */
        PHONE_NUMBER_REGION_MAX,
-}phone_number_region_e;
+} phone_number_region_e;
 
 
 /**
  * @}
  */
 
-#endif // __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_TYPES_H__
+#endif /* __TIZEN_TELEPHONY_PHONE_NUMBER_UTILS_TYPES_H__ */
index 3d8428e5980da91f6b5edfeeccac6f87dc5c1408..10d0b6c1779aada30d6346de95d2d39b8cfcc24c 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __PHN_COMMON_H__
 #define __PHN_COMMON_H__
 
@@ -32,7 +31,7 @@
 #endif
 
 #define DLOG(prio, fmt, arg...) \
-  do { SLOG(prio, LOG_TAG, fmt, ##arg); } while(0);
+       do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0);
 #define INFO(fmt, arg...) SLOGI(fmt, ##arg)
 #define WARN(fmt, arg...) SLOGW("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg)
 #define ERR(fmt, arg...) SLOGE("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg)
@@ -68,4 +67,4 @@
        } \
 } while (0)
 
-#endif // __PHN_COMMON_H__
+#endif /* __PHN_COMMON_H__ */
index bdac93eb43130ef17e07554ab32c32d04c708c95..89f5ea3be8d8d41c9f4bc7479c807f49c91b4b7e 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
@@ -61,19 +60,23 @@ struct phn_location_header {
 
 int phn_location_find_extra_data(const char *region_str, char **p_location_file)
 {
-       char *location_file = NULL;
        DIR *dirp = NULL;
+       struct dirent **dir_list;
+       char *location_file = NULL;
+
        dirp = opendir(PHN_LOCATION_DIR);
        if (NULL == dirp) {
                ERR("opendir() return NULL");
                return PHONE_NUMBER_ERROR_NO_DATA;
        }
-       struct dirent **dir_list;
+
        int count = scandir(PHN_LOCATION_DIR, &dir_list, 0, alphasort);
        if (count) {
                int idx = 0;
                char location_prefix[PHN_STR_SHORT_LEN] = {0};
-               snprintf(location_prefix, sizeof(location_prefix), "%s-%s", PHN_LOCATION_FILE_PREFIX, region_str);
+
+               snprintf(location_prefix, sizeof(location_prefix), "%s-%s",
+                               PHN_LOCATION_FILE_PREFIX, region_str);
                while (idx != count) {
                        const char *file_name = dir_list[idx]->d_name;
                        if (0 == strncmp(file_name, location_prefix, strlen(location_prefix))) {
@@ -89,6 +92,7 @@ int phn_location_find_extra_data(const char *region_str, char **p_location_file)
                *p_location_file = location_file;
                return PHONE_NUMBER_ERROR_NONE;
        }
+
        return PHONE_NUMBER_ERROR_NO_DATA;
 }
 
@@ -96,16 +100,19 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                phone_number_region_e region, phone_number_lang_e lang, char **p_location)
 {
        int ret = 0;
-       gchar* province_temp = NULL;
-       gchar* city_temp = NULL;
-       int province_str_len = 0;
        int city_str_len = 0;
-       const gunichar2 *province_str = NULL;
-       const gunichar2 *city_str = NULL;
+       int province_str_len = 0;
+       size_t read_size;
+       gchar *city_temp = NULL;
+       gchar *province_temp = NULL;
        const char *real_number = number;
+       const gunichar2 *city_str = NULL;
+       const gunichar2 *province_str = NULL;
+       char file_path[PHN_STR_SHORT_LEN] = {0};
 
-       // support region - CN, support lang - zh,en,ko
-       RETVM_IF(region != PHONE_NUMBER_REGION_CHINA, PHONE_NUMBER_ERROR_NOT_SUPPORTED, "Not supported region(%d)", region);
+       /* support region - CN, support lang - zh,en,ko */
+       RETVM_IF(region != PHONE_NUMBER_REGION_CHINA, PHONE_NUMBER_ERROR_NOT_SUPPORTED,
+                       "Not supported region(%d)", region);
 
        int lang_index = 0;
        switch (lang) {
@@ -123,17 +130,17 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                return PHONE_NUMBER_ERROR_NOT_SUPPORTED;
        }
 
-       while (real_number && real_number[0] == '0') {
+       while (real_number && real_number[0] == '0')
                real_number++;
-       }
-       RETVM_IF(NULL == real_number, PHONE_NUMBER_ERROR_INVALID_PARAMETER, "number=%s", number);
+       RETVM_IF(NULL == real_number, PHONE_NUMBER_ERROR_INVALID_PARAMETER, "number=%s",
+                       number);
 
-       char file_path[PHN_STR_SHORT_LEN] = {0};
        snprintf(file_path, sizeof(file_path), "%s/%s", PHN_LOCATION_DIR, file);
+
        int fd = open(file_path, O_RDONLY);
        RETVM_IF(fd < 0, PHONE_NUMBER_ERROR_NOT_SUPPORTED, "open() Fail(%d)", errno);
 
-       ret = lseek(fd, sizeof(int), SEEK_CUR); // start_mark
+       ret = lseek(fd, sizeof(int), SEEK_CUR); /* start_mark */
        if (ret <= 0) {
                ERR("lseek() Fail(%d)", errno);
                close(fd);
@@ -154,7 +161,7 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                gunichar2 name3[header.province_name_len[2]/2];
        };
 
-       #pragma pack(1)
+#pragma pack(1)
        struct phn_telephone_city_info {
                gint8 province_index;
                gunichar2 city1[header.telephone_city_len[0]/2];
@@ -163,7 +170,7 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                gint16 prefix;
        };
 
-       #pragma pack(1)
+#pragma pack(1)
        struct phn_mobile_city_info {
                gint8 province_index;
                gunichar2 city1[header.mobile_city_len[0]/2];
@@ -172,7 +179,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        };
 
        struct phn_province_info province_info[header.province_count];
-       ret = read(fd, &province_info, sizeof(struct phn_province_info)*header.province_count);
+       ret = read(fd, &province_info,
+                       sizeof(struct phn_province_info)*header.province_count);
        if (ret <= 0) {
                ERR("read() Fail(%d)", errno);
                close(fd);
@@ -180,7 +188,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        }
 
        struct phn_telephone_city_info telephone_city_info[header.telephone_city_count];
-       ret = read(fd, &telephone_city_info, sizeof(struct phn_telephone_city_info)*header.telephone_city_count);
+       ret = read(fd, &telephone_city_info,
+                       sizeof(struct phn_telephone_city_info)*header.telephone_city_count);
        if (ret <= 0) {
                ERR("read() Fail(%d)", errno);
                close(fd);
@@ -188,13 +197,14 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        }
 
        int i;
-       for (i=0;i<header.telephone_city_count;i++) {
+       for (i = 0; i < header.telephone_city_count; i++) {
+               gint8 provice_idx;
                gint16 prefix = telephone_city_info[i].prefix;
                char prefix_str[PHN_STR_SHORT_LEN] = {0};
-               snprintf(prefix_str, sizeof(prefix_str), "%u", prefix);
 
+               snprintf(prefix_str, sizeof(prefix_str), "%u", prefix);
                if (0 == strncmp(real_number, prefix_str, strlen(prefix_str))) {
-                       switch(lang_index) {
+                       switch (lang_index) {
                        case 0:
                                city_str = telephone_city_info[i].city1;
                                city_str_len = header.telephone_city_len[0]/2;
@@ -212,18 +222,19 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                break;
                        }
 
-                       if (0 < telephone_city_info[i].province_index && telephone_city_info[i].province_index <= header.province_count) {
-                               switch(lang_index) {
+                       provice_idx = telephone_city_info[i].province_index;
+                       if (0 < provice_idx && provice_idx <= header.province_count) {
+                               switch (lang_index) {
                                case 0:
-                                       province_str = province_info[telephone_city_info[i].province_index-1].name1;
+                                       province_str = province_info[provice_idx-1].name1;
                                        province_str_len = header.province_name_len[0]/2;
                                        break;
                                case 1:
-                                       province_str = province_info[telephone_city_info[i].province_index-1].name2;
+                                       province_str = province_info[provice_idx-1].name2;
                                        province_str_len = header.province_name_len[1]/2;
                                        break;
                                case 2:
-                                       province_str = province_info[telephone_city_info[i].province_index-1].name3;
+                                       province_str = province_info[provice_idx-1].name3;
                                        province_str_len = header.province_name_len[2]/2;
                                        break;
                                default:
@@ -232,7 +243,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                }
                        }
 
-                       province_temp = g_utf16_to_utf8(province_str, province_str_len, NULL, NULL, NULL);
+                       province_temp = g_utf16_to_utf8(province_str, province_str_len, NULL, NULL,
+                                       NULL);
                        city_temp = g_utf16_to_utf8(city_str, city_str_len, NULL, NULL, NULL);
 
                        if (city_temp && province_temp) {
@@ -240,8 +252,7 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                char *location = calloc(size+3, sizeof(char));
                                snprintf(location, size+3, "%s, %s", city_temp, province_temp);
                                *p_location = location;
-                       }
-                       else if (city_temp) {
+                       } else if (city_temp) {
                                int size = strlen(city_temp);
                                char *location = calloc(size+1, sizeof(char));
                                snprintf(location, size+1, "%s", city_temp);
@@ -260,14 +271,14 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        if (region != PHONE_NUMBER_REGION_CHINA) {
                ERR("Invalid region(%d)", region);
                return PHONE_NUMBER_ERROR_NO_DATA;
-       }
-       else if (strlen(number) < PHN_LOCATION_CHINA_MOBILE_NUMBER_MIN_LEN) {
+       } else if (strlen(number) < PHN_LOCATION_CHINA_MOBILE_NUMBER_MIN_LEN) {
                ERR("Invalid number(%s)", number);
                return PHONE_NUMBER_ERROR_INVALID_PARAMETER;
        }
 
        struct phn_mobile_city_info mobile_city_info[header.mobile_city_count];
-       ret = read(fd, &mobile_city_info, sizeof(struct phn_mobile_city_info)*header.mobile_city_count);
+       read_size = sizeof(struct phn_mobile_city_info)*header.mobile_city_count;
+       ret = read(fd, &mobile_city_info, read_size);
        if (ret <= 0) {
                ERR("read() Fail(%d)", errno);
                close(fd);
@@ -275,7 +286,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        }
 
        gint16 mobile_prefix_info[header.mobile_prefix_index_count];
-       ret = read(fd, &mobile_prefix_info, sizeof(gint16)*header.mobile_prefix_index_count);
+       read_size = sizeof(gint16)*header.mobile_prefix_index_count;
+       ret = read(fd, &mobile_prefix_info, read_size);
        if (ret <= 0) {
                ERR("read() Fail(%d)", errno);
                close(fd);
@@ -289,10 +301,11 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
        int num_prefix = atoi(num_prefix_str);
        int num_suffix = atoi(num_suffix_str);
 
-       for (i=0;i<header.mobile_prefix_index_count;i++) {
+       for (i = 0; i < header.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);
 
@@ -336,7 +349,8 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                }
                        }
 
-                       province_temp = g_utf16_to_utf8(province_str, province_str_len, NULL, NULL, NULL);
+                       province_temp = g_utf16_to_utf8(province_str, province_str_len, NULL, NULL,
+                                       NULL);
                        city_temp = g_utf16_to_utf8(city_str, city_str_len, NULL, NULL, NULL);
 
                        if (city_temp && province_temp) {
@@ -344,8 +358,7 @@ int phn_location_get_location_from_extra_data(const char *file, const char *numb
                                char *location = calloc(size+3, sizeof(char));
                                snprintf(location, size+3, "%s, %s", city_temp, province_temp);
                                *p_location = location;
-                       }
-                       else if (city_temp) {
+                       } else if (city_temp) {
                                int size = strlen(city_temp);
                                char *location = calloc(size+1, sizeof(char));
                                snprintf(location, size+1, "%s", city_temp);
index 6c97bba85e1fd795cbadf6d19fc6d28ba097bca1..1a7ae2b5d7b2c788c3c4b9eba345a1bd9a51edf0 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __PHN_LOCATION_H__
 #define __PHN_LOCATION_H__
 
@@ -26,4 +25,4 @@ int phn_location_find_extra_data(const char *region_str, char **p_location_file)
 int phn_location_get_location_from_extra_data(const char *file, const char *number,
                phone_number_region_e region, phone_number_lang_e lang, char **p_location);
 
-#endif
+#endif /* __PHN_LOCATION_H__ */
index 2ad6d84bbbdf41fe30bbbb47c773788f4044a793..2ebfece79047c36b1acff3ccc8d539319870ffc8 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
index 7cfe6b746c716b549d3c1a107f8dc09a38cc83a2..275905cf4adf12c33c07a648ebb17877f42aaa71 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __PHN_PHONENUMBER_WRAPPER_H__
 #define __PHN_PHONENUMBER_WRAPPER_H__
 
 extern "C" {
 #endif
 
-int phn_get_formatted_number(const char *number, const char *region, char **formatted_number);
-int phn_get_location_from_number(const char *number, const char *region, const char *language, char **location);
+int phn_get_formatted_number(const char *number, const char *region,
+               char **formatted_number);
+int phn_get_location_from_number(const char *number, const char *region,
+               const char *language, char **location);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif // __PHN_PHONENUMBER_WRAPPER_H__
\ No newline at end of file
+#endif /* __PHN_PHONENUMBER_WRAPPER_H__ */
index f0bea2cd30add6acffecef5b7151f3114cbdce3b..34fd94d385256a46e6a11752e9f29a155ee8fc60 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "phn_common.h"
 #include "phn_region_data.h"
 
@@ -282,10 +281,10 @@ const struct phn_region_info phn_region_info_table[] = {
 const char* phn_region_data_get_region_str(phone_number_region_e region)
 {
        int i;
-       for (i=0;i<sizeof(phn_region_info_table)/sizeof(struct phn_region_info);i++) {
-               if (phn_region_info_table[i].region == region) {
+
+       for (i = 0; i < sizeof(phn_region_info_table)/sizeof(struct phn_region_info); i++) {
+               if (phn_region_info_table[i].region == region)
                        return phn_region_info_table[i].region_str;
-               }
        }
        return NULL;
 }
@@ -293,23 +292,22 @@ const char* phn_region_data_get_region_str(phone_number_region_e region)
 const char* phn_region_data_get_lang_str(phone_number_lang_e lang)
 {
        int i;
-       for (i=0;i<sizeof(phn_lang_info_table)/sizeof(struct phn_lang_info);i++) {
-               if (phn_lang_info_table[i].lang == lang) {
+       for (i = 0; i < sizeof(phn_lang_info_table)/sizeof(struct phn_lang_info); i++) {
+               if (phn_lang_info_table[i].lang == lang)
                        return phn_lang_info_table[i].lang_str;
-               }
        }
        return NULL;
 }
 
-bool phn_region_data_find_match_info(phone_number_region_e region, phone_number_lang_e lang)
+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++) {
-               if (phn_match_info_table[i].region == region && phn_match_info_table[i].lang == lang)
+       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;
+               }
        }
        return false;
 }
-
-
-
index 11b0e2e586949978a78c792db2cc4e3caca9c580..ef5da04130202a52c4d39903ab172a56d79371fd 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __PHN_REGION_DATA_H__
 #define __PHN_REGION_DATA_H__
 
@@ -26,6 +25,7 @@
 
 const char* phn_region_data_get_region_str(phone_number_region_e region);
 const char* phn_region_data_get_lang_str(phone_number_lang_e lang);
-bool phn_region_data_find_match_info(phone_number_region_e region, phone_number_lang_e lang);
+bool phn_region_data_find_match_info(phone_number_region_e region,
+               phone_number_lang_e lang);
 
-#endif
+#endif /* __PHN_REGION_DATA_H__ */