=== modified file 'libamf/lcshm.cpp'
--- libamf/lcshm.cpp	2008-04-30 17:19:38 +0000
+++ libamf/lcshm.cpp	2008-11-24 03:26:43 +0000
@@ -20,7 +20,9 @@
 #include "gnashconfig.h"
 #endif
 
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <cerrno>
 #include <vector>
 #include <string>
@@ -422,8 +424,8 @@
         return false; 
     }
     
-    uint8_t* baseAddress = reinterpret_cast<uint8_t *>(Shm::getAddr());
-    uint8_t* tooFar = baseAddress+Shm::getSize();
+	boost::uint8_t* baseAddress = reinterpret_cast<boost::uint8_t *>(Shm::getAddr());
+	boost::uint8_t* tooFar = baseAddress+Shm::getSize();
     Listener::setBaseAddress(baseAddress);
     _baseaddr = baseAddress;
     parseHeader(baseAddress, tooFar);
@@ -450,8 +452,8 @@
         return false; 
     }
     
-    uint8_t* baseAddress = reinterpret_cast<uint8_t *>(Shm::getAddr());
-    uint8_t* tooFar = baseAddress+Shm::getSize();
+	boost::uint8_t* baseAddress = reinterpret_cast<boost::uint8_t *>(Shm::getAddr());
+	boost::uint8_t* tooFar = baseAddress+Shm::getSize();
     Listener::setBaseAddress(baseAddress);
     _baseaddr = baseAddress;
     parseHeader(baseAddress, tooFar);

=== modified file 'libamf/lcshm.h'
--- libamf/lcshm.h	2008-04-30 17:19:38 +0000
+++ libamf/lcshm.h	2008-11-19 05:22:53 +0000
@@ -56,11 +56,11 @@
 class DSOEXPORT LcShm : public Listener, public Shm {
 public:
     typedef struct {
-        uint32_t unknown1;
-        uint32_t unknown2;
-        uint32_t timestamp;	// number of milliseconds that have
+		boost::uint32_t unknown1;
+		boost::uint32_t unknown2;
+		boost::uint32_t timestamp;	// number of milliseconds that have
 				// elapsed since the system was started
-        uint32_t length;
+		boost::uint32_t length;
     } lc_header_t;
     typedef struct {
         std::string connection_name;

=== modified file 'libamf/sol.cpp'
--- libamf/sol.cpp	2008-09-10 12:47:39 +0000
+++ libamf/sol.cpp	2008-11-19 05:20:51 +0000
@@ -161,7 +161,7 @@
     // we just built it the same way it always is.
     // first is the TCSO, we have no idea what this stands for.
 //    ptr = reinterpret_cast<uint8_t *>(const_cast<uint8_t *>("TCSO");
-    ptr = (uint8_t *)"TCSO";
+	ptr = (boost::uint8_t *)"TCSO";
     for (i=0; i<sizeof(boost::uint32_t); i++) {
         _header.push_back(ptr[i]);
     }
@@ -294,7 +294,7 @@
     }
     
     _filesize = ptr - body.get();
-    int len = name.size() + sizeof(uint16_t) + 16;
+	int len = name.size() + sizeof(boost::uint16_t) + 16;
     boost::scoped_array<char> head ( new char[len + 4] );
     memset(head.get(), 0, len);
     ptr = head.get();

=== modified file 'libbase/BitsReader.h'
--- libbase/BitsReader.h	2008-06-10 16:08:03 +0000
+++ libbase/BitsReader.h	2008-11-17 00:20:55 +0000
@@ -110,9 +110,9 @@
 	}
 
 	/// Read one bytes as a signed int (aligned)
-	int8_t	read_s8()
+	boost::int8_t	read_s8()
 	{
-		return static_cast<int8_t>(read_u8());
+		return static_cast<boost::int8_t>(read_u8());
 	}
 
 	/// Read two bytes as an unsigned int (aligned)

=== modified file 'libbase/ClockTime.h'
--- libbase/ClockTime.h	2008-04-07 17:24:05 +0000
+++ libbase/ClockTime.h	2008-11-19 07:04:59 +0000
@@ -22,7 +22,11 @@
 
 #include <boost/cstdint.hpp>
 #include "dsodefs.h"
+#if defined(_MSC_VER)
+#include <time.h> // for struct timezone
+#else
 #include <sys/time.h> // for struct timezone
+#endif
 
 namespace clocktime
 {

=== modified file 'libbase/Range2d.h'
--- libbase/Range2d.h	2008-07-22 21:24:49 +0000
+++ libbase/Range2d.h	2008-11-22 02:26:18 +0000
@@ -31,6 +31,18 @@
 #include <iostream> // temporary include for debugging
 #include <cmath> // for floor / ceil
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 namespace gnash {
 
 namespace geometry {

=== modified file 'libbase/SimpleBuffer.h'
--- libbase/SimpleBuffer.h	2008-09-15 13:55:30 +0000
+++ libbase/SimpleBuffer.h	2008-11-22 02:26:18 +0000
@@ -30,6 +30,18 @@
 #include <algorithm> // for std::copy
 #include <boost/scoped_array.hpp>
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 
 namespace gnash {
 
@@ -148,7 +160,7 @@
 	///
 	void append(const void* inData, size_t size)
 	{
-		const boost::uint8_t* newData = reinterpret_cast<const uint8_t*>(inData);
+		const boost::uint8_t* newData = reinterpret_cast<const boost::uint8_t*>(inData);
 		size_t curSize = _size;
 		resize(curSize+size);
 		std::copy(newData, newData+size, _data.get()+curSize);

=== modified file 'libbase/getclocktime.hpp'
--- libbase/getclocktime.hpp	2008-03-30 17:24:31 +0000
+++ libbase/getclocktime.hpp	2008-11-22 01:44:49 +0000
@@ -27,14 +27,71 @@
 
 #ifndef HAVE_CLOCK_GETTIME
 
+#ifndef _MSC_VER
 #include <sys/time.h>
+#endif
 
 #ifdef _WIN32
 struct timespec {
 	time_t	tv_sec; 	/* seconds */
 	long	tv_nsec;	/* nanoseconds */
 };
-#endif
+
+#ifdef _MSC_VER
+
+#include <winsock2.h> // timeval
+/*!
+    A Windows gettimeofday implementation.
+	By Wu Yongwei at
+	http://sourceforge.net/projects/breve
+
+	gnash Win32 - modified to use _get_timezone instead of _timezone and _get_daylight instead of _daylight
+*/
+
+#define EPOCHFILETIME (116444736000000000i64)
+
+struct timezone {
+    int tz_minuteswest; /* minutes W of Greenwich */
+    int tz_dsttime;     /* type of dst correction */
+};
+
+static inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+    FILETIME        ft;
+    LARGE_INTEGER   li;
+    __int64         t;
+    static int      tzflag;
+	errno_t			ret = 0;
+
+    if (tv) {
+	GetSystemTimeAsFileTime(&ft);
+	li.LowPart  = ft.dwLowDateTime;
+	li.HighPart = ft.dwHighDateTime;
+	t  = li.QuadPart;       /* In 100-nanosecond intervals */
+	t -= EPOCHFILETIME;     /* Offset to the Epoch time */
+	t /= 10;                /* In microseconds */
+	tv->tv_sec  = (long)(t / 1000000);
+	tv->tv_usec = (long)(t % 1000000);
+    }
+
+    if (tz) {
+	if (!tzflag) {
+	    _tzset();
+	    tzflag++;
+	}
+
+	long secondswest;
+	ret = _get_timezone(&secondswest);
+	if(ret == 0) {
+		tz->tz_minuteswest = secondswest / 60;
+	    ret =  _get_daylight(&tz->tz_dsttime);
+	}
+    }
+
+    return ret;
+}
+#endif // _MSC_VER
+#endif // _WIN_32
 
 #define CLOCK_REALTIME 0 /* Dummy */
 

=== modified file 'libbase/log.cpp'
--- libbase/log.cpp	2008-09-12 16:20:20 +0000
+++ libbase/log.cpp	2008-11-22 01:31:06 +0000
@@ -31,13 +31,18 @@
 #include <string>
 #include <boost/format.hpp>
 
+// TODO MSVC does not need these to compile. Remove if not needed by MingW either
 #if defined(_WIN32) && defined(WIN32)
+#if !defined(_MSC_VER)
 // Required for SYSTEMTIME definitions
 # include <windows.h>
 # include <sys/types.h>
 #endif
+#endif
 
+#ifndef _MSC_VER
 #include <unistd.h> // for getpid
+#endif
 
 #include "log.h"
 #include "utility.h"
@@ -90,7 +95,7 @@
 	std::strftime (buf, sizeof(buf), "%H:%M:%S", std::localtime (&t));
 
 	std::stringstream ss;
-	ss << getpid() << ":" << get_thread_id() << "] " << buf;
+	ss << get_process_id() << ":" << get_thread_id() << "] " << buf;
 	return ss.str();
 
 }

=== modified file 'libbase/noseek_fd_adapter.cpp'
--- libbase/noseek_fd_adapter.cpp	2008-08-18 23:53:04 +0000
+++ libbase/noseek_fd_adapter.cpp	2008-11-24 03:26:43 +0000
@@ -28,8 +28,6 @@
 #include "utility.h"
 #include "log.h"
 
-#include <unistd.h> // for ::read
-
 #include <boost/scoped_array.hpp>
 
 //#define GNASH_NOSEEK_FD_VERBOSE 1
@@ -41,11 +39,11 @@
 #include <cstdio>
 #include <sys/types.h>
 #include <sys/stat.h>
-
-#if !defined(_WIN32) && !defined(WIN32)
-# include <unistd.h>
+#ifndef _MSC_VER
+#include <unistd.h> // for ::read
+#else
+#include <io.h> // for ::_read
 #endif
-
 #include <string>
 #include <boost/format.hpp>
 
@@ -221,7 +219,12 @@
 	std::cerr << boost::format(" bytes needed = %d") % bytesNeeded << std::endl;
 #endif
 
+#if defined(_MSC_VER)
+	size_t bytesRead = ::_read(_fd, (void*)_buf, bytesNeeded);
+#else
 		ssize_t bytesRead = ::read(_fd, (void*)_buf, bytesNeeded);
+#endif
+
 		if ( bytesRead < 0 )
 		{
 			std::cerr << boost::format(_("Error reading %d bytes from input stream")) % bytesNeeded;

=== modified file 'libbase/rc.cpp'
--- libbase/rc.cpp	2008-09-15 12:38:16 +0000
+++ libbase/rc.cpp	2008-11-20 01:23:43 +0000
@@ -32,7 +32,9 @@
 
 #include <boost/cstdint.hpp>
 #include <sys/types.h>
+#if !defined(_MSC_VER)
 #include <unistd.h> // for getuid()
+#endif
 #include <sys/stat.h>
 #include <limits>
 #include <cstdlib> // getenv
@@ -59,7 +61,6 @@
     return rcfile;
 }
 
-
 RcInitFile::RcInitFile()
         :
     _delay(0),

=== modified file 'libbase/sharedlib.cpp'
--- libbase/sharedlib.cpp	2008-07-30 08:55:45 +0000
+++ libbase/sharedlib.cpp	2008-11-19 01:32:10 +0000
@@ -26,7 +26,9 @@
 #include "sharedlib.h"
 
 #include <sys/stat.h>
-#include <unistd.h>
+#if !defined(_MSC_VER)
+#include <unistd.h> 
+#endif
 
 #include <string>
 #include <iostream>
@@ -41,10 +43,6 @@
 #endif
 #include <boost/thread/mutex.hpp>
 
-#if defined(_WIN32) || defined(WIN32)
-#	define PLUGINSDIR "./"
-#endif
-
 
 namespace gnash {
 

=== modified file 'libbase/shm.cpp'
--- libbase/shm.cpp	2008-09-12 21:18:45 +0000
+++ libbase/shm.cpp	2008-11-19 01:42:04 +0000
@@ -21,10 +21,12 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
+#if !defined(_MSC_VER)
+#include <unistd.h> 
+#endif
 #include <dirent.h>
 #include <fcntl.h>
-#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
+#if !defined(_MSC_VER) && !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
 #include <sys/mman.h>
 #include <sys/shm.h>
 #include <sys/ipc.h>
@@ -197,7 +199,7 @@
 #endif
 #endif	// USE_POSIX_SHM    
 
-#ifdef USE_SYSV_SHM
+#if defined(USE_SYSV_SHM) || defined(WIN32)
 # ifdef HAVE_SHMGET
     const int shmflg = 0660 | IPC_CREAT;
     // this is the magic size of shared memory segments used by the Flash player;
@@ -231,7 +233,7 @@
 # endif	 // end of HAVE_SHMGET
 #else
 #error "You need SYSV Shared memory support to use this option"
-#endif	 // end of USE_SYSV_SHM
+#endif	 // end of USE_SYSV_SHM or WIN32
 	{
     // If it already exists, then just attach to it.
 	exists = true;
@@ -241,7 +243,7 @@
 //	shm_unlink(filespec);
 	_shmfd = shm_open(filespec, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
 #else
-# ifdef USE_SYSV_SHM
+# if defined(USE_SYSV_SHM) || defined(WIN32)
 #  ifdef HAVE_SHMGET
 	// Get the shared memory id for this segment
 	_shmfd = shmget(_shmkey, _size, 0);

=== modified file 'libbase/shm.h'
--- libbase/shm.h	2008-03-06 05:22:49 +0000
+++ libbase/shm.h	2008-11-19 01:38:04 +0000
@@ -28,7 +28,7 @@
 #include "as_object.h" // for inheritance
 
 #include <sys/types.h>
-#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
+#if !defined(_MSC_VER) && !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
 # include <sys/ipc.h>
 # include <sys/shm.h>
 #elif !defined(__riscos__) && !defined(__OS2__)
@@ -88,7 +88,7 @@
     long        _alloced;
     size_t      _size;
     char        _filespec[MAX_SHM_NAME_SIZE];
-#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+#if !defined(_MSC_VER) && !defined(HAVE_WINSOCK_H) || defined(__OS2__)
     key_t	_shmkey;
 #else
     long	_shmkey;

=== modified file 'libbase/tu_file.cpp'
--- libbase/tu_file.cpp	2008-08-22 15:11:39 +0000
+++ libbase/tu_file.cpp	2008-11-17 04:23:38 +0000
@@ -20,7 +20,9 @@
 #include <cstdio>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
+#if !defined(_MSC_VER)
+#include <unistd.h> 
+#endif
 
 //
 // tu_file functions using FILE

=== modified file 'libbase/utility.h'
--- libbase/utility.h	2008-09-03 15:24:27 +0000
+++ libbase/utility.h	2008-11-24 04:33:55 +0000
@@ -29,6 +29,8 @@
 #include <typeinfo>
 #include <cmath>
 #include <boost/cstdint.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <algorithm> // std::min, std::max
 #include <limits>
 
@@ -48,7 +50,6 @@
 #endif // not NDEBUG
 #endif // _WIN32
 
-
 // Define this to enable fast float&double to uint32 conversion.
 // If the behaviour is undefined when overflow occurs with your 
 // compiler, disable this macro.
@@ -63,21 +64,26 @@
 // one. Make it as accurate as you like.
 static const double PI = 3.14159265358979323846;
 
+// The following template works just like its C counterpart, with added
+// type safety (i.e., they will only compile for floating point arguments).
+template <typename T>
+inline bool isNaN(const T& num, typename boost::enable_if<boost::is_floating_point<T> >::type* dummy = 0)
+{
+	dummy; 
+	return num != num;
+}
+
 // Commonly-used inlined mathematical functions are defined in
 // namespace gnash::utility so that it's clear where they
 // come from.
 namespace utility {
 
+
+#define isinf(x) (isNaN(x - x))
+
 inline bool isFinite(double d)
 {
-#if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
-    return (finite(d));
-#else
-    // Put using namespace std; here if you have to
-    // put it anywhere.
-    using namespace std;
-    return (isfinite(d));
-#endif
+	return !isinf(d);
 }
 
 inline double infinite_to_zero(double x)
@@ -188,7 +194,13 @@
 #else
 # ifdef _WIN32
 } // end namespace gnash
+#ifdef _MSC_VER
+extern "C" __declspec(dllimport) /* WINBASEAPI */ unsigned long int __stdcall /* DWORD WINAPI */ GetCurrentThreadId(void);
+extern "C" __declspec(dllimport) /* WINBASEAPI */ unsigned long int __stdcall /* DWORD WINAPI */ GetCurrentProcessId(void);
+#else
 extern "C" unsigned long int /* DWORD WINAPI */ GetCurrentThreadId(void);
+extern "C" unsigned long int /* DWORD WINAPI */ GetCurrentProcessId(void);
+#endif
 namespace gnash {
 # else
 /* getpid() */
@@ -218,6 +230,15 @@
 #endif
 }
 
+inline unsigned long int /* DWORD */ get_process_id(void)
+{
+#ifdef _WIN32 
+	return GetCurrentProcessId();
+#else
+	return static_cast<usigned long int>(getpid());
+#endif
+}
+
 } // namespace gnash
 
 // Handy macro to quiet compiler warnings about unused parameters/variables.

=== modified file 'libcore/PropertyList.cpp'
--- libcore/PropertyList.cpp	2008-09-24 10:32:01 +0000
+++ libcore/PropertyList.cpp	2008-11-26 03:21:47 +0000
@@ -228,7 +228,11 @@
 	string_table& st = VM::get().getStringTable();
 #endif
 
+#ifndef _MSC_VER
 	for (container::iterator it=_props.begin(), far=_props.end(); it != far; ++it)
+#else
+	for (container::iterator it=_props.begin(); it != _props.end(); ++it)
+#endif
 	{
 #ifdef GNASH_DEBUG_PROPERTY
 		as_prop_flags oldFlags = it->getFlags();

=== modified file 'libcore/SWFStream.cpp'
--- libcore/SWFStream.cpp	2008-10-02 16:12:12 +0000
+++ libcore/SWFStream.cpp	2008-11-26 03:11:10 +0000
@@ -28,6 +28,18 @@
 #include <cstring>
 #include <climits>
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 //#define USE_TU_FILE_BYTESWAPPING 1
 
 namespace gnash {
@@ -318,12 +330,12 @@
         throw ParserException(_("Unexpected end of stream while reading"));
     }
     
-    uint64_t low = buf[0];
+	boost::uint64_t low = buf[0];
     low |= buf[1] << 8;
     low |= buf[2] << 16;
     low |= buf[3] << 24;
 
-    uint64_t hi = buf[4];
+	boost::uint64_t hi = buf[4];
     hi |= buf[5] << 8;
     hi |= buf[6] << 16;
     hi |= buf[7] << 24;
@@ -338,7 +350,7 @@
     return m_input->read_byte();
 }
 
-int8_t    SWFStream::read_s8()
+boost::int8_t    SWFStream::read_s8()
 {
     // read_u8 will align
     return read_u8();

=== modified file 'libcore/SWFStream.h'
--- libcore/SWFStream.h	2008-10-02 16:12:12 +0000
+++ libcore/SWFStream.h	2008-11-26 02:19:00 +0000
@@ -159,7 +159,7 @@
 	//
 	/// aligned read
 	///
-	int8_t   read_s8();
+	boost::int8_t   read_s8();
 
 	/// Read a aligned unsigned 16-bit value from the stream.		
 	//

=== modified file 'libcore/array.cpp'
--- libcore/array.cpp	2008-09-24 15:46:11 +0000
+++ libcore/array.cpp	2008-11-26 03:07:19 +0000
@@ -862,8 +862,11 @@
         return true;
     }
 
-
+#ifndef _MSC_VER
     return as_object::as_object::set_member(name,val, nsname, ifFound);
+#else
+	return as_object::set_member(name,val, nsname, ifFound);
+#endif
 }
 
 Array_as*

=== modified file 'libcore/as_environment.h'
--- libcore/as_environment.h	2008-09-16 12:03:31 +0000
+++ libcore/as_environment.h	2008-11-24 04:06:51 +0000
@@ -31,6 +31,18 @@
 #include <vector>
 #include <iostream> // for dump_stack inline
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif // _MSC_VER
+
 namespace gnash {
 
 // Forward declarations

=== modified file 'libcore/as_value.h'
--- libcore/as_value.h	2008-09-18 11:59:44 +0000
+++ libcore/as_value.h	2008-11-17 05:49:32 +0000
@@ -37,7 +37,7 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/static_assert.hpp>
 
-#include "utility.h" // UNUSED
+#include "utility.h"
 #include "string_table.h"
 
 // Forward declarations
@@ -58,22 +58,9 @@
 
 namespace gnash {
 
-
 // NaN constant for use in as_value implementation
 static const double NaN = std::numeric_limits<double>::quiet_NaN();
 
-// The following template works just like its C counterpart, with added
-// type safety (i.e., they will only compile for floating point arguments).
-template <typename T>
-inline bool
-isNaN(const T& num, typename boost::enable_if<boost::is_floating_point<T> >::type* dummy = 0)
-{
-	UNUSED(dummy);
-	return num != num;
-}
-
-#define isinf(x) (isNaN(x - x))
-
 /// Use this methods to obtain a properly-formatted property name
 /// The methods will convert the name to lowercase if the current VM target
 /// is SWF6 or lower

=== modified file 'libcore/asobj/Date.cpp'
--- libcore/asobj/Date.cpp	2008-10-04 12:25:36 +0000
+++ libcore/asobj/Date.cpp	2008-11-24 04:34:47 +0000
@@ -360,7 +360,7 @@
                                    "Thu", "Fri", "Sat" };
   
     /// NaN and infinities all print as "Invalid Date"
-    if (isNaN(_value) || isinf(_value)) {
+	if (isNaN(_value) || isinf(_value)) {
         return as_value("Invalid Date");
     }
   
@@ -490,7 +490,7 @@
 inline
 bool invalidDate(double timeValue)
 {
-    return (isNaN(timeValue) || isinf(timeValue));
+	return (isNaN(timeValue) || isinf(timeValue));
 }
 
 /// Returns an element of the Date object as an as_value

=== modified file 'libcore/asobj/Global.cpp'
--- libcore/asobj/Global.cpp	2008-09-18 19:38:37 +0000
+++ libcore/asobj/Global.cpp	2008-11-24 04:38:27 +0000
@@ -527,10 +527,10 @@
     IF_VERBOSE_ASCODING_ERRORS(
     if (fn.nargs > 4)
             log_aserror(_("%s has more than four arguments"), __FUNCTION__);
-#if 0 // it is perfectly legal to have 4 args in SWF5 it seems..
-    if (version == 5 && fn.nargs == 4)
-            log_aserror(_("%s has four arguments in a SWF version 5 movie"), __FUNCTION__);
-#endif
+//#if 0 // it is perfectly legal to have 4 args in SWF5 it seems..
+//    if (version == 5 && fn.nargs == 4)
+//            log_aserror(_("%s has four arguments in a SWF version 5 movie"), __FUNCTION__);
+//#endif
     )
     
     // ASSetPropFlags(obj, props, n, allowFalse=false)

=== modified file 'libcore/asobj/LocalConnection.cpp'
--- libcore/asobj/LocalConnection.cpp	2008-09-01 09:14:19 +0000
+++ libcore/asobj/LocalConnection.cpp	2008-11-24 04:44:41 +0000
@@ -21,7 +21,9 @@
 #include "gnashconfig.h"
 #endif
 
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <cerrno>
 #include <cstring>
 #include <boost/cstdint.hpp> // for boost::?int??_t

=== modified file 'libcore/asobj/NetConnection.cpp'
--- libcore/asobj/NetConnection.cpp	2008-10-03 10:17:12 +0000
+++ libcore/asobj/NetConnection.cpp	2008-11-24 04:45:30 +0000
@@ -28,7 +28,7 @@
 
 // FIXME: Get rid of this crap.
 #if defined(HAVE_WINSOCK_H) && !defined(__OS2__)
-# include <winsock.h>
+# include <winsock2.h>
 #else
 #include <arpa/inet.h> // for htons
 #endif
@@ -345,7 +345,7 @@
 
 					// NOTE: this looks much like parsing of an OBJECT_AMF0
 					si = readNetworkShort(b); b += 2; // number of headers
-					uint8_t headers_ok = 1;
+					boost::uint8_t headers_ok = 1;
 					if(si != 0)
 					{
 #ifdef GNASH_DEBUG_REMOTING
@@ -673,7 +673,7 @@
 	}
 
 	// Set the "total size" parameter.
-	*(reinterpret_cast<uint32_t*>(buf->data() + total_size_offset)) = htonl(buf->size() - 4 - total_size_offset);
+	*(reinterpret_cast<boost::uint32_t*>(buf->data() + total_size_offset)) = htonl(buf->size() - 4 - total_size_offset);
 	
 
 #ifdef GNASH_DEBUG_REMOTING

=== modified file 'libcore/asobj/SharedObject.cpp'
--- libcore/asobj/SharedObject.cpp	2008-10-06 14:09:41 +0000
+++ libcore/asobj/SharedObject.cpp	2008-11-24 05:01:22 +0000
@@ -21,7 +21,9 @@
 #include "gnashconfig.h" // USE_SOL_READ_ONLY
 #endif
 
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <boost/tokenizer.hpp>
@@ -383,8 +385,20 @@
 #ifndef _WIN32
                 int ret = mkdir(newdir.c_str(), S_IRUSR|S_IWUSR|S_IXUSR);
 #else
+#ifdef _MSC_VER
+				int ret = CreateDirectory(newdir.c_str(), 0) != 0 ? 0 : -1;
+				if(ret==-1)
+				{
+					DWORD dwErr=GetLastError();
+					if(dwErr==ERROR_ALREADY_EXISTS)
+						errno=EEXIST;
+					else
+						errno=ENOENT; // probably as good as any other
+				}
+#else
                 int ret = mkdir(newdir.c_str());
 #endif
+#endif
                 if ((errno != EEXIST) && (ret != 0)) {
                     log_error(_("Couldn't create SOL files directory %s: %s"),
                               newdir, std::strerror(errno));
@@ -690,7 +704,7 @@
     }
 
     // fix length field
-    *(reinterpret_cast<uint32_t*>(buf.data() + 2)) = htonl(buf.size() - 6);
+	*(reinterpret_cast<boost::uint32_t*>(buf.data() + 2)) = htonl(buf.size() - 6);
     
     // TODO write file
     std::ofstream ofs(filespec.c_str(), std::ios::binary);

=== modified file 'libcore/asobj/XMLSocket_as.cpp'
--- libcore/asobj/XMLSocket_as.cpp	2008-10-02 07:40:03 +0000
+++ libcore/asobj/XMLSocket_as.cpp	2008-11-24 05:12:19 +0000
@@ -46,7 +46,9 @@
 #else
 # include <sys/types.h>
 # include <sys/stat.h>
+# ifndef _MSC_VER
 # include <unistd.h>
+# endif
 #endif
 
 #include <boost/scoped_array.hpp>

=== modified file 'libcore/asobj/xmlnode.cpp'
--- libcore/asobj/xmlnode.cpp	2008-09-29 08:40:24 +0000
+++ libcore/asobj/xmlnode.cpp	2008-11-24 05:03:43 +0000
@@ -34,7 +34,9 @@
 #include <vector>
 #include <algorithm>
 
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <libxml/xmlmemory.h>

=== modified file 'libcore/fill_style.cpp'
--- libcore/fill_style.cpp	2008-09-04 15:32:42 +0000
+++ libcore/fill_style.cpp	2008-11-26 03:16:06 +0000
@@ -141,11 +141,11 @@
         // GRADIENT
         in.ensureBytes(1);
 
-        uint8_t grad_props = in.read_u8();
+		boost::uint8_t grad_props = in.read_u8();
     
         if (tag_type == SWF::DEFINESHAPE4 ||
             tag_type == SWF::DEFINESHAPE4_) {
-            uint8_t spread_mode = grad_props >> 6;
+				boost::uint8_t spread_mode = grad_props >> 6;
             switch(spread_mode) {
                 case 0:
                     m_spread_mode = SWF::GRADIENT_SPREAD_PAD;
@@ -162,7 +162,7 @@
                 );
                 }
     
-            uint8_t interpolation = (grad_props >> 4) & 3;
+			boost::uint8_t interpolation = (grad_props >> 4) & 3;
             switch(interpolation) {
                 case 0: 
                     m_interpolation = SWF::GRADIENT_INTERPOL_NORMAL;
@@ -177,7 +177,7 @@
             }
         }
     
-        uint8_t num_gradients = grad_props & 0xF;
+		boost::uint8_t num_gradients = grad_props & 0xF;
         if ( ! num_gradients )
         {
             IF_VERBOSE_MALFORMED_SWF(

=== modified file 'libcore/matrix.cpp'
--- libcore/matrix.cpp	2008-10-08 09:27:25 +0000
+++ libcore/matrix.cpp	2008-11-26 03:33:40 +0000
@@ -313,7 +313,11 @@
 double
 matrix::get_rotation() const
 {
+#ifndef _MSC_VER
     return atan2(shx, sx); // more successes in misc-ming.all/matrix_test.c
+#else
+    return atan2((double)shx, sx); 
+#endif
 }
 
 // private

=== modified file 'libcore/movie_root.cpp'
--- libcore/movie_root.cpp	2008-09-25 17:00:18 +0000
+++ libcore/movie_root.cpp	2008-11-26 03:31:39 +0000
@@ -921,7 +921,12 @@
 
 		// Get current mouse coordinates
 		boost::int32_t x, y, buttons;
+#ifndef _MSC_VER
 		get_mouse_state(x, y, buttons);
+#else
+		int xi=x, yi=y, buttonsi=buttons;
+		get_mouse_state(xi, yi, buttonsi);
+#endif
 		point world_mouse(PIXELS_TO_TWIPS(x), PIXELS_TO_TWIPS(y));
 
 		boost::int32_t xoffset = world_mouse.x - world_origin.x;

=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- libcore/parser/SWFMovieDefinition.cpp	2008-10-06 12:30:58 +0000
+++ libcore/parser/SWFMovieDefinition.cpp	2008-11-26 02:20:44 +0000
@@ -49,8 +49,9 @@
 #include <memory>
 #include <string>
 #include <algorithm> // std::make_pair
+#ifndef _MSC_VER
 #include <unistd.h>
-
+#endif
 
 // Increment this when the cache data format changes.
 #define CACHE_FILE_VERSION 4

=== modified file 'libcore/parser/character_def.h'
--- libcore/parser/character_def.h	2008-07-09 07:33:34 +0000
+++ libcore/parser/character_def.h	2008-11-26 01:15:28 +0000
@@ -19,6 +19,7 @@
 #define GNASH_CHARACTER_DEF_H
 
 #include "resource.h" // for inheritance from resource class
+#include <boost/cstdint.hpp>
 
 // Forward declarations
 

=== modified file 'libcore/parser/video_stream_def.cpp'
--- libcore/parser/video_stream_def.cpp	2008-09-06 07:35:31 +0000
+++ libcore/parser/video_stream_def.cpp	2008-11-26 02:19:36 +0000
@@ -100,7 +100,7 @@
 
 	const unsigned int dataLength = in.get_tag_end_position() - in.tell();
 	
-	boost::uint8_t* buffer = new uint8_t[dataLength + 8]; // FIXME: catch bad_alloc
+	boost::uint8_t* buffer = new boost::uint8_t[dataLength + 8]; // FIXME: catch bad_alloc
 
 	const size_t bytesRead = in.read(reinterpret_cast<char*>(buffer), dataLength);
 

=== modified file 'libcore/rect.cpp'
--- libcore/rect.cpp	2008-08-18 23:53:04 +0000
+++ libcore/rect.cpp	2008-11-26 03:09:55 +0000
@@ -24,6 +24,18 @@
 
 #include <sstream> // for ::print and ::toString
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 namespace gnash {
 
 void    rect::read(SWFStream& in)

=== modified file 'libcore/rect.h'
--- libcore/rect.h	2008-10-02 11:07:22 +0000
+++ libcore/rect.h	2008-11-22 02:23:23 +0000
@@ -19,6 +19,10 @@
 #ifndef GNASH_RECT_H
 #define GNASH_RECT_H
 
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
 #include "dsodefs.h"
 #include "Range2d.h"
 #include "Point2d.h"
@@ -27,6 +31,19 @@
 #include <iostream> // for output operator
 #include <boost/cstdint.hpp>
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
+
 // Forward decl
 namespace gnash {
     class matrix;

=== modified file 'libcore/timers.h'
--- libcore/timers.h	2008-06-02 08:52:51 +0000
+++ libcore/timers.h	2008-11-24 05:12:19 +0000
@@ -29,6 +29,19 @@
 #include <vector> 
 #include <limits>
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
+
 // Forward declarations
 namespace gnash {
 	class fn_call;

=== modified file 'libcore/vm/ASHandlers.cpp'
--- libcore/vm/ASHandlers.cpp	2008-09-29 16:10:53 +0000
+++ libcore/vm/ASHandlers.cpp	2008-11-26 02:37:32 +0000
@@ -52,7 +52,11 @@
 #include "utf8.h"
 #include "StringPredicates.h" // StringNoCaseEqual
 
+#ifndef _MSC_VER
 #include <unistd.h>  // For write() on BSD
+#else
+#include <io.h> // for ::_write
+#endif
 #include <string>
 #include <vector>
 #include <locale>
@@ -2429,7 +2433,12 @@
         // TODO: should mutex-protect this ?
         // NOTE: we assuming the hostfd is set in blocking mode here..
         log_debug(_("Attempt to write geturl requests fd %d"), hostfd);
+
+#ifdef _MSC_VER
+		int ret = ::_write(hostfd, cmd, len);
+#else
         int ret = write(hostfd, cmd, len);
+#endif
         if ( ret == -1 )
         {
             log_error(_("Could not write to user-provided host requests "

=== modified file 'libcore/vm/CodeStream.h'
--- libcore/vm/CodeStream.h	2008-04-22 10:42:53 +0000
+++ libcore/vm/CodeStream.h	2008-11-24 04:12:59 +0000
@@ -178,11 +178,11 @@
 	}
 
 	/// Read a signed 8-bit character.
-	int8_t read_s8()
+	boost::int8_t read_s8()
 	{
 		if (mCurrent == mEnd)
 			throw CodeStreamException();
-		return static_cast<int8_t> (*mCurrent++);
+		return static_cast<boost::int8_t> (*mCurrent++);
 	}
 
 	/// Read an unsigned 8-bit character.

=== modified file 'libcore/vm/Machine.cpp'
--- libcore/vm/Machine.cpp	2008-09-19 10:24:02 +0000
+++ libcore/vm/Machine.cpp	2008-11-26 02:33:20 +0000
@@ -793,7 +793,7 @@
 ///  byte -- as a raw byte
 	case SWF::ABC_ACTION_PUSHBYTE:
 	{
-		int8_t b = mStream->read_s8();
+		boost::int8_t b = mStream->read_s8();
 		mStack.grow(1);
 		mStack.top(0) = b;
 		break;

=== modified file 'libmedia/AudioDecoderNellymoser.cpp'
--- libmedia/AudioDecoderNellymoser.cpp	2008-09-23 17:14:12 +0000
+++ libmedia/AudioDecoderNellymoser.cpp	2008-11-21 03:45:48 +0000
@@ -52,6 +52,10 @@
 #include <cmath>
 #include "VM.h"
 
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 0.707106781186547524401
+#endif /* !M_SQRT1_2 */
+
 namespace gnash {
 namespace media {
 

=== modified file 'libmedia/MediaParser.cpp'
--- libmedia/MediaParser.cpp	2008-10-06 10:18:38 +0000
+++ libmedia/MediaParser.cpp	2008-11-22 02:28:53 +0000
@@ -24,6 +24,18 @@
 #include <boost/bind.hpp>
 #include "GnashSleep.h" // for usleep.
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 // Define this to get debugging output from MediaParser
 //#define GNASH_DEBUG_MEDIAPARSER
 

=== modified file 'libmedia/ffmpeg/AudioDecoderFfmpeg.cpp'
--- libmedia/ffmpeg/AudioDecoderFfmpeg.cpp	2008-10-10 14:49:00 +0000
+++ libmedia/ffmpeg/AudioDecoderFfmpeg.cpp	2008-11-22 02:28:54 +0000
@@ -21,6 +21,18 @@
 #include "AudioDecoderFfmpeg.h"
 #include "MediaParserFfmpeg.h" // for ExtraAudioInfoFfmpeg
 
+#ifdef _MSC_VER
+// use std versions of min and max
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#endif //  _MSC_VER
+
 #include <cmath> // for std::ceil
 #include <algorithm> // for std::copy, std::max
 

=== modified file 'libmedia/gst/MediaParserGst.cpp'
--- libmedia/gst/MediaParserGst.cpp	2008-10-06 18:43:42 +0000
+++ libmedia/gst/MediaParserGst.cpp	2008-11-21 03:45:48 +0000
@@ -27,7 +27,9 @@
 #include "swfdec_codec_gst.h"
 #include <iostream>
 #include <fstream>
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 
 #define PUSHBUF_SIZE 1024
 #define MIN_PROBE_SIZE (PUSHBUF_SIZE * 3)

=== modified file 'libmedia/gst/VideoDecoderGst.cpp'
--- libmedia/gst/VideoDecoderGst.cpp	2008-10-07 19:32:41 +0000
+++ libmedia/gst/VideoDecoderGst.cpp	2008-11-21 03:57:28 +0000
@@ -124,7 +124,7 @@
     } else {
         buffer = gst_buffer_new();
 
-        GST_BUFFER_DATA(buffer) = const_cast<uint8_t*>(frame.data());
+		GST_BUFFER_DATA(buffer) = const_cast<boost::uint8_t*>(frame.data());
         GST_BUFFER_SIZE(buffer) = frame.dataSize();
         GST_BUFFER_OFFSET(buffer) = frame.frameNum();
         GST_BUFFER_TIMESTAMP(buffer) = GST_CLOCK_TIME_NONE;

=== modified file 'libnet/http.cpp'
--- libnet/http.cpp	2008-06-10 00:03:20 +0000
+++ libnet/http.cpp	2008-11-24 03:26:42 +0000
@@ -35,7 +35,14 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <algorithm>
+#ifndef _MSC_VER
 #include <unistd.h>
+#else
+//_S_IFMT and _S_IFDIR are ANSI  
+#ifndef S_ISDIR
+#define S_ISDIR(mode)   (((mode) & _S_IFMT) == _S_IFDIR)
+#endif
+#endif
 
 #include "amf.h"
 #include "http.h"

=== modified file 'libnet/statistics.h'
--- libnet/statistics.h	2008-03-29 03:13:12 +0000
+++ libnet/statistics.h	2008-11-22 00:32:39 +0000
@@ -19,7 +19,12 @@
 #ifndef __STATISTICS_H__
 #define __STATISTICS_H__
 
+#ifndef _MSC_VER
 #include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
 #include <network.h>
 #include <list>
 

