]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix further build errors under Windows, updates (#828)
authorWolfgang Stöggl <c72578@yahoo.de>
Tue, 3 Oct 2017 10:03:53 +0000 (12:03 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 3 Oct 2017 10:03:53 +0000 (12:03 +0200)
* Update WIN32-BUILD-TIPS.txt

- Modified links to newer versions of libraries
- Added links for pcre

* Update librrd-4.def

- rrd_flushall -> rrdc_flushall
- Added further exports
- Sorted alphabetically

* Update librrd-4.vcxproj

- Changed CompileAsCpp to CompileAsC
- Updated PlatformToolset from v120 to v140
- Added gthread-2.0.lib;pcre.lib to AdditionalDependencies
- Removed strftime=strftime_ from PreprocessorDefinitions
- Added /FORCE:MULTIPLE to AdditionalOptions for now
  Fixes win32comp.obj :
  error LNK2005: _localtime_r, _gmtime_r, _ctime_r, _strtok_r
  already defined in rrd_thread_safe_nt.obj
- Removed rrd_getopt.c and rrd_getopt1.c, added optparse.c
- Added further .c files to ClCompile, sorted alphabetically
- Removed rrd_getopt.h
- Added further .h files to ClInclude, sorted alphabetically

* Update rrdtool.vcxproj

- Updated PlatformToolset from v120 to v140
- Added intl.dll and pcre3.dll to copy PostBuildEvent

* Update rrdupdate.vcxproj

- Updated PlatformToolset from v120 to v140
- Added intl.dll and pcre3.dll to copy PostBuildEvent
- Added . to AdditionalIncludeDirectories for Debug|Win32

* Include win32-glob.h, dirent.h, asprintf.h (MSC)

- Fixes compilation errors, when building under Windows (e.g. VS2015):
  ..\src\rrd_list.c(4): fatal error C1083: Cannot open include file:
    'glob.h': No such file or directory
  ..\src\rrd_list.c(9): fatal error C1083: Cannot open include file:
    'dirent.h': No such file or directory
  librrd-4.lib(rrd_list.obj) : error LNK2001:
    unresolved external symbol _asprintf
- Added includes for Windows builds (MSC):
  "win32-glob.h" from https://sourceforge.net/projects/sox/
  "dirent.h"     from https://github.com/tronkko/dirent
  "asprintf.h"   from http://asprintf.insanecoding.org

* Add files required to build rrd_list.c (MSC)

The following files are added to the win32 directory
for building under Windows (e.g. VS2015):
- asprintf.c, asprintf.h, vasprintf-msvc.c
  from http://asprintf.insanecoding.org
- dirent.h
  from https://github.com/tronkko/dirent
- win32-glob.c, win32-glob.h
  from https://sourceforge.net/projects/sox/

* Remove spurious executable permission from README

13 files changed:
WIN32-BUILD-TIPS.txt
src/rrd_list.c
win32/README [changed mode: 0755->0644]
win32/asprintf.c [new file with mode: 0644]
win32/asprintf.h [new file with mode: 0644]
win32/dirent.h [new file with mode: 0644]
win32/librrd-4.def
win32/librrd-4.vcxproj
win32/rrdtool.vcxproj
win32/rrdupdate.vcxproj
win32/vasprintf-msvc.c [new file with mode: 0644]
win32/win32-glob.c [new file with mode: 0644]
win32/win32-glob.h [new file with mode: 0644]

index 29b2cb9b669990c3e3d74c62008965facc9a26d9..b4ef50e51e52d872e038c3364d50c7e1ee34cd39 100644 (file)
@@ -1,38 +1,42 @@
 Compiling RRDtool on Win32 with Microsoft Visual C++:
 ---------------------------------------------------------------
+2017-10-02 Wolfgang Stöggl c72578@yahoo.de
 2010-06-04 Chris Larsen clarsen@euphoriaaudio.com
 2008-03-12 Stefan Ludewig stefan.ludewig@exitgames.com
 
 Here are step by step instructions for building librrd-4.dll and rrdtool.exe
-version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x).
+version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x) and newer.
 
 (1) Create a folder named "contrib" in the directory where this text file is located.
 
-(2) Download the following libraries that rrdtool depends on into this folder:
+(2) Download the following libraries that rrdtool depends on:
 
-    - cairo:    http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.8.10-3_win32.zip 
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo-dev_1.8.10-3_win32.zip
+    - cairo:    http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.10.2-2_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo-dev_1.10.2-2_win32.zip
 
-    - glib:     http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.24/glib_2.24.1-1_win32.zip
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.24/glib-dev_2.24.1-1_win32.zip
+    - glib:     http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip
 
-    - libpng:   http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.4.0-1_win32.zip
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng-dev_1.4.0-1_win32.zip
+    - libpng:   http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.4.12-1_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng-dev_1.4.12-1_win32.zip
 
-    - libxml2:  http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2_2.7.7-1_win32.zip
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2-dev_2.7.7-1_win32.zip
+    - libxml2:  http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2-dev_2.9.0-1_win32.zip
 
-    - pango:    http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.28/pango_1.28.0-1_win32.zip
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.28/pango-dev_1.28.0-1_win32.zip
+    - pango:    http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.29/pango_1.29.4-1_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.29/pango-dev_1.29.4-1_win32.zip
 
-    - zlib:     http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib_1.2.4-2_win32.zip
-      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib-dev_1.2.4-2_win32.zip
+    - zlib:     http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib_1.2.5-2_win32.zip
+      and       http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib-dev_1.2.5-2_win32.zip
       
     - fontconfig:  http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig_2.8.0-2_win32.zip
     
-    - freetype: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.3.12-1_win32.zip
+    - freetype: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.4.10-1_win32.zip
     
-    - expat:    http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.0.1-1_win32.zip
+    - expat:    http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.1.0-1_win32.zip
+
+    - pcre:     https://downloads.sourceforge.net/project/gnuwin32/pcre/7.0/pcre-7.0-bin.zip
+                https://downloads.sourceforge.net/project/gnuwin32/pcre/7.0/pcre-7.0-lib.zip
 
 (3) Extract all of the .zip files into the contrib folder. Do not extract each library into it's own
     directory. We want all of the files merged into a structure consisting of "bin, include, lib..."
@@ -41,7 +45,7 @@ version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x).
 (4) Open the Visual Studio 2013 Solution "rrd.sln" in the win32 folder of
     your rrdtool-folder and build either the project librrd-4 (for the
     rrdtool-library), rrdtool (for the rrdtool-executable depending on the
-    libraray) or the complete solution. A post-build event automatically copies
+    library) or the complete solution. A post-build event automatically copies
     all the dlls, needed by rrdtool, next to the .exe, when you build the
     executable. These DLLs must be available on all hosts where rrdtool will
     run.
index 5d7f41ea96cf84669ea080212893c659356ca77e..3348e1e82de3accb5a2ad8b5c4c702dcb93541c6 100644 (file)
@@ -1,8 +1,14 @@
 
 #include <stdio.h>
 #include <string.h>
