return ret;
}
-static void __msg_common_get_self_number(char **self_ph_num) {
+static void __msg_common_get_self_number(char **self_ph_num)
+{
telephony_handle_list_s tel_handle_list;
- int err = telephony_init(&tel_handle_list);
- if (err == TELEPHONY_ERROR_NONE) {
+ if (telephony_init(&tel_handle_list) == TELEPHONY_ERROR_NONE) {
if (tel_handle_list.count > 0) {
telephony_h tel_handle = tel_handle_list.handle[0];
- err = telephony_sim_get_subscriber_number(tel_handle, self_ph_num);
+ int err = telephony_sim_get_subscriber_number (tel_handle, self_ph_num);
- if (err != TELEPHONY_ERROR_NONE) {
+ if (err != TELEPHONY_ERROR_NONE)
+ {
if (*self_ph_num) {
free(*self_ph_num);
}
+
D_EMSG("Cannot get self phone number, err = %d", err);
+ } else if (*self_ph_num[0] == 0) {
+ D_IMSG("Provider doesn't support self number.");
+
+ if (*self_ph_num) {
+ free(*self_ph_num);
+ }
+
+ const char *unkn_str = dgettext(MESSAGE_PKGNAME, "IDS_MSGF_BODY_UNKNOWN");
+ *self_ph_num = calloc(strlen(unkn_str), sizeof(char));
+ strcpy(*self_ph_num, unkn_str);
}
} else {
- err = TELEPHONY_ERROR_SIM_NOT_AVAILABLE;
D_EMSG("Any SIM unavailable.");
}
- telephony_deinit(&tel_handle_list);
- }
-
- if (err != TELEPHONY_ERROR_NONE || *self_ph_num[0] == 0) {
- D_IMSG("Provider doesn't support self number.");
-
- if (*self_ph_num) {
- free(*self_ph_num);
- }
- const char *unkn_str = dgettext(MESSAGE_PKGNAME, "IDS_MSGF_BODY_UNKNOWN");
- *self_ph_num = calloc(strlen(unkn_str) + 1, sizeof(char));
- if (*self_ph_num) {
- strncpy(*self_ph_num, unkn_str, strlen(unkn_str) + 1);
- }
+ telephony_deinit(&tel_handle_list);
+ } else {
+ D_EMSG("telephony_init is failed.");
}
}