projects
/
lcr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixup
[lcr.git]
/
callerid.c
diff --git
a/callerid.c
b/callerid.c
index
b9e59ab
..
2f12ac1
100644
(file)
--- a/
callerid.c
+++ b/
callerid.c
@@
-20,13
+20,11
@@
*/
const char *nationalize_callerinfo(const char *string, int *ntype, const char *national, const char *international)
{
*/
const char *nationalize_callerinfo(const char *string, int *ntype, const char *national, const char *international)
{
- if (!strncmp(international, string, strlen(international)))
- {
+ if (!strncmp(international, string, strlen(international))) {
*ntype = INFO_NTYPE_INTERNATIONAL;
return(string+strlen(international));
}
*ntype = INFO_NTYPE_INTERNATIONAL;
return(string+strlen(international));
}
- if (!strncmp(national, string, strlen(national)))
- {
+ if (!strncmp(national, string, strlen(national))) {
*ntype = INFO_NTYPE_NATIONAL;
return(string+strlen(national));
}
*ntype = INFO_NTYPE_NATIONAL;
return(string+strlen(national));
}
@@
-41,24
+39,28
@@
const char *numberrize_callerinfo(const char *string, int ntype, const char *nat
{
static char result[256];
{
static char result[256];
- switch(ntype)
- {
+ switch(ntype) {
+ case INFO_NTYPE_NOTPRESENT:
+ return("");
+
case INFO_NTYPE_INTERNATIONAL:
strcpy(result, international);
case INFO_NTYPE_INTERNATIONAL:
strcpy(result, international);
- strncat(result, string, sizeof(result));
+ strncat(result, string, sizeof(result)
-1
);
result[sizeof(result)-1] = '\0';
return(result);
break;
case INFO_NTYPE_NATIONAL:
strcpy(result, national);
result[sizeof(result)-1] = '\0';
return(result);
break;
case INFO_NTYPE_NATIONAL:
strcpy(result, national);
- strncat(result, string, sizeof(result));
+ strncat(result, string, sizeof(result)
-1
);
result[sizeof(result)-1] = '\0';
return(result);
break;
default:
result[sizeof(result)-1] = '\0';
return(result);
break;
default:
- return(string);
+ strncpy(result, string, sizeof(result)-1);
+ result[sizeof(result)-1] = '\0';
+ return(result);
}
}
}
}