constification and code simplifications

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-04-14 22:02:19 +00:00
parent 1029b57707
commit 62712ea668
3 changed files with 36 additions and 59 deletions

View File

@@ -428,7 +428,7 @@ int adsi_transmit_message(struct ast_channel *chan, unsigned char *msg, int msgl
return adsi_transmit_message_full(chan, msg, msglen, msgtype, 1);
}
static inline int ccopy(unsigned char *dst, unsigned char *src, int max)
static inline int ccopy(unsigned char *dst, const unsigned char *src, int max)
{
int x=0;
/* Carefully copy the requested data */
@@ -439,7 +439,7 @@ static inline int ccopy(unsigned char *dst, unsigned char *src, int max)
return x;
}
int adsi_load_soft_key(unsigned char *buf, int key, char *llabel, char *slabel, char *ret, int data)
int adsi_load_soft_key(unsigned char *buf, int key, const char *llabel, const char *slabel, const char *ret, int data)
{
int bytes=0;
@@ -453,13 +453,13 @@ int adsi_load_soft_key(unsigned char *buf, int key, char *llabel, char *slabel,
buf[bytes++] = key;
/* Carefully copy long label */
bytes += ccopy(buf + bytes, (unsigned char *)llabel, 18);
bytes += ccopy(buf + bytes, (const unsigned char *)llabel, 18);
/* Place delimiter */
buf[bytes++] = 0xff;
/* Short label */
bytes += ccopy(buf + bytes, (unsigned char *)slabel, 7);
bytes += ccopy(buf + bytes, (const unsigned char *)slabel, 7);
/* If specified, copy return string */
@@ -469,7 +469,7 @@ int adsi_load_soft_key(unsigned char *buf, int key, char *llabel, char *slabel,
if (data)
buf[bytes++] = ADSI_SWITCH_TO_DATA2;
/* Carefully copy return string */
bytes += ccopy(buf + bytes, (unsigned char *)ret, 20);
bytes += ccopy(buf + bytes, (const unsigned char *)ret, 20);
}
/* Replace parameter length */