output/raop: use "char*" for string buffers
Not unsigned char. Eliminate useless casts.
This commit is contained in:
parent
8e08407090
commit
47d936e9cc
@ -168,9 +168,9 @@ kd_lookup(struct key_data *kd, const char *key)
|
|||||||
{
|
{
|
||||||
while (kd) {
|
while (kd) {
|
||||||
g_debug("checking key %s %s\n", kd->key, key);
|
g_debug("checking key %s %s\n", kd->key, key);
|
||||||
if (!strcmp((char*)kd->key, key)) {
|
if (!strcmp(kd->key, key)) {
|
||||||
g_debug("found %s\n", kd->data);
|
g_debug("found %s\n", kd->data);
|
||||||
return (char*) kd->data;
|
return kd->data;
|
||||||
}
|
}
|
||||||
kd = kd->next;
|
kd = kd->next;
|
||||||
}
|
}
|
||||||
@ -599,7 +599,7 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd, const char *content_t
|
|||||||
for (j = 0; j < strlen(line); j++) if (line[j] != ' ') break;
|
for (j = 0; j < strlen(line); j++) if (line[j] != ' ') break;
|
||||||
dsize += strlen(line + j);
|
dsize += strlen(line + j);
|
||||||
if ((new_kd->data = realloc(new_kd->data, dsize))) return false;
|
if ((new_kd->data = realloc(new_kd->data, dsize))) return false;
|
||||||
strcat((char*)new_kd->data, line + j);
|
strcat(new_kd->data, line + j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dp = strstr(line, ":");
|
dp = strstr(line, ":");
|
||||||
@ -612,10 +612,10 @@ exec_request(struct rtspcl_data *rtspcld, const char *cmd, const char *content_t
|
|||||||
*dp = 0;
|
*dp = 0;
|
||||||
new_kd = malloc(sizeof(struct key_data));
|
new_kd = malloc(sizeof(struct key_data));
|
||||||
new_kd->key = malloc(strlen(line) + 1);
|
new_kd->key = malloc(strlen(line) + 1);
|
||||||
strcpy((char *) new_kd->key, line);
|
strcpy(new_kd->key, line);
|
||||||
dsize = strlen(dp + 1) + 1;
|
dsize = strlen(dp + 1) + 1;
|
||||||
new_kd->data = malloc(dsize);
|
new_kd->data = malloc(dsize);
|
||||||
strcpy((char*)new_kd->data, dp + 1);
|
strcpy(new_kd->data, dp + 1);
|
||||||
new_kd->next = NULL;
|
new_kd->next = NULL;
|
||||||
if (cur_kd == NULL) {
|
if (cur_kd == NULL) {
|
||||||
cur_kd = *kd = new_kd;
|
cur_kd = *kd = new_kd;
|
||||||
@ -675,8 +675,8 @@ rtspcl_add_exthds(struct rtspcl_data *rtspcld, const char *key, char *data)
|
|||||||
new_kd = (struct key_data *) malloc(sizeof(struct key_data));
|
new_kd = (struct key_data *) malloc(sizeof(struct key_data));
|
||||||
new_kd->key = malloc(strlen(key) + 1);
|
new_kd->key = malloc(strlen(key) + 1);
|
||||||
new_kd->data = malloc(strlen(data) + 1);
|
new_kd->data = malloc(strlen(data) + 1);
|
||||||
strcpy((char*)new_kd->key, key);
|
strcpy(new_kd->key, key);
|
||||||
strcpy((char*)new_kd->data, data);
|
strcpy(new_kd->data, data);
|
||||||
new_kd->next = NULL;
|
new_kd->next = NULL;
|
||||||
if (!rtspcld->exthds) {
|
if (!rtspcld->exthds) {
|
||||||
rtspcld->exthds = new_kd;
|
rtspcld->exthds = new_kd;
|
||||||
@ -725,8 +725,8 @@ rtspcl_setup(struct rtspcl_data *rtspcld, struct key_data **kd)
|
|||||||
buf = (char *) malloc(256);
|
buf = (char *) malloc(256);
|
||||||
sprintf(buf, "RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=%d;timing_port=%d", raop_session->ctrl.port, raop_session->ntp.port);
|
sprintf(buf, "RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=%d;timing_port=%d", raop_session->ctrl.port, raop_session->ntp.port);
|
||||||
|
|
||||||
hds.key = (unsigned char*) strdup("Transport");
|
hds.key = strdup("Transport");
|
||||||
hds.data = (unsigned char*) buf;
|
hds.data = buf;
|
||||||
hds.next = NULL;
|
hds.next = NULL;
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
if (!exec_request(rtspcld, "SETUP", NULL, NULL, 1, &hds, &rkd)) return false;
|
if (!exec_request(rtspcld, "SETUP", NULL, NULL, 1, &hds, &rkd)) return false;
|
||||||
@ -783,20 +783,20 @@ rtspcl_record(struct rtspcl_data *rtspcld)
|
|||||||
{
|
{
|
||||||
struct key_data *kdRange, *kdRtp;
|
struct key_data *kdRange, *kdRtp;
|
||||||
int rval;
|
int rval;
|
||||||
unsigned char *buf = (unsigned char *) malloc(128);
|
char *buf = (char *) malloc(128);
|
||||||
|
|
||||||
if (!rtspcld->session) {
|
if (!rtspcld->session) {
|
||||||
g_warning("%s: no session in progress\n", __func__);
|
g_warning("%s: no session in progress\n", __func__);
|
||||||
free(buf);
|
free(buf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sprintf((char *) buf, "seq=%d,rtptime=%u", raop_session->play_state.seq_num, raop_session->play_state.rtptime);
|
sprintf(buf, "seq=%d,rtptime=%u", raop_session->play_state.seq_num, raop_session->play_state.rtptime);
|
||||||
kdRange = malloc(sizeof(struct key_data));
|
kdRange = malloc(sizeof(struct key_data));
|
||||||
kdRtp = malloc(sizeof(struct key_data));
|
kdRtp = malloc(sizeof(struct key_data));
|
||||||
kdRange->key = (unsigned char*) strdup("Range");
|
kdRange->key = strdup("Range");
|
||||||
kdRange->data = (unsigned char*) strdup("npt=0-");
|
kdRange->data = strdup("npt=0-");
|
||||||
kdRange->next = kdRtp;
|
kdRange->next = kdRtp;
|
||||||
kdRtp->key = (unsigned char*) strdup("RTP-Info");
|
kdRtp->key = strdup("RTP-Info");
|
||||||
kdRtp->data = buf;
|
kdRtp->data = buf;
|
||||||
kdRtp->next = NULL;
|
kdRtp->next = NULL;
|
||||||
rval = exec_request(rtspcld, "RECORD", NULL, NULL, 1, kdRange, &rtspcld->kd);
|
rval = exec_request(rtspcld, "RECORD", NULL, NULL, 1, kdRange, &rtspcld->kd);
|
||||||
@ -1187,7 +1187,7 @@ raop_output_cancel(void *data)
|
|||||||
//flush
|
//flush
|
||||||
struct key_data kd;
|
struct key_data kd;
|
||||||
struct raop_data *rd = (struct raop_data *) data;
|
struct raop_data *rd = (struct raop_data *) data;
|
||||||
unsigned char *buf;
|
char *buf;
|
||||||
int flush_diff = 1;
|
int flush_diff = 1;
|
||||||
|
|
||||||
rd->started = 0;
|
rd->started = 0;
|
||||||
@ -1201,9 +1201,9 @@ raop_output_cancel(void *data)
|
|||||||
buf = malloc(128);
|
buf = malloc(128);
|
||||||
|
|
||||||
g_mutex_lock(rd->control_mutex);
|
g_mutex_lock(rd->control_mutex);
|
||||||
kd.key = (unsigned char *)strdup("RTP-Info");
|
kd.key = strdup("RTP-Info");
|
||||||
sprintf((char *) buf, "seq=%d; rtptime=%d", raop_session->play_state.seq_num + flush_diff, raop_session->play_state.rtptime + NUMSAMPLES * flush_diff);
|
sprintf(buf, "seq=%d; rtptime=%d", raop_session->play_state.seq_num + flush_diff, raop_session->play_state.rtptime + NUMSAMPLES * flush_diff);
|
||||||
kd.data = (unsigned char *)buf;
|
kd.data = buf;
|
||||||
kd.next = NULL;
|
kd.next = NULL;
|
||||||
exec_request(rd->rtspcl, "FLUSH", NULL, NULL, 1, &kd, &(rd->rtspcl->kd));
|
exec_request(rd->rtspcl, "FLUSH", NULL, NULL, 1, &kd, &(rd->rtspcl->kd));
|
||||||
free(kd.key);
|
free(kd.key);
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct key_data {
|
struct key_data {
|
||||||
unsigned char *key;
|
char *key;
|
||||||
unsigned char *data;
|
char *data;
|
||||||
struct key_data *next;
|
struct key_data *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user