[rtmpdump] Various minor fixes (mostly removing warnings) for rtmpdump
LRN
lrn1986 at gmail.com
Wed Mar 12 11:04:53 CET 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patches are attached.
- --
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
iQEcBAEBAgAGBQJTIDFEAAoJEOs4Jb6SI2CwZN4IANtH0BpmKeZYse5eE0A6rt4d
qEtG0Bbt6sVSDlp9ZJIifqRoZxyf6krouWiz2SmpWSdSfKDUsngUEPtpi9JXX/qb
jrtPqJq3g1Bhya+xCCurPFc4Tc6KX4hzTj5Dwhi/+VADSzJjZ2ay223Eo3XZlfC3
Jm6gvnOJy5idGB/Cz3jh/tmrxoqQwHKe+3Uto85iEVoMmq70gfNyzoLcopZ6CYa5
S2srkDyHIFxXYZ84a7sJkWEKUqDot9Kssih1+EsApJN7kCpUYHLiPwI/p4CQJ/V+
JQ0rjApRTzHuoynUsD6JAYxmbtfA8RhDUpmHufwoeLuxlmrpI56GX48CEYXV6HY=
=wqUk
-----END PGP SIGNATURE-----
-------------- next part --------------
From f6ed9c3650a57ddc8fc636574243a65d58d65267 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 09:59:25 +0000
Subject: [PATCH 1/6] Better, warningless W32 threading code
---
thread.c | 8 ++++++--
thread.h | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/thread.c b/thread.c
index 0913c98..9f62c84 100644
--- a/thread.c
+++ b/thread.c
@@ -30,10 +30,14 @@ HANDLE
ThreadCreate(thrfunc *routine, void *args)
{
HANDLE thd;
+ uintptr_t success;
- thd = (HANDLE) _beginthread(routine, 0, args);
- if (thd == -1L)
+ success = _beginthreadex(NULL, 0, routine, args, 0, (unsigned *)&thd);
+ if (!success)
+ {
RTMP_LogPrintf("%s, _beginthread failed with %d\n", __FUNCTION__, errno);
+ return INVALID_HANDLE_VALUE;
+ }
return thd;
}
diff --git a/thread.h b/thread.h
index e8deae6..ab6dd40 100644
--- a/thread.h
+++ b/thread.h
@@ -25,8 +25,8 @@
#ifdef WIN32
#include <windows.h>
#include <process.h>
-#define TFTYPE void
-#define TFRET()
+#define TFTYPE unsigned int __stdcall
+#define TFRET() return 0
#define THANDLE HANDLE
#else
#include <pthread.h>
--
1.8.4
-------------- next part --------------
From 8b21ca24145a56015c49020f42b62cb9b01b6486 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 10:00:11 +0000
Subject: [PATCH 2/6] Use gnu_printf format, because rtmp uses C99/GNU format
strings explicitly
---
librtmp/log.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/librtmp/log.h b/librtmp/log.h
index 2adb111..0e82d3f 100644
--- a/librtmp/log.h
+++ b/librtmp/log.h
@@ -49,9 +49,9 @@ typedef void (RTMP_LogCallback)(int level, const char *fmt, va_list);
void RTMP_LogSetCallback(RTMP_LogCallback *cb);
void RTMP_LogSetOutput(FILE *file);
#ifdef __GNUC__
-void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
-void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
-void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
+void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (gnu_printf, 1, 2)));
+void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (gnu_printf, 1, 2)));
+void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (gnu_printf, 2, 3)));
#else
void RTMP_LogPrintf(const char *format, ...);
void RTMP_LogStatus(const char *format, ...);
--
1.8.4
-------------- next part --------------
From 7cb69bf3a1f658be3c5ffb20b7a316f54b725391 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 10:00:48 +0000
Subject: [PATCH 3/6] Fix unused variable warnings
---
librtmp/handshake.h | 1 +
librtmp/rtmp.c | 2 --
rtmpsrv.c | 4 ++--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/librtmp/handshake.h b/librtmp/handshake.h
index 0438486..968575a 100644
--- a/librtmp/handshake.h
+++ b/librtmp/handshake.h
@@ -134,6 +134,7 @@ static void InitRC4Encryption
HMAC_setup(ctx, secretKey, 128);
HMAC_crunch(ctx, pubKeyOut, 128);
HMAC_finish(ctx, digest, digestLen);
+ (void) digestLen;
RTMP_Log(RTMP_LOGDEBUG, "RC4 In Key: ");
RTMP_LogHex(RTMP_LOGDEBUG, digest, 16);
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 6e788bb..7d42e63 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -3572,7 +3572,6 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
uint8_t hbuf[RTMP_MAX_HEADER_SIZE] = { 0 };
char *header = (char *)hbuf;
int nSize, hSize, nToRead, nChunk;
- int didAlloc = FALSE;
int extendedTimestamp;
RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket);
@@ -3700,7 +3699,6 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
return FALSE;
}
- didAlloc = TRUE;
packet->m_headerType = (hbuf[0] & 0xc0) >> 6;
}
diff --git a/rtmpsrv.c b/rtmpsrv.c
index a9e9045..add12fc 100644
--- a/rtmpsrv.c
+++ b/rtmpsrv.c
@@ -404,10 +404,10 @@ countAMF(AMFObject *obj, int *argc)
static char *
dumpAMF(AMFObject *obj, char *ptr, AVal *argv, int *argc)
{
- int i, len, ac = *argc;
+ int i, ac = *argc;
const char opt[] = "NBSO Z";
- for (i=0, len=0; i < obj->o_num; i++)
+ for (i=0; i < obj->o_num; i++)
{
AMFObjectProperty *p = &obj->o_props[i];
argv[ac].av_val = ptr+1;
--
1.8.4
-------------- next part --------------
From 4bf1495aaf6bfc672582130f4b014bfab6c28a06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 10:01:05 +0000
Subject: [PATCH 4/6] Don't use deprecated GNUTLS type
---
librtmp/rtmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 7d42e63..bd3b457 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -272,7 +272,7 @@ RTMP_TLS_AllocServerContext(const char* cert, const char* key)
return NULL;
}
#elif defined(USE_GNUTLS) && !defined(NO_SSL)
- gnutls_certificate_allocate_credentials((gnutls_certificate_credentials*) &ctx);
+ gnutls_certificate_allocate_credentials((gnutls_certificate_credentials_t *) &ctx);
if (gnutls_certificate_set_x509_key_file(ctx, cert, key, GNUTLS_X509_FMT_PEM) != 0) {
gnutls_certificate_free_credentials(ctx);
return NULL;
--
1.8.4
-------------- next part --------------
From bff27da8a1713dc7b420d4cdb4f7d82d1066b770 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 10:01:54 +0000
Subject: [PATCH 5/6] Appropriately cast data pointers passed to nettle
---
librtmp/hashswf.c | 2 +-
librtmp/rtmp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c
index 9f4e2c0..e7419ae 100644
--- a/librtmp/hashswf.c
+++ b/librtmp/hashswf.c
@@ -48,7 +48,7 @@
#endif
#undef HMAC_CTX
#define HMAC_CTX struct hmac_sha256_ctx
-#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, key)
+#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, (const uint8_t *) key)
#define HMAC_crunch(ctx, buf, len) hmac_sha256_update(&ctx, len, buf)
#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig)
#define HMAC_close(ctx)
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index bd3b457..5c9f444 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -2485,7 +2485,7 @@ b64enc(const unsigned char *input, int length, char *output, int maxsize)
#elif defined(USE_GNUTLS)
typedef struct md5_ctx MD5_CTX;
#define MD5_Init(ctx) md5_init(ctx)
-#define MD5_Update(ctx,data,len) md5_update(ctx,len,data)
+#define MD5_Update(ctx,data,len) md5_update(ctx,(unsigned) len,(const uint8_t *) data)
#define MD5_Final(dig,ctx) md5_digest(ctx,MD5_DIGEST_LENGTH,dig)
#else
#endif
--
1.8.4
-------------- next part --------------
From 2da423ea7384d508671d9acbe0734596d49d0c1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986 at gmail.com>
Date: Wed, 12 Mar 2014 10:02:59 +0000
Subject: [PATCH 6/6] Fix parallel installation (make sure LIBDIR is created
before anything is copied there)
---
librtmp/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/librtmp/Makefile b/librtmp/Makefile
index 2c1c790..76b67a2 100644
--- a/librtmp/Makefile
+++ b/librtmp/Makefile
@@ -114,7 +114,7 @@ install_base: librtmp.a librtmp.pc
cp librtmp.pc $(LIBDIR)/pkgconfig
cp librtmp.3 $(MANDIR)/man3
-install_so: librtmp$(SO_EXT)
+install_so: librtmp$(SO_EXT) install_base
cp librtmp$(SO_EXT) $(SODIR)
$(INSTALL_IMPLIB)
cd $(SODIR); ln -sf librtmp$(SO_EXT) librtmp.$(SOX)
--
1.8.4
More information about the rtmpdump
mailing list