Index: rrd.h
===================================================================
--- rrd.h	(revision 2086)
+++ rrd.h	(working copy)
@@ -57,6 +57,10 @@
 #ifndef WIN32
 #include <unistd.h>     /* for off_t */
 #else
+#ifdef _MSC_VER
+	typedef int mode_t;
+	#define strtoll _strtoi64 
+#endif
 	typedef size_t ssize_t;
 	typedef long off_t;
 #endif 
Index: rrd_graph.h
===================================================================
--- rrd_graph.h	(revision 2086)
+++ rrd_graph.h	(working copy)
@@ -7,7 +7,11 @@
 
 /* this may configure __EXTENSIONS__ without which pango will fail to compile
    so load this early */
+#ifdef HAVE_CONFIG_H
 #include "../rrd_config.h"
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include "../win32/config.h"
+#endif
 
 #include <cairo.h>
 #include <cairo-pdf.h>
Index: rrd_rpncalc.c
===================================================================
--- rrd_rpncalc.c	(revision 2086)
+++ rrd_rpncalc.c	(working copy)
@@ -77,7 +77,7 @@
         return NULL;
     }
     for (i = 0; rpnc[i].op != OP_END; ++i) {
-        rpnp[i].op = rpnc[i].op;
+        rpnp[i].op = (op_en)rpnc[i].op;
         if (rpnp[i].op == OP_NUMBER) {
             rpnp[i].val = (double) rpnc[i].val;
         } else if (rpnp[i].op == OP_VARIABLE || rpnp[i].op == OP_PREV_OTHER) {
Index: rrd_update.c
===================================================================
--- rrd_update.c	(revision 2086)
+++ rrd_update.c	(working copy)
@@ -1548,7 +1548,7 @@
             if (elapsed_pdp_st > 2) {
                 reset_cdp(rrd, elapsed_pdp_st, pdp_temp, last_seasonal_coef,
                           seasonal_coef, rra_idx, ds_idx, cdp_idx,
-                          current_cf);
+                          (cf_en)current_cf);
             }
         }
 
Index: rrd_utils.c
===================================================================
--- rrd_utils.c	(revision 2086)
+++ rrd_utils.c	(working copy)
@@ -25,19 +25,24 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <libgen.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _MSC_VER
+#include <libgen.h>
 #include <unistd.h>
-
+#endif
 #ifdef WIN32
 #	define random() rand()
 #	define srandom(x) srand(x)
 #	define getpid() 0
 #endif /* WIN32 */
 
+#ifndef S_ISDIR
+#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
+#endif
+
 /* make sure that the random number generator seeded EXACTLY ONCE */
 long rrd_random(void)
 {
@@ -171,7 +176,11 @@
     if (NULL == (pathname_copy = strdup(pathname)))
         return -1;
 
+#ifndef _MSC_VER
     base_dir = dirname(pathname_copy);
+#else
+	_splitpath(pathname_copy, NULL, base_dir, NULL, NULL);
+#endif
 
     if (0 != rrd_mkdir_p(base_dir, mode)) {
         int orig_errno = errno;
@@ -183,8 +192,13 @@
     free(pathname_copy);
 
     /* keep errno as set by mkdir() */
+#ifdef _MSC_VER
+	if (0 != mkdir(pathname))
+        return -1;
+#else
     if (0 != mkdir(pathname, mode))
         return -1;
+#endif
     return 0;
 } /* rrd_mkdir_p */
 