+#ifdef _MSC_VER
+#include "win32-glob.h"    /* from https://sourceforge.net/projects/sox/ */
+#include "dirent.h"        /* from https://github.com/tronkko/dirent */
+#include "asprintf.h"      /* from http://asprintf.insanecoding.org */
+#else
 #include <glob.h>
 #include <dirent.h>
+#endif
 #include <sys/types.h>
 
 #include "rrd_tool.h"
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/win32/asprintf.c b/win32/asprintf.c
new file mode 100644 (file)
index 0000000..bb6fe93
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+Copyright (C) 2014 insane coder (http://insanecoding.blogspot.com/, http://asprintf.insanecoding.org/)
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include "asprintf.h"
+
+int asprintf(char **strp, const char *fmt, ...)
+{
+  int r;
+  va_list ap;
+  va_start(ap, fmt);
+  r = vasprintf(strp, fmt, ap);
+  va_end(ap);
+  return(r);
+}
diff --git a/win32/asprintf.h b/win32/asprintf.h
new file mode 100644 (file)
index 0000000..577a638
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+Copyright (C) 2014 insane coder (http://insanecoding.blogspot.com/, http://asprintf.insanecoding.org/)
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#ifndef INSANE_ASPRINTF_H
+#define INSANE_ASPRINTF_H
+
+#ifndef __cplusplus
+#include <stdarg.h>
+#else
+#include <cstdarg>
+extern "C"
+{
+#endif
+
+#define insane_free(ptr) { free(ptr); ptr = 0; }
+
+int vasprintf(char **strp, const char *fmt, va_list ap);
+int asprintf(char **strp, const char *fmt, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/win32/dirent.h b/win32/dirent.h
new file mode 100644 (file)
index 0000000..a0e0ccb
--- /dev/null
@@ -0,0 +1,1159 @@
+/*
+ * Dirent interface for Microsoft Visual Studio
+ * Version 1.23.1
+ *
+ * Copyright (C) 2006-2012 Toni Ronkko
+ * This file is part of dirent.  Dirent may be freely distributed
+ * under the MIT license.  For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#ifndef DIRENT_H
+#define DIRENT_H
+
+/*
+ * Include windows.h without Windows Sockets 1.1 to prevent conflicts with
+ * Windows Sockets 2.0.
+ */
+#ifndef WIN32_LEAN_AND_MEAN
+#   define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <wchar.h>
+#include <string.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+/* Indicates that d_type field is available in dirent structure */
+#define _DIRENT_HAVE_D_TYPE
+
+/* Indicates that d_namlen field is available in dirent structure */
+#define _DIRENT_HAVE_D_NAMLEN
+
+/* Entries missing from MSVC 6.0 */
+#if !defined(FILE_ATTRIBUTE_DEVICE)
+#   define FILE_ATTRIBUTE_DEVICE 0x40
+#endif
+
+/* File type and permission flags for stat(), general mask */
+#if !defined(S_IFMT)
+#   define S_IFMT _S_IFMT
+#endif
+
+/* Directory bit */
+#if !defined(S_IFDIR)
+#   define S_IFDIR _S_IFDIR
+#endif
+
+/* Character device bit */
+#if !defined(S_IFCHR)
+#   define S_IFCHR _S_IFCHR
+#endif
+
+/* Pipe bit */
+#if !defined(S_IFFIFO)
+#   define S_IFFIFO _S_IFFIFO
+#endif
+
+/* Regular file bit */
+#if !defined(S_IFREG)
+#   define S_IFREG _S_IFREG
+#endif
+
+/* Read permission */
+#if !defined(S_IREAD)
+#   define S_IREAD _S_IREAD
+#endif
+
+/* Write permission */
+#if !defined(S_IWRITE)
+#   define S_IWRITE _S_IWRITE
+#endif
+
+/* Execute permission */
+#if !defined(S_IEXEC)
+#   define S_IEXEC _S_IEXEC
+#endif
+
+/* Pipe */
+#if !defined(S_IFIFO)
+#   define S_IFIFO _S_IFIFO
+#endif
+
+/* Block device */
+#if !defined(S_IFBLK)
+#   define S_IFBLK 0
+#endif
+
+/* Link */
+#if !defined(S_IFLNK)
+#   define S_IFLNK 0
+#endif
+
+/* Socket */
+#if !defined(S_IFSOCK)
+#   define S_IFSOCK 0
+#endif
+
+/* Read user permission */
+#if !defined(S_IRUSR)
+#   define S_IRUSR S_IREAD
+#endif
+
+/* Write user permission */
+#if !defined(S_IWUSR)
+#   define S_IWUSR S_IWRITE
+#endif
+
+/* Execute user permission */
+#if !defined(S_IXUSR)
+#   define S_IXUSR 0
+#endif
+
+/* Read group permission */
+#if !defined(S_IRGRP)
+#   define S_IRGRP 0
+#endif
+
+/* Write group permission */
+#if !defined(S_IWGRP)
+#   define S_IWGRP 0
+#endif
+
+/* Execute group permission */
+#if !defined(S_IXGRP)
+#   define S_IXGRP 0
+#endif
+
+/* Read others permission */
+#if !defined(S_IROTH)
+#   define S_IROTH 0
+#endif
+
+/* Write others permission */
+#if !defined(S_IWOTH)
+#   define S_IWOTH 0
+#endif
+
+/* Execute others permission */
+#if !defined(S_IXOTH)
+#   define S_IXOTH 0
+#endif
+
+/* Maximum length of file name */
+#if !defined(PATH_MAX)
+#   define PATH_MAX MAX_PATH
+#endif
+#if !defined(FILENAME_MAX)
+#   define FILENAME_MAX MAX_PATH
+#endif
+#if !defined(NAME_MAX)
+#   define NAME_MAX FILENAME_MAX
+#endif
+
+/* File type flags for d_type */
+#define DT_UNKNOWN 0
+#define DT_REG S_IFREG
+#define DT_DIR S_IFDIR
+#define DT_FIFO S_IFIFO
+#define DT_SOCK S_IFSOCK
+#define DT_CHR S_IFCHR
+#define DT_BLK S_IFBLK
+#define DT_LNK S_IFLNK
+
+/* Macros for converting between st_mode and d_type */
+#define IFTODT(mode) ((mode) & S_IFMT)
+#define DTTOIF(type) (type)
+
+/*
+ * File type macros.  Note that block devices, sockets and links cannot be
+ * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
+ * only defined for compatibility.  These macros should always return false
+ * on Windows.
+ */
+#if !defined(S_ISFIFO)
+#   define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#endif
+#if !defined(S_ISDIR)
+#   define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#endif
+#if !defined(S_ISREG)
+#   define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+#if !defined(S_ISLNK)
+#   define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+#endif
+#if !defined(S_ISSOCK)
+#   define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+#endif
+#if !defined(S_ISCHR)
+#   define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
+#endif
+#if !defined(S_ISBLK)
+#   define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
+#endif
+
+/* Return the exact length of the file name without zero terminator */
+#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
+
+/* Return the maximum size of a file name */
+#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Wide-character version */
+struct _wdirent {
+    /* Always zero */
+    long d_ino;
+
+    /* File position within stream */
+    long d_off;
+
+    /* Structure size */
+    unsigned short d_reclen;
+
+    /* Length of name without \0 */
+    size_t d_namlen;
+
+    /* File type */
+    int d_type;
+
+    /* File name */
+    wchar_t d_name[PATH_MAX+1];
+};
+typedef struct _wdirent _wdirent;
+
+struct _WDIR {
+    /* Current directory entry */
+    struct _wdirent ent;
+
+    /* Private file data */
+    WIN32_FIND_DATAW data;
+
+    /* True if data is valid */
+    int cached;
+
+    /* Win32 search handle */
+    HANDLE handle;
+
+    /* Initial directory name */
+    wchar_t *patt;
+};
+typedef struct _WDIR _WDIR;
+
+/* Multi-byte character version */
+struct dirent {
+    /* Always zero */
+    long d_ino;
+
+    /* File position within stream */
+    long d_off;
+
+    /* Structure size */
+    unsigned short d_reclen;
+
+    /* Length of name without \0 */
+    size_t d_namlen;
+
+    /* File type */
+    int d_type;
+
+    /* File name */
+    char d_name[PATH_MAX+1];
+};
+typedef struct dirent dirent;
+
+struct DIR {
+    struct dirent ent;
+    struct _WDIR *wdirp;
+};
+typedef struct DIR DIR;
+
+
+/* Dirent functions */
+static DIR *opendir (const char *dirname);
+static _WDIR *_wopendir (const wchar_t *dirname);
+
+static struct dirent *readdir (DIR *dirp);
+static struct _wdirent *_wreaddir (_WDIR *dirp);
+
+static int readdir_r(
+    DIR *dirp, struct dirent *entry, struct dirent **result);
+static int _wreaddir_r(
+    _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result);
+
+static int closedir (DIR *dirp);
+static int _wclosedir (_WDIR *dirp);
+
+static void rewinddir (DIR* dirp);
+static void _wrewinddir (_WDIR* dirp);
+
+static int scandir (const char *dirname, struct dirent ***namelist,
+    int (*filter)(const struct dirent*),
+    int (*compare)(const void *, const void *));
+
+static int alphasort (const struct dirent **a, const struct dirent **b);
+
+static int versionsort (const struct dirent **a, const struct dirent **b);
+
+
+/* For compatibility with Symbian */
+#define wdirent _wdirent
+#define WDIR _WDIR
+#define wopendir _wopendir
+#define wreaddir _wreaddir
+#define wclosedir _wclosedir
+#define wrewinddir _wrewinddir
+
+
+/* Internal utility functions */
+static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp);
+static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp);
+
+static int dirent_mbstowcs_s(
+    size_t *pReturnValue,
+    wchar_t *wcstr,
+    size_t sizeInWords,
+    const char *mbstr,
+    size_t count);
+
+static int dirent_wcstombs_s(
+    size_t *pReturnValue,
+    char *mbstr,
+    size_t sizeInBytes,
+    const wchar_t *wcstr,
+    size_t count);
+
+static void dirent_set_errno (int error);
+
+
+/*
+ * Open directory stream DIRNAME for read and return a pointer to the
+ * internal working area that is used to retrieve individual directory
+ * entries.
+ */
+static _WDIR*
+_wopendir(
+    const wchar_t *dirname)
+{
+    _WDIR *dirp = NULL;
+    int error;
+
+    /* Must have directory name */
+    if (dirname == NULL  ||  dirname[0] == '\0') {
+        dirent_set_errno (ENOENT);
+        return NULL;
+    }
+
+    /* Allocate new _WDIR structure */
+    dirp = (_WDIR*) malloc (sizeof (struct _WDIR));
+    if (dirp != NULL) {
+        DWORD n;
+
+        /* Reset _WDIR structure */
+        dirp->handle = INVALID_HANDLE_VALUE;
+        dirp->patt = NULL;
+        dirp->cached = 0;
+
+        /* Compute the length of full path plus zero terminator
+         *
+         * Note that on WinRT there's no way to convert relative paths
+         * into absolute paths, so just assume its an absolute path.
+         */
+#       if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+            n = wcslen(dirname);
+#       else
+            n = GetFullPathNameW (dirname, 0, NULL, NULL);
+#       endif
+
+        /* Allocate room for absolute directory name and search pattern */
+        dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
+        if (dirp->patt) {
+
+            /*
+             * Convert relative directory name to an absolute one.  This
+             * allows rewinddir() to function correctly even when current
+             * working directory is changed between opendir() and rewinddir().
+             *
+             * Note that on WinRT there's no way to convert relative paths
+             * into absolute paths, so just assume its an absolute path.
+             */
+#           if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+                wcsncpy_s(dirp->patt, n+1, dirname, n);
+#           else
+                n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
+#           endif
+            if (n > 0) {
+                wchar_t *p;
+
+                /* Append search pattern \* to the directory name */
+                p = dirp->patt + n;
+                if (dirp->patt < p) {
+                    switch (p[-1]) {
+                    case '\\':
+                    case '/':
+                    case ':':
+                        /* Directory ends in path separator, e.g. c:\temp\ */
+                        /*NOP*/;
+                        break;
+
+                    default:
+                        /* Directory name doesn't end in path separator */
+                        *p++ = '\\';
+                    }
+                }
+                *p++ = '*';
+                *p = '\0';
+
+                /* Open directory stream and retrieve the first entry */
+                if (dirent_first (dirp)) {
+                    /* Directory stream opened successfully */
+                    error = 0;
+                } else {
+                    /* Cannot retrieve first entry */
+                    error = 1;
+                    dirent_set_errno (ENOENT);
+                }
+
+            } else {
+                /* Cannot retrieve full path name */
+                dirent_set_errno (ENOENT);
+                error = 1;
+            }
+
+        } else {
+            /* Cannot allocate memory for search pattern */
+            error = 1;
+        }
+
+    } else {
+        /* Cannot allocate _WDIR structure */
+        error = 1;
+    }
+
+    /* Clean up in case of error */
+    if (error  &&  dirp) {
+        _wclosedir (dirp);
+        dirp = NULL;
+    }
+
+    return dirp;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns pointer to static directory entry which may be overwritted by
+ * subsequent calls to _wreaddir().
+ */
+static struct _wdirent*
+_wreaddir(
+    _WDIR *dirp)
+{
+    struct _wdirent *entry;
+
+    /*
+     * Read directory entry to buffer.  We can safely ignore the return value
+     * as entry will be set to NULL in case of error.
+     */
+    (void) _wreaddir_r (dirp, &dirp->ent, &entry);
+
+    /* Return pointer to statically allocated directory entry */
+    return entry;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns zero on success.  If end of directory stream is reached, then sets
+ * result to NULL and returns zero.
+ */
+static int
+_wreaddir_r(
+    _WDIR *dirp,
+    struct _wdirent *entry,
+    struct _wdirent **result)
+{
+    WIN32_FIND_DATAW *datap;
+
+    /* Read next directory entry */
+    datap = dirent_next (dirp);
+    if (datap) {
+        size_t n;
+        DWORD attr;
+
+        /*
+         * Copy file name as wide-character string.  If the file name is too
+         * long to fit in to the destination buffer, then truncate file name
+         * to PATH_MAX characters and zero-terminate the buffer.
+         */
+        n = 0;
+        while (n < PATH_MAX  &&  datap->cFileName[n] != 0) {
+            entry->d_name[n] = datap->cFileName[n];
+            n++;
+        }
+        entry->d_name[n] = 0;
+
+        /* Length of file name excluding zero terminator */
+        entry->d_namlen = n;
+
+        /* File type */
+        attr = datap->dwFileAttributes;
+        if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
+            entry->d_type = DT_CHR;
+        } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+            entry->d_type = DT_DIR;
+        } else {
+            entry->d_type = DT_REG;
+        }
+
+        /* Reset dummy fields */
+        entry->d_ino = 0;
+        entry->d_off = 0;
+        entry->d_reclen = sizeof (struct _wdirent);
+
+        /* Set result address */
+        *result = entry;
+
+    } else {
+
+        /* Return NULL to indicate end of directory */
+        *result = NULL;
+
+    }
+
+    return /*OK*/0;
+}
+
+/*
+ * Close directory stream opened by opendir() function.  This invalidates the
+ * DIR structure as well as any directory entry read previously by
+ * _wreaddir().
+ */
+static int
+_wclosedir(
+    _WDIR *dirp)
+{
+    int ok;
+    if (dirp) {
+
+        /* Release search handle */
+        if (dirp->handle != INVALID_HANDLE_VALUE) {
+            FindClose (dirp->handle);
+            dirp->handle = INVALID_HANDLE_VALUE;
+        }
+
+        /* Release search pattern */
+        if (dirp->patt) {
+            free (dirp->patt);
+            dirp->patt = NULL;
+        }
+
+        /* Release directory structure */
+        free (dirp);
+        ok = /*success*/0;
+
+    } else {
+
+        /* Invalid directory stream */
+        dirent_set_errno (EBADF);
+        ok = /*failure*/-1;
+
+    }
+    return ok;
+}
+
+/*
+ * Rewind directory stream such that _wreaddir() returns the very first
+ * file name again.
+ */
+static void
+_wrewinddir(
+    _WDIR* dirp)
+{
+    if (dirp) {
+        /* Release existing search handle */
+        if (dirp->handle != INVALID_HANDLE_VALUE) {
+            FindClose (dirp->handle);
+        }
+
+        /* Open new search handle */
+        dirent_first (dirp);
+    }
+}
+
+/* Get first directory entry (internal) */
+static WIN32_FIND_DATAW*
+dirent_first(
+    _WDIR *dirp)
+{
+    WIN32_FIND_DATAW *datap;
+
+    /* Open directory and retrieve the first entry */
+    dirp->handle = FindFirstFileExW(
+        dirp->patt, FindExInfoStandard, &dirp->data,
+        FindExSearchNameMatch, NULL, 0);
+    if (dirp->handle != INVALID_HANDLE_VALUE) {
+
+        /* a directory entry is now waiting in memory */
+        datap = &dirp->data;
+        dirp->cached = 1;
+
+    } else {
+
+        /* Failed to re-open directory: no directory entry in memory */
+        dirp->cached = 0;
+        datap = NULL;
+
+    }
+    return datap;
+}
+
+/*
+ * Get next directory entry (internal).
+ *
+ * Returns 
+ */
+static WIN32_FIND_DATAW*
+dirent_next(
+    _WDIR *dirp)
+{
+    WIN32_FIND_DATAW *p;
+
+    /* Get next directory entry */
+    if (dirp->cached != 0) {
+
+        /* A valid directory entry already in memory */
+        p = &dirp->data;
+        dirp->cached = 0;
+
+    } else if (dirp->handle != INVALID_HANDLE_VALUE) {
+
+        /* Get the next directory entry from stream */
+        if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
+            /* Got a file */
+            p = &dirp->data;
+        } else {
+            /* The very last entry has been processed or an error occured */
+            FindClose (dirp->handle);
+            dirp->handle = INVALID_HANDLE_VALUE;
+            p = NULL;
+        }
+
+    } else {
+
+        /* End of directory stream reached */
+        p = NULL;
+
+    }
+
+    return p;
+}
+
+/*
+ * Open directory stream using plain old C-string.
+ */
+static DIR*
+opendir(
+    const char *dirname) 
+{
+    struct DIR *dirp;
+    int error;
+
+    /* Must have directory name */
+    if (dirname == NULL  ||  dirname[0] == '\0') {
+        dirent_set_errno (ENOENT);
+        return NULL;
+    }
+
+    /* Allocate memory for DIR structure */
+    dirp = (DIR*) malloc (sizeof (struct DIR));
+    if (dirp) {
+        wchar_t wname[PATH_MAX + 1];
+        size_t n;
+
+        /* Convert directory name to wide-character string */
+        error = dirent_mbstowcs_s(
+            &n, wname, PATH_MAX + 1, dirname, PATH_MAX + 1);
+        if (!error) {
+
+            /* Open directory stream using wide-character name */
+            dirp->wdirp = _wopendir (wname);
+            if (dirp->wdirp) {
+                /* Directory stream opened */
+                error = 0;
+            } else {
+                /* Failed to open directory stream */
+                error = 1;
+            }
+
+        } else {
+            /*
+             * Cannot convert file name to wide-character string.  This
+             * occurs if the string contains invalid multi-byte sequences or
+             * the output buffer is too small to contain the resulting
+             * string.
+             */
+            error = 1;
+        }
+
+    } else {
+        /* Cannot allocate DIR structure */
+        error = 1;
+    }
+
+    /* Clean up in case of error */
+    if (error  &&  dirp) {
+        free (dirp);
+        dirp = NULL;
+    }
+
+    return dirp;
+}
+
+/*
+ * Read next directory entry.
+ */
+static struct dirent*
+readdir(
+    DIR *dirp)
+{
+    struct dirent *entry;
+
+    /*
+     * Read directory entry to buffer.  We can safely ignore the return value
+     * as entry will be set to NULL in case of error.
+     */
+    (void) readdir_r (dirp, &dirp->ent, &entry);
+
+    /* Return pointer to statically allocated directory entry */
+    return entry;
+}
+
+/*
+ * Read next directory entry into called-allocated buffer.
+ *
+ * Returns zero on sucess.  If the end of directory stream is reached, then
+ * sets result to NULL and returns zero.
+ */
+static int
+readdir_r(
+    DIR *dirp,
+    struct dirent *entry,
+    struct dirent **result)
+{
+    WIN32_FIND_DATAW *datap;
+
+    /* Read next directory entry */
+    datap = dirent_next (dirp->wdirp);
+    if (datap) {
+        size_t n;
+        int error;
+
+        /* Attempt to convert file name to multi-byte string */
+        error = dirent_wcstombs_s(
+            &n, entry->d_name, PATH_MAX + 1, datap->cFileName, PATH_MAX + 1);
+
+        /*
+         * If the file name cannot be represented by a multi-byte string,
+         * then attempt to use old 8+3 file name.  This allows traditional
+         * Unix-code to access some file names despite of unicode
+         * characters, although file names may seem unfamiliar to the user.
+         *
+         * Be ware that the code below cannot come up with a short file
+         * name unless the file system provides one.  At least
+         * VirtualBox shared folders fail to do this.
+         */
+        if (error  &&  datap->cAlternateFileName[0] != '\0') {
+            error = dirent_wcstombs_s(
+                &n, entry->d_name, PATH_MAX + 1,
+                datap->cAlternateFileName, PATH_MAX + 1);
+        }
+
+        if (!error) {
+            DWORD attr;
+
+            /* Length of file name excluding zero terminator */
+            entry->d_namlen = n - 1;
+
+            /* File attributes */
+            attr = datap->dwFileAttributes;
+            if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
+                entry->d_type = DT_CHR;
+            } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+                entry->d_type = DT_DIR;
+            } else {
+                entry->d_type = DT_REG;
+            }
+
+            /* Reset dummy fields */
+            entry->d_ino = 0;
+            entry->d_off = 0;
+            entry->d_reclen = sizeof (struct dirent);
+
+        } else {
+
+            /*
+             * Cannot convert file name to multi-byte string so construct
+             * an errornous directory entry and return that.  Note that
+             * we cannot return NULL as that would stop the processing
+             * of directory entries completely.
+             */
+            entry->d_name[0] = '?';
+            entry->d_name[1] = '\0';
+            entry->d_namlen = 1;
+            entry->d_type = DT_UNKNOWN;
+            entry->d_ino = 0;
+            entry->d_off = -1;
+            entry->d_reclen = 0;
+
+        }
+
+        /* Return pointer to directory entry */
+        *result = entry;
+
+    } else {
+
+        /* No more directory entries */
+        *result = NULL;
+
+    }
+
+    return /*OK*/0;
+}
+
+/*
+ * Close directory stream.
+ */
+static int
+closedir(
+    DIR *dirp)
+{
+    int ok;
+    if (dirp) {
+
+        /* Close wide-character directory stream */
+        ok = _wclosedir (dirp->wdirp);
+        dirp->wdirp = NULL;
+
+        /* Release multi-byte character version */
+        free (dirp);
+
+    } else {
+
+        /* Invalid directory stream */
+        dirent_set_errno (EBADF);
+        ok = /*failure*/-1;
+
+    }
+    return ok;
+}
+
+/*
+ * Rewind directory stream to beginning.
+ */
+static void
+rewinddir(
+    DIR* dirp)
+{
+    /* Rewind wide-character string directory stream */
+    _wrewinddir (dirp->wdirp);
+}
+
+/*
+ * Scan directory for entries.
+ */
+static int
+scandir(
+    const char *dirname,
+    struct dirent ***namelist,
+    int (*filter)(const struct dirent*),
+    int (*compare)(const void*, const void*))
+{
+    struct dirent **files = NULL;
+    size_t size = 0;
+    size_t allocated = 0;
+    const size_t init_size = 1;
+    DIR *dir = NULL;
+    struct dirent *entry;
+    struct dirent *tmp = NULL;
+    size_t i;
+    int result = 0;
+
+    /* Open directory stream */
+    dir = opendir (dirname);
+    if (dir) {
+
+        /* Read directory entries to memory */
+        while (1) {
+
+            /* Enlarge pointer table to make room for another pointer */
+            if (size >= allocated) {
+                void *p;
+                size_t num_entries;
+
+                /* Compute number of entries in the enlarged pointer table */
+                if (size < init_size) {
+                    /* Allocate initial pointer table */
+                    num_entries = init_size;
+                } else {
+                    /* Double the size */
+                    num_entries = size * 2;
+                }
+
+                /* Allocate first pointer table or enlarge existing table */
+                p = realloc (files, sizeof (void*) * num_entries);
+                if (p != NULL) {
+                    /* Got the memory */
+                    files = (dirent**) p;
+                    allocated = num_entries;
+                } else {
+                    /* Out of memory */
+                    result = -1;
+                    break;
+                }
+
+            }
+
+            /* Allocate room for temporary directory entry */
+            if (tmp == NULL) {
+                tmp = (struct dirent*) malloc (sizeof (struct dirent));
+                if (tmp == NULL) {
+                    /* Cannot allocate temporary directory entry */
+                    result = -1;
+                    break;
+                }
+            }
+
+            /* Read directory entry to temporary area */
+            if (readdir_r (dir, tmp, &entry) == /*OK*/0) {
+
+                /* Did we got an entry? */
+                if (entry != NULL) {
+                    int pass;
+
+                    /* Determine whether to include the entry in result */
+                    if (filter) {
+                        /* Let the filter function decide */
+                        pass = filter (tmp);
+                    } else {
+                        /* No filter function, include everything */
+                        pass = 1;
+                    }
+
+                    if (pass) {
+                        /* Store the temporary entry to pointer table */
+                        files[size++] = tmp;
+                        tmp = NULL;
+
+                        /* Keep up with the number of files */
+                        result++;
+                    }
+
+                } else {
+
+                    /*
+                     * End of directory stream reached => sort entries and
+                     * exit.
+                     */
+                    qsort (files, size, sizeof (void*), compare);
+                    break;
+
+                }
+
+            } else {
+                /* Error reading directory entry */
+                result = /*Error*/ -1;
+                break;
+            }
+
+        }
+
+    } else {
+        /* Cannot open directory */
+        result = /*Error*/ -1;
+    }
+
+    /* Release temporary directory entry */
+    if (tmp) {
+        free (tmp);
+    }
+
+    /* Release allocated memory on error */
+    if (result < 0) {
+        for (i = 0; i < size; i++) {
+            free (files[i]);
+        }
+        free (files);
+        files = NULL;
+    }
+
+    /* Close directory stream */
+    if (dir) {
+        closedir (dir);
+    }
+
+    /* Pass pointer table to caller */
+    if (namelist) {
+        *namelist = files;
+    }
+    return result;
+}
+
+/* Alphabetical sorting */
+static int
+alphasort(
+    const struct dirent **a, const struct dirent **b)
+{
+    return strcoll ((*a)->d_name, (*b)->d_name);
+}
+
+/* Sort versions */
+static int
+versionsort(
+    const struct dirent **a, const struct dirent **b)
+{
+    /* FIXME: implement strverscmp and use that */
+    return alphasort (a, b);
+}
+
+
+/* Convert multi-byte string to wide character string */
+static int
+dirent_mbstowcs_s(
+    size_t *pReturnValue,
+    wchar_t *wcstr,
+    size_t sizeInWords,
+    const char *mbstr,
+    size_t count)
+{
+    int error;
+
+#if defined(_MSC_VER)  &&  _MSC_VER >= 1400
+
+    /* Microsoft Visual Studio 2005 or later */
+    error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
+
+#else
+
+    /* Older Visual Studio or non-Microsoft compiler */
+    size_t n;
+
+    /* Convert to wide-character string (or count characters) */
+    n = mbstowcs (wcstr, mbstr, sizeInWords);
+    if (!wcstr  ||  n < count) {
+
+        /* Zero-terminate output buffer */
+        if (wcstr  &&  sizeInWords) {
+            if (n >= sizeInWords) {
+                n = sizeInWords - 1;
+            }
+            wcstr[n] = 0;
+        }
+
+        /* Length of resuting multi-byte string WITH zero terminator */
+        if (pReturnValue) {
+            *pReturnValue = n + 1;
+        }
+
+        /* Success */
+        error = 0;
+
+    } else {
+
+        /* Could not convert string */
+        error = 1;
+
+    }
+
+#endif
+
+    return error;
+}
+
+/* Convert wide-character string to multi-byte string */
+static int
+dirent_wcstombs_s(
+    size_t *pReturnValue,
+    char *mbstr,
+    size_t sizeInBytes, /* max size of mbstr */
+    const wchar_t *wcstr,
+    size_t count)
+{
+    int error;
+
+#if defined(_MSC_VER)  &&  _MSC_VER >= 1400
+
+    /* Microsoft Visual Studio 2005 or later */
+    error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
+
+#else
+
+    /* Older Visual Studio or non-Microsoft compiler */
+    size_t n;
+
+    /* Convert to multi-byte string (or count the number of bytes needed) */
+    n = wcstombs (mbstr, wcstr, sizeInBytes);
+    if (!mbstr  ||  n < count) {
+
+        /* Zero-terminate output buffer */
+        if (mbstr  &&  sizeInBytes) {
+            if (n >= sizeInBytes) {
+                n = sizeInBytes - 1;
+            }
+            mbstr[n] = '\0';
+        }
+
+        /* Length of resulting multi-bytes string WITH zero-terminator */
+        if (pReturnValue) {
+            *pReturnValue = n + 1;
+        }
+
+        /* Success */
+        error = 0;
+
+    } else {
+
+        /* Cannot convert string */
+        error = 1;
+
+    }
+
+#endif
+
+    return error;
+}
+
+/* Set errno variable */
+static void
+dirent_set_errno(
+    int error)
+{
+#if defined(_MSC_VER)  &&  _MSC_VER >= 1400
+
+    /* Microsoft Visual Studio 2005 and later */
+    _set_errno (error);
+
+#else
+
+    /* Non-Microsoft compiler or older Microsoft compiler */
+    errno = error;
+
+#endif
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*DIRENT_H*/
+
index 5856f2a1d1ffd68f45c9b5ad37b55eeca6d0e23b..2ff01cc9d4751edce43bf5691a55e6c02527ccb0 100644 (file)
 LIBRARY "librrd-4.dll"
 EXPORTS
 rrd_add_ptr
+rrd_add_ptr_chunk
 rrd_add_strdup
+rrd_add_strdup_chunk
+rrd_asprintf
+rrd_cf_conv
 rrd_clear_error
+rrd_client_address
+rrd_client_connect
+rrd_client_create
+rrd_client_create_r2
+rrd_client_destroy
+rrd_client_fetch
+rrd_client_first
+rrd_client_flush
+rrd_client_flushall
+rrd_client_forget
+rrd_client_info
+rrd_client_is_connected
+rrd_client_last
+rrd_client_list
+rrd_client_new
+rrd_client_ping
+rrd_client_stats_get
+rrd_client_update
 rrd_close
 rrd_create
 rrd_create_r
+rrd_create_r2
+rrd_diff
 rrd_dontneed
 rrd_dump
 rrd_dump_cb_r
+rrd_dump_opt_r
 rrd_dump_r
 rrd_fetch
+rrd_fetch_cb_register
+rrd_fetch_empty
+rrd_fetch_fn
+rrd_fetch_fn_cb
 rrd_fetch_r
 rrd_first
 rrd_first_r
 rrd_flush
 rrd_flushcached
-rrd_flushall
+rrd_force_new_context
 rrd_free
 rrd_free_context
-rrd_freemem
 rrd_free_ptrs
+rrd_freemem
 rrd_get_context
 rrd_get_error
+rrd_get_header_size
 rrd_graph
+rrd_graph_color
+rrd_graph_init
+rrd_graph_options
+rrd_graph_script
 rrd_graph_v
+rrd_graph_xport
 rrd_info
 rrd_info_free
 rrd_info_print
 rrd_info_push
 rrd_info_r
-rrd_list
-rrd_list_r
 rrd_init
 rrd_last
 rrd_last_r
 rrd_lastupdate
 rrd_lastupdate_r
+rrd_lcd
+rrd_list
+rrd_list_r
 rrd_lock
 rrd_mkdir_p
 rrd_new_context
+rrd_notify_row
 rrd_open
 rrd_parsetime
 rrd_proc_start_end
 rrd_random
 rrd_read
+rrd_reduce_data
 rrd_resize
 rrd_restore
+rrd_scaled_duration
 rrd_seek
+rrd_select_initial_row
 rrd_set_error
 rrd_set_to_DINF
 rrd_set_to_DNAN
+rrd_snprintf
 rrd_strerror
+rrd_strtod
+rrd_strtodbl
 rrd_strversion
 rrd_tell
 rrd_test_error
+rrd_thread_init
 rrd_tune
 rrd_update
 rrd_update_r
 rrd_update_v
+rrd_update_v_r
+rrd_updatex_r
+rrd_updatex_v_r
+rrd_vasprintf
 rrd_version
+rrd_vsnprintf
 rrd_write
 rrd_xport
 rrdc_connect
-rrdc_is_connected
+rrdc_create
+rrdc_create_r2
 rrdc_disconnect
+rrdc_fetch
+rrdc_first
 rrdc_flush
+rrdc_flush_if_daemon
 rrdc_flushall
+rrdc_flushall_if_daemon
+rrdc_forget
+rrdc_info
+rrdc_is_any_connected
+rrdc_is_connected
+rrdc_last
+rrdc_list
+rrdc_ping
 rrdc_stats_free
 rrdc_stats_get
 rrdc_update
index aebcd39a180aa53092f9131bcaeadf99542ecf05..29f8f40fdf540216c01c4f08215ee3720cc27d4f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="DebugDLL|Win32">
       <Configuration>DebugDLL</Configuration>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
     <CLRSupport>false</CLRSupport>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.;../contrib/include/cairo;../contrib/include/pango-1.0;../contrib/include/glib-2.0;../contrib/lib/glib-2.0/include;../contrib/include;../contrib/include/libpng12;../contrib/include/libxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;strftime=strftime_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsCpp</CompileAs>
+      <CompileAs>CompileAsC</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
     <Lib>
-      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;gthread-2.0.lib;pcre.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>../contrib/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ModuleDefinitionFile />
     </Lib>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <AdditionalIncludeDirectories>.;../contrib/include/cairo;../contrib/include/pango-1.0;../contrib/include/glib-2.0;../contrib/lib/glib-2.0/include;../contrib/include;../contrib/include/libpng12;../contrib/include/libxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_WINDOWS;_USE_32BIT_TIME_T;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;strftime=strftime_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_USE_32BIT_TIME_T;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <PrecompiledHeader />
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>None</DebugInformationFormat>
-      <CompileAs>CompileAsCpp</CompileAs>
+      <CompileAs>CompileAsC</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
     <Lib>
-      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;gthread-2.0.lib;pcre.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>../contrib/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Lib>
   </ItemDefinitionGroup>
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.;../contrib/include/cairo;../contrib/include/pango-1.0;../contrib/include/glib-2.0;../contrib/lib/glib-2.0/include;../contrib/include;../contrib/include/libpng12;../contrib/include/libxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;strftime=strftime_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsCpp</CompileAs>
+      <CompileAs>CompileAsC</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>cairo.lib;glib-2.0.lib;gobject-2.0.lib;libpng.lib;libxml2.lib;pango-1.0.lib;pangocairo-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;glib-2.0.lib;gobject-2.0.lib;libpng.lib;libxml2.lib;pango-1.0.lib;pangocairo-1.0.lib;gthread-2.0.lib;pcre.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>../contrib/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ModuleDefinitionFile>librrd-4.def</ModuleDefinitionFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Static Debug|Win32'">
       <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsCpp</CompileAs>
+      <CompileAs>CompileAsC</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
     </ClCompile>
     <Lib>
-      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;gthread-2.0.lib;pcre.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>../contrib/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ModuleDefinitionFile />
       <IgnoreSpecificDefaultLibraries>LIBCMTD.lib;LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.;../contrib/include/cairo;../contrib/include/pango-1.0;../contrib/include/glib-2.0;../contrib/lib/glib-2.0/include;../contrib/include;../contrib/include/libpng12;../contrib/include/libxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;strftime=strftime_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>TurnOffAllWarnings</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsCpp</CompileAs>
+      <CompileAs>CompileAsC</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <DisableLanguageExtensions>false</DisableLanguageExtensions>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>cairo.lib;glib-2.0.lib;gobject-2.0.lib;libpng.lib;libxml2.lib;pango-1.0.lib;ws2_32.lib;pangocairo-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;glib-2.0.lib;gobject-2.0.lib;libpng.lib;libxml2.lib;pango-1.0.lib;ws2_32.lib;pangocairo-1.0.lib;gthread-2.0.lib;pcre.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>../contrib/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ModuleDefinitionFile>librrd-4.def</ModuleDefinitionFile>
+      <AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\src\hash_32.c" />
     <ClCompile Include="..\src\mkstemp.c" />
     <ClCompile Include="..\src\mutex.c" />
+    <ClCompile Include="..\src\optparse.c" />
     <ClCompile Include="..\src\plbasename.c" />
     <ClCompile Include="..\src\pngsize.c" />
+    <ClCompile Include="..\src\quicksort.c" />
     <ClCompile Include="..\src\rrd_client.c" />
     <ClCompile Include="..\src\rrd_create.c" />
     <ClCompile Include="..\src\rrd_diff.c" />
     <ClCompile Include="..\src\rrd_first.c" />
     <ClCompile Include="..\src\rrd_flushcached.c" />
     <ClCompile Include="..\src\rrd_format.c" />
-    <ClCompile Include="..\src\rrd_getopt.c" />
-    <ClCompile Include="..\src\rrd_getopt1.c" />
     <ClCompile Include="..\src\rrd_gfx.c" />
     <ClCompile Include="..\src\rrd_graph.c" />
     <ClCompile Include="..\src\rrd_graph_helper.c" />
     <ClCompile Include="..\src\rrd_info.c" />
     <ClCompile Include="..\src\rrd_last.c" />
     <ClCompile Include="..\src\rrd_lastupdate.c" />
+    <ClCompile Include="..\src\rrd_list.c" />
     <ClCompile Include="..\src\rrd_modify.c" />
     <ClCompile Include="..\src\rrd_nan_inf.c" />
     <ClCompile Include="..\src\rrd_open.c" />
     <ClCompile Include="..\src\rrd_version.c" />
     <ClCompile Include="..\src\rrd_xport.c" />
     <ClCompile Include="..\src\strftime.c" />
+    <ClCompile Include="..\src\win32comp.c" />
+    <ClCompile Include="asprintf.c" />
+    <ClCompile Include="vasprintf-msvc.c" />
+    <ClCompile Include="win32-glob.c" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="..\src\fnv.h" />
+    <ClInclude Include="..\src\gettext.h" />
     <ClInclude Include="..\src\mkstemp.h" />
     <ClInclude Include="..\src\mutex.h" />
-    <ClInclude Include="..\src\rrd_modify.h" />
-    <ClInclude Include="rrd_config.h" />
-    <ClInclude Include="..\src\fnv.h" />
+    <ClInclude Include="..\src\optparse.h" />
     <ClInclude Include="..\src\plbasename.h" />
+    <ClInclude Include="..\src\quicksort.h" />
     <ClInclude Include="..\src\rrd.h" />
+    <ClInclude Include="..\src\rrd_client.h" />
+    <ClInclude Include="..\src\rrd_create.h" />
     <ClInclude Include="..\src\rrd_format.h" />
-    <ClInclude Include="..\src\rrd_getopt.h" />
     <ClInclude Include="..\src\rrd_graph.h" />
     <ClInclude Include="..\src\rrd_hw.h" />
     <ClInclude Include="..\src\rrd_hw_math.h" />
     <ClInclude Include="..\src\rrd_hw_update.h" />
     <ClInclude Include="..\src\rrd_i18n.h" />
     <ClInclude Include="..\src\rrd_is_thread_safe.h" />
+    <ClInclude Include="..\src\rrd_modify.h" />
     <ClInclude Include="..\src\rrd_parsetime.h" />
+    <ClInclude Include="..\src\rrd_restore.h" />
     <ClInclude Include="..\src\rrd_rpncalc.h" />
+    <ClInclude Include="..\src\rrd_snprintf.h" />
+    <ClInclude Include="..\src\rrd_strtod.h" />
     <ClInclude Include="..\src\rrd_tool.h" />
+    <ClInclude Include="..\src\rrd_update.h" />
     <ClInclude Include="..\src\rrd_xport.h" />
     <ClInclude Include="..\src\strftime.h" />
     <ClInclude Include="..\src\unused.h" />
+    <ClInclude Include="rrd_config.h" />
+    <ClInclude Include="win32-glob.h" />
   </ItemGroup>
   <ItemGroup>
     <None Include="librrd-4.def" />
index e13b7aa41ce8bf0bca13489079a1f3f86c7f97f7..b9d3fdf226716c673513f085b551f03fcbdf82c5 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -89,7 +89,9 @@
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -101,8 +103,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -129,7 +131,9 @@ copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -141,8 +145,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -170,7 +174,9 @@ copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -182,9 +188,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-
-
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
index 8135a1ce38a3d933eae0f8efcaed78b7e976c422..2440408005a93260cff267e44e95857c62542932 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v140</PlatformToolset>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -67,6 +67,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <InlineFunctionExpansion>Default</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -88,7 +89,9 @@
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -100,8 +103,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -128,7 +131,9 @@ copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -140,8 +145,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -168,7 +173,9 @@ copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
     <PostBuildEvent>
       <Message>get all the dlls, needed for running</Message>
       <Command>copy $(ProjectDir)\..\contrib\bin\freetype6.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\intl.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libcairo-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\libexpat-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libfontconfig-1.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libglib-2.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libgmodule-2.0-0.dll $(TargetDir)\
@@ -180,9 +187,8 @@ copy $(ProjectDir)\..\contrib\bin\libpangoft2-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpangowin32-1.0-0.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libpng14-14.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\libxml2-2.dll $(TargetDir)\
+copy $(ProjectDir)\..\contrib\bin\pcre3.dll $(TargetDir)\
 copy $(ProjectDir)\..\contrib\bin\zlib1.dll $(TargetDir)\
-
-
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
diff --git a/win32/vasprintf-msvc.c b/win32/vasprintf-msvc.c
new file mode 100644 (file)
index 0000000..2d951f8
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+Copyright (C) 2014 insane coder (http://insanecoding.blogspot.com/, http://asprintf.insanecoding.org/)
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "asprintf.h"
+
+int vasprintf(char **strp, const char *fmt, va_list ap)
+{
+  int r = -1, size = _vscprintf(fmt, ap);
+
+  if ((size >= 0) && (size < INT_MAX))
+  {
+    *strp = (char *)malloc(size+1); //+1 for null
+    if (*strp)
+    {
+      r = vsnprintf(*strp, size+1, fmt, ap);  //+1 for null
+      if ((r < 0) || (r > size))
+      {
+        insane_free(*strp);
+        r = -1;
+      }
+    }
+  }
+  else { *strp = 0; }
+
+  return(r);
+}
\ No newline at end of file
diff --git a/win32/win32-glob.c b/win32/win32-glob.c
new file mode 100644 (file)
index 0000000..111565a
--- /dev/null
@@ -0,0 +1,169 @@
+/* libSoX minimal glob for MS-Windows: (c) 2009 SoX contributors\r
+ *\r
+ * This library is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2.1 of the License, or (at\r
+ * your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser\r
+ * General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation,\r
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+ */\r
+\r
+#include "win32-glob.h"\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <errno.h>\r
+#define WIN32_LEAN_AND_MEAN 1\r
+#include <windows.h>\r
+\r
+typedef struct file_entry\r
+{\r
+    char name[MAX_PATH];\r
+    struct file_entry *next;\r
+} file_entry;\r
+\r
+static int\r
+insert(\r
+    const char* path,\r
+    const char* name,\r
+    file_entry** phead)\r
+{\r
+    int len;\r
+    file_entry* cur = malloc(sizeof(file_entry));\r
+    if (!cur)\r
+    {\r
+        return ENOMEM;\r
+    }\r
+\r
+    len = _snprintf(cur->name, MAX_PATH, "%s%s", path, name);\r
+    cur->name[MAX_PATH - 1] = 0;\r
+    cur->next = *phead;\r
+    *phead = cur;\r
+\r
+    return len < 0 || len >= MAX_PATH ? ENAMETOOLONG : 0;\r
+}\r
+\r
+static int\r
+entry_comparer(\r
+    const void* pv1,\r
+    const void* pv2)\r
+{\r
+       const file_entry* const * pe1 = pv1;\r
+       const file_entry* const * pe2 = pv2;\r
+    return _stricmp((*pe1)->name, (*pe2)->name);\r
+}\r
+\r
+int\r
+glob(\r
+    const char *pattern,\r
+    int flags,\r
+    void *unused,\r
+    glob_t *pglob)\r
+{\r
+    char path[MAX_PATH];\r
+    file_entry *head = NULL;\r
+    int err = 0;\r
+    size_t len;\r
+    unsigned entries = 0;\r
+    WIN32_FIND_DATAA finddata;\r
+    HANDLE hfindfile = FindFirstFileA(pattern, &finddata);\r
+\r
+    if (!pattern || flags != (flags & GLOB_FLAGS) || unused || !pglob)\r
+    {\r
+        errno = EINVAL;\r
+        return EINVAL;\r
+    }\r
+\r
+    path[MAX_PATH - 1] = 0;\r
+    strncpy(path, pattern, MAX_PATH);\r
+    if (path[MAX_PATH - 1] != 0)\r
+    {\r
+        errno = ENAMETOOLONG;\r
+        return ENAMETOOLONG;\r
+    }\r
+\r
+    len = strlen(path);\r
+    while (len > 0 && path[len - 1] != '/' && path[len - 1] != '\\')\r
+        len--;\r
+    path[len] = 0;\r
+\r
+    if (hfindfile == INVALID_HANDLE_VALUE)\r
+    {\r
+        if (flags & GLOB_NOCHECK)\r
+        {\r
+            err = insert("", pattern, &head);\r
+            entries++;\r
+        }\r
+    }\r
+    else\r
+    {\r
+        do\r
+        {\r
+            err = insert(path, finddata.cFileName, &head);\r
+            entries++;\r
+        } while (!err && FindNextFileA(hfindfile, &finddata));\r
+\r
+        FindClose(hfindfile);\r
+    }\r
+\r
+    if (err == 0)\r
+    {\r
+        pglob->gl_pathv = malloc((entries + 1) * sizeof(char*));\r
+        if (pglob->gl_pathv)\r
+        {\r
+            pglob->gl_pathc = entries;\r
+            pglob->gl_pathv[entries] = NULL;\r
+            for (; head; head = head->next, entries--)\r
+                pglob->gl_pathv[entries - 1] = (char*)head;\r
+            qsort(pglob->gl_pathv, pglob->gl_pathc, sizeof(char*), entry_comparer);\r
+        }\r
+        else\r
+        {\r
+            pglob->gl_pathc = 0;\r
+            err = ENOMEM;\r
+        }\r
+    }\r
+    else if (pglob)\r
+    {\r
+        pglob->gl_pathc = 0;\r
+        pglob->gl_pathv = NULL;\r
+    }\r
+\r
+    if (err)\r
+    {\r
+        file_entry *cur;\r
+        while (head)\r
+        {\r
+            cur = head;\r
+            head = head->next;\r
+            free(cur);\r
+        }\r
+\r
+        errno = err;\r
+    }\r
+\r
+    return err;\r
+}\r
+\r
+void\r
+globfree(\r
+    glob_t* pglob)\r
+{\r
+    if (pglob)\r
+    {\r
+        char** cur;\r
+        for (cur = pglob->gl_pathv; *cur; cur++)\r
+        {\r
+            free(*cur);\r
+        }\r
+\r
+        pglob->gl_pathc = 0;\r
+        pglob->gl_pathv = NULL;\r
+    }\r
+}\r
diff --git a/win32/win32-glob.h b/win32/win32-glob.h
new file mode 100644 (file)
index 0000000..3dca881
--- /dev/null
@@ -0,0 +1,49 @@
+/* libSoX minimal glob for MS-Windows: (c) 2009 SoX contributors\r
+ *\r
+ * This library is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2.1 of the License, or (at\r
+ * your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser\r
+ * General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation,\r
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+ */\r
+\r
+#ifndef GLOB_H\r
+#define GLOB_H 1\r
+\r
+#define GLOB_NOCHECK (16)\r
+#define GLOB_FLAGS (GLOB_NOCHECK)\r
+\r
+typedef struct glob_t\r
+{\r
+    unsigned gl_pathc;\r
+    char **gl_pathv;\r
+} glob_t;\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+int\r
+glob(\r
+    const char *pattern,\r
+    int flags,\r
+    void *unused,\r
+    glob_t *pglob);\r
+\r
+void\r
+globfree(\r
+    glob_t* pglob);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* ifndef GLOB_H */\r