aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-06-13 10:51:22 +0300
committerMartin Storsjö <martin@martin.st>2012-06-13 11:36:47 +0300
commit053386864219eccbcca1886c55f902f9555428a5 (patch)
tree8e9027809958897601389cde4607c43da41ed2e4
parentaf10feadc23de2c9c876d4cd86abf3d75813cef1 (diff)
downloadffmpeg-053386864219eccbcca1886c55f902f9555428a5.tar.gz
rtmp: Tokenize the AMF connection parameters manually instead of using strtok_r
This fixes builds on platforms without strtok_r (windows). Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/rtmpproto.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 56011f1cde..2b15d80846 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -115,7 +115,7 @@ static const uint8_t rtmp_server_key[] = {
static int rtmp_write_amf_data(URLContext *s, char *param, uint8_t **p)
{
- char *field, *value, *saveptr;
+ char *field, *value;
char type;
/* The type must be B for Boolean, N for number, S for string, O for
@@ -130,8 +130,12 @@ static int rtmp_write_amf_data(URLContext *s, char *param, uint8_t **p)
value = param + 2;
} else if (param[0] == 'N' && param[1] && param[2] == ':') {
type = param[1];
- field = strtok_r(param + 3, ":", &saveptr);
- value = strtok_r(NULL, ":", &saveptr);
+ field = param + 3;
+ value = strchr(field, ':');
+ if (!value)
+ goto fail;
+ *value = '\0';
+ value++;
if (!field || !value)
goto fail;
@@ -226,18 +230,27 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
ff_amf_write_object_end(&p);
if (rt->conn) {
- char *param, *saveptr;
+ char *param = rt->conn;
// Write arbitrary AMF data to the Connect message.
- param = strtok_r(rt->conn, " ", &saveptr);
while (param != NULL) {
+ char *sep;
+ param += strspn(param, " ");
+ if (!*param)
+ break;
+ sep = strchr(param, ' ');
+ if (sep)
+ *sep = '\0';
if ((ret = rtmp_write_amf_data(s, param, &p)) < 0) {
// Invalid AMF parameter.
ff_rtmp_packet_destroy(&pkt);
return ret;
}
- param = strtok_r(NULL, " ", &saveptr);
+ if (sep)
+ param = sep + 1;
+ else
+ break;
}
}