[rtmpdump] r265 - in trunk: hashswf.c rtmpsrv.c

hyc subversion at mplayerhq.hu
Sun Feb 21 05:47:23 CET 2010


Author: hyc
Date: Sun Feb 21 05:47:22 2010
New Revision: 265

Log:
Portability fixes

Modified:
   trunk/hashswf.c
   trunk/rtmpsrv.c

Modified: trunk/hashswf.c
==============================================================================
--- trunk/hashswf.c	Sun Feb 21 05:21:23 2010	(r264)
+++ trunk/hashswf.c	Sun Feb 21 05:47:22 2010	(r265)
@@ -260,6 +260,11 @@ leave:
   return ret;
 }
 
+static int tzoff;
+static int tzchecked;
+
+#define	JAN02_1980	318340800
+
 static const char *monthtab[12] = {"Jan", "Feb", "Mar",
 				"Apr", "May", "Jun",
 				"Jul", "Aug", "Sep",
@@ -321,12 +326,24 @@ make_unix_time(char *s)
 	    break;
 	}
     time.tm_isdst = 0;		/* daylight saving is never in effect in GMT */
+
+    /* this is normally the value of extern int timezone, but some
+     * braindead C libraries don't provide it.
+     */
+    if (!tzchecked)
+    {
+    	struct tm *tc;
+	time_t then = JAN02_1980;
+	tc = localtime(&then);
+	tzoff = (12 - tc->tm_hour) * 3600 + tc->tm_min * 60 + tc->tm_sec;
+	tzchecked = 1;
+    }
     res = mktime(&time);
     /* Unfortunately, mktime() assumes the input is in local time,
      * not GMT, so we have to correct it here.
      */
     if (res != -1)
-	res += timezone;
+	res += tzoff;
     return res;
 }
 

Modified: trunk/rtmpsrv.c
==============================================================================
--- trunk/rtmpsrv.c	Sun Feb 21 05:21:23 2010	(r264)
+++ trunk/rtmpsrv.c	Sun Feb 21 05:47:22 2010	(r265)
@@ -39,9 +39,12 @@
 #include "thread.h"
 
 #ifdef linux
+#include <linux/netfilter_ipv4.h>
+#endif
+
+#ifndef WIN32
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <linux/netfilter_ipv4.h>
 #endif
 
 #define RD_SUCCESS		0


More information about the rtmpdump mailing list