diff -burN libmms-0.6.original/src/mms.c libmms-0.6.modified/src/mms.c
|
|
--- libmms-0.6.original/src/mms.c 2010-05-31 12:13:04.000000000 +0200
|
|
+++ libmms-0.6.modified/src/mms.c 2012-06-25 12:44:06.000000000 +0200
|
|
@@ -40,7 +40,6 @@
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
-#include <iconv.h>
|
|
|
|
/********** logging **********/
|
|
#define lprintf(...) if (getenv("LIBMMS_DEBUG")) fprintf(stderr, __VA_ARGS__)
|
|
@@ -447,17 +446,21 @@
|
|
return 1;
|
|
}
|
|
|
|
-static int string_utf16(iconv_t url_conv, char *dest, char *src, int dest_len)
|
|
+static int string_utf16(char *dest, char *src, int dest_len)
|
|
{
|
|
char *ip = src, *op = dest;
|
|
size_t ip_len = strlen(src);
|
|
- size_t op_len = dest_len - 2; /* reserve 2 bytes for 0 termination */
|
|
|
|
- if (iconv(url_conv, &ip, &ip_len, &op, &op_len) == (size_t)-1) {
|
|
+ if (2 * ip_len + 2 > dest_len) {
|
|
lprintf("mms: Error converting uri to unicode: %s\n", strerror(errno));
|
|
return 0;
|
|
}
|
|
|
|
+ while (ip_len--) {
|
|
+ *op++ = *ip++;
|
|
+ *op++ = 0x00;
|
|
+ }
|
|
+
|
|
/* 0 terminate the string */
|
|
*op++ = 0;
|
|
*op++ = 0;
|
|
@@ -1012,7 +1015,6 @@
|
|
*/
|
|
/* FIXME: got somewhat broken during xine_stream_t->(void*) conversion */
|
|
mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth) {
|
|
- iconv_t url_conv = (iconv_t)-1;
|
|
mms_t *this;
|
|
int res;
|
|
uint32_t openid;
|
|
@@ -1071,12 +1073,6 @@
|
|
goto fail;
|
|
}
|
|
|
|
- url_conv = iconv_open("UTF-16LE", "UTF-8");
|
|
- if (url_conv == (iconv_t)-1) {
|
|
- lprintf("mms: could not get iconv handle to convert url to unicode\n");
|
|
- goto fail;
|
|
- }
|
|
-
|
|
/*
|
|
* let the negotiations begin...
|
|
*/
|
|
@@ -1088,7 +1084,7 @@
|
|
mms_gen_guid(this->guid);
|
|
sprintf(this->str, "NSPlayer/7.0.0.1956; {%s}; Host: %s", this->guid,
|
|
this->host);
|
|
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos, this->str,
|
|
+ res = string_utf16(this->scmd_body + command_buffer.pos, this->str,
|
|
CMD_BODY_LEN - command_buffer.pos);
|
|
if(!res)
|
|
goto fail;
|
|
@@ -1117,7 +1113,7 @@
|
|
mms_buffer_put_32 (&command_buffer, 0x00000000);
|
|
mms_buffer_put_32 (&command_buffer, 0x00989680);
|
|
mms_buffer_put_32 (&command_buffer, 0x00000002);
|
|
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
|
|
+ res = string_utf16(this->scmd_body + command_buffer.pos,
|
|
"\\\\192.168.0.129\\TCP\\1037",
|
|
CMD_BODY_LEN - command_buffer.pos);
|
|
if(!res)
|
|
@@ -1156,7 +1152,7 @@
|
|
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
|
|
mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
|
|
|
|
- res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
|
|
+ res = string_utf16(this->scmd_body + command_buffer.pos,
|
|
this->uri, CMD_BODY_LEN - command_buffer.pos);
|
|
if(!res)
|
|
goto fail;
|
|
@@ -1266,7 +1262,6 @@
|
|
}
|
|
}
|
|
|
|
- iconv_close(url_conv);
|
|
lprintf("mms: connect: passed\n");
|
|
|
|
return this;
|
|
@@ -1280,8 +1275,6 @@
|
|
gnet_uri_delete(this->guri);
|
|
if (this->uri)
|
|
free(this->uri);
|
|
- if (url_conv != (iconv_t)-1)
|
|
- iconv_close(url_conv);
|
|
|
|
free (this);
|
|
return NULL;
|