summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-06-26 12:44:31 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-06-26 12:44:31 +0000
commit0ed4f8572e1b32b4dd57304db14351f0e0c59119 (patch)
tree2155bd3cf49af3a003ca64b0af320d4e248a6563
parentbf73a154826860245f6af3f82c336c53e6286f20 (diff)
Fix handling of strings
-rw-r--r--src/sdp.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/sdp.c b/src/sdp.c
index abefca98..fd743b60 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -432,22 +432,6 @@ sdp_data_t *sdp_data_alloc_with_length(uint8_t dtd, const void *value, uint32_t
}
memcpy(d->val.str, value, length);
-
- if (length <= UCHAR_MAX) {
- d->unitSize += sizeof(uint8_t);
- if (dtd != SDP_URL_STR8 && dtd != SDP_TEXT_STR8) {
- if (dtd == SDP_URL_STR16)
- dtd = SDP_URL_STR8;
- else
- dtd = SDP_TEXT_STR8;
- }
- } else {
- d->unitSize += sizeof(uint16_t);
- if (dtd == SDP_TEXT_STR8)
- dtd = SDP_TEXT_STR16;
- else
- dtd = SDP_URL_STR16;
- }
} else {
SDPERR("Strings of size > USHRT_MAX not supported\n");
free(d);
@@ -742,10 +726,6 @@ int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
case SDP_TEXT_STR32:
src = (unsigned char *)d->val.str;
data_size = d->unitSize - sizeof(uint8_t);
- if (data_size - sizeof(uint8_t) <= UCHAR_MAX)
- data_size -= sizeof(uint8_t);
- else
- data_size -= sizeof(uint16_t);
sdp_set_seq_len(seqp, data_size);
break;
case SDP_URL_STR8:
@@ -973,7 +953,7 @@ static sdp_data_t *extract_str(const void *p, int *len)
SDPDBG("Str : %s\n", s);
d->val.str = s;
- d->unitSize = n;
+ d->unitSize = n + sizeof(uint8_t);
return d;
}