From ab68cd8e7ebeba3410bbdd1e4919ad875025766f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 26 May 2009 13:48:42 -0500 Subject: Create ofono_phone_number struct Creates a new structure in driver.h called ofono_phone_number. This is meant to replace const char *number, int number_type arguments everywhere. Fix up all existing code to use this structure instead. --- src/common.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/common.c') diff --git a/src/common.c b/src/common.c index 6fb7c642..86534320 100644 --- a/src/common.c +++ b/src/common.c @@ -362,30 +362,31 @@ int mmi_service_code_to_bearer_class(int code) return cls; } -const char *phone_number_to_string(const char *number, int type) +const char *phone_number_to_string(const struct ofono_phone_number *ph) { static char buffer[64]; - if (type == 145 && (strlen(number) > 0) && number[0] != '+') { + if (ph->type == 145 && (strlen(ph->number) > 0) && + ph->number[0] != '+') { buffer[0] = '+'; - strncpy(buffer + 1, number, 62); + strncpy(buffer + 1, ph->number, 62); buffer[63] = '\0'; } else { - strncpy(buffer, number, 63); + strncpy(buffer, ph->number, 63); buffer[63] = '\0'; } return buffer; } -void string_to_phone_number(const char *str, int *type, const char **number) +void string_to_phone_number(const char *str, struct ofono_phone_number *ph) { if (strlen(str) && str[0] == '+') { - *number = &str[1]; - *type = 145; /* International */ + strcpy(ph->number, str+1); + ph->type = 145; /* International */ } else { - *number = &str[0]; - *type = 129; /* Local */ + strcpy(ph->number, str); + ph->type = 129; /* Local */ } } -- cgit v1.2.3