use more correct const char * for things that should not be modified. This should also fix the switch_cpp.cpp changes from MODAPP-44. More patches to follow up on this for a few more modules that will likely break with this commit.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6120 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-11-01 11:28:26 +00:00
parent b416d80212
commit 622a2733dc
52 changed files with 254 additions and 246 deletions

View File

@@ -257,7 +257,7 @@ char *ldl_session_get_value(ldl_session_t *session, char *key)
return apr_hash_get(session->variables, key, APR_HASH_KEY_STRING);
}
void ldl_session_set_value(ldl_session_t *session, char *key, char *val)
void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val)
{
apr_hash_set(session->variables, apr_pstrdup(session->pool, key), APR_HASH_KEY_STRING, apr_pstrdup(session->pool, val));
}
@@ -1789,18 +1789,19 @@ void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id,
}
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body)
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body)
{
iks *msg;
char *t, *e;
char *bdup = NULL;
int on = 0;
int len = 0;
char *my_body = strdup(body);
assert(handle != NULL);
assert(body != NULL);
if (strchr(body, '<')) {
len = (int) strlen(body);
if (strchr(my_body, '<')) {
len = (int) strlen(my_body);
if (!(bdup = malloc(len))) {
return;
}
@@ -1808,7 +1809,7 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje
memset(bdup, 0, len);
e = bdup;
for(t = body; *t; t++) {
for(t = my_body; *t; t++) {
if (*t == '<') {
on = 1;
} else if (*t == '>') {
@@ -1820,10 +1821,10 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje
*e++ = *t;
}
}
body = bdup;
my_body = bdup;
}
msg = iks_make_msg(IKS_TYPE_NONE, to, body);
msg = iks_make_msg(IKS_TYPE_NONE, to, my_body);
iks_insert_attrib(msg, "type", "chat");
if (!from) {
@@ -1840,6 +1841,8 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subje
free(bdup);
}
free(my_body);
apr_queue_push(handle->queue, msg);
msg = NULL;

View File

@@ -309,7 +309,7 @@ char *ldl_session_get_value(ldl_session_t *session, char *key);
\param key the key to set
\param val the value of the key
*/
void ldl_session_set_value(ldl_session_t *session, char *key, char *val);
void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val);
/*!
\brief Create a Jingle Session
@@ -473,7 +473,7 @@ void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id,
\param subject optional subject
\param body body of the message
*/
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body);
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body);
/*!
\brief Offer candidates to a potential session