Minimal tweaks to compile with Visual C 2015

feature/tap-sh
Dan Kegel 2017-06-04 19:19:55 -07:00
parent 35d0f63daf
commit 4d7b4d7c8e
6 changed files with 35 additions and 17 deletions

View File

@ -62,7 +62,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#endif
#define PKGCONF_HACK_LOGICAL_OR_ALL_VALUES #define PKGCONF_HACK_LOGICAL_OR_ALL_VALUES

View File

@ -17,6 +17,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>

View File

@ -310,7 +310,7 @@ void pkgconf_audit_log_dependency(pkgconf_client_t *client, const pkgconf_pkg_t
/* path.c */ /* path.c */
void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter); void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter);
size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter); size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter);
size_t pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist, bool filter); size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist, bool filter);
bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist); bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);
void pkgconf_path_free(pkgconf_list_t *dirlist); void pkgconf_path_free(pkgconf_list_t *dirlist);
bool pkgconf_path_relocate(char *buf, size_t buflen); bool pkgconf_path_relocate(char *buf, size_t buflen);

View File

@ -20,7 +20,7 @@
# include <sys/cygwin.h> # include <sys/cygwin.h>
#endif #endif
#ifdef HAVE_SYS_STAT_H #if defined(HAVE_SYS_STAT_H) && ! defined(_WIN32)
# include <sys/stat.h> # include <sys/stat.h>
# define PKGCONF_CACHE_INODES # define PKGCONF_CACHE_INODES
#endif #endif
@ -156,12 +156,12 @@ pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter)
/* /*
* !doc * !doc
* *
* .. c:function:: size_t pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist) * .. c:function:: size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist)
* *
* Adds the paths specified in an environment variable to a path list. If the environment variable is not set, * Adds the paths specified in an environment variable to a path list. If the environment variable is not set,
* an optional default set of paths is added. * an optional default set of paths is added.
* *
* :param char* environ: The environment variable to look up. * :param char* envvarname: The environment variable to look up.
* :param char* fallback: The fallback paths to use if the environment variable is not set. * :param char* fallback: The fallback paths to use if the environment variable is not set.
* :param pkgconf_list_t* dirlist: The path list to add the path nodes to. * :param pkgconf_list_t* dirlist: The path list to add the path nodes to.
* :param bool filter: Whether to perform duplicate filtering. * :param bool filter: Whether to perform duplicate filtering.
@ -169,11 +169,11 @@ pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter)
* :rtype: size_t * :rtype: size_t
*/ */
size_t size_t
pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist, bool filter) pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist, bool filter)
{ {
const char *data; const char *data;
data = getenv(environ); data = getenv(envvarname);
if (data != NULL) if (data != NULL)
return pkgconf_path_split(data, dirlist, filter); return pkgconf_path_split(data, dirlist, filter);

View File

@ -30,6 +30,8 @@
# define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH" # define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
# undef PKG_DEFAULT_PATH # undef PKG_DEFAULT_PATH
# define PKG_DEFAULT_PATH "../lib/pkgconfig;../share/pkgconfig" # define PKG_DEFAULT_PATH "../lib/pkgconfig;../share/pkgconfig"
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif #endif
#define PKG_CONFIG_EXT ".pc" #define PKG_CONFIG_EXT ".pc"
@ -134,21 +136,21 @@ static int pkgconf_pkg_parser_keyword_pair_cmp(const void *key, const void *ptr)
static void static void
pkgconf_pkg_parser_tuple_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value) pkgconf_pkg_parser_tuple_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value)
{ {
char **dest = ((void *) pkg + offset); char **dest = (char **)((char *) pkg + offset);
*dest = pkgconf_tuple_parse(client, &pkg->vars, value); *dest = pkgconf_tuple_parse(client, &pkg->vars, value);
} }
static void static void
pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value) pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value)
{ {
pkgconf_list_t *dest = ((void *) pkg + offset); pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
pkgconf_fragment_parse(client, dest, &pkg->vars, value); pkgconf_fragment_parse(client, dest, &pkg->vars, value);
} }
static void static void
pkgconf_pkg_parser_dependency_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value) pkgconf_pkg_parser_dependency_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const ptrdiff_t offset, char *value)
{ {
pkgconf_list_t *dest = ((void *) pkg + offset); pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
pkgconf_dependency_parse(client, pkg, dest, value); pkgconf_dependency_parse(client, pkg, dest, value);
} }
@ -238,7 +240,7 @@ pkgconf_pkg_validate(const pkgconf_client_t *client, const pkgconf_pkg_t *pkg)
for (i = 0; i < PKGCONF_ARRAY_SIZE(pkgconf_pkg_validations); i++) for (i = 0; i < PKGCONF_ARRAY_SIZE(pkgconf_pkg_validations); i++)
{ {
char **p = ((void *) pkg + pkgconf_pkg_validations[i].offset); char **p = (char **)((char *) pkg + pkgconf_pkg_validations[i].offset);
if (*p != NULL) if (*p != NULL)
continue; continue;
@ -587,7 +589,7 @@ pkgconf_scan_all(pkgconf_client_t *client, void *data, pkgconf_pkg_iteration_fun
#ifdef _WIN32 #ifdef _WIN32
static pkgconf_pkg_t * static pkgconf_pkg_t *
pkgconf_pkg_find_in_registry_key(const pkgconf_client_t *client, HKEY hkey, const char *name) pkgconf_pkg_find_in_registry_key(pkgconf_client_t *client, HKEY hkey, const char *name)
{ {
pkgconf_pkg_t *pkg = NULL; pkgconf_pkg_t *pkg = NULL;
@ -1048,8 +1050,12 @@ typedef struct {
static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_rules[] = { static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_rules[] = {
[PKGCONF_CMP_ANY] = { [PKGCONF_CMP_ANY] = {
.rulecmp = {}, .rulecmp = {
.depcmp = {}, [PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
},
.depcmp = {
[PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
},
}, },
[PKGCONF_CMP_LESS_THAN] = { [PKGCONF_CMP_LESS_THAN] = {
.rulecmp = { .rulecmp = {
@ -1121,7 +1127,9 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_eq, [PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_eq,
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne [PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
}, },
.depcmp = {}, .depcmp = {
[PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
},
}, },
[PKGCONF_CMP_NOT_EQUAL] = { [PKGCONF_CMP_NOT_EQUAL] = {
.rulecmp = { .rulecmp = {
@ -1133,7 +1141,9 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_ne, [PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_ne,
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_eq [PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_eq
}, },
.depcmp = {}, .depcmp = {
[PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
},
}, },
}; };

View File

@ -24,9 +24,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <dirent.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#include <stdint.h> #include <stdint.h>
#ifdef _WIN32 #ifdef _WIN32
@ -34,8 +32,15 @@
# include <windows.h> # include <windows.h>
# include <malloc.h> # include <malloc.h>
# define PATH_DEV_NULL "nul" # define PATH_DEV_NULL "nul"
# ifndef ssize_t
# include <BaseTsd.h>
# define ssize_t SSIZE_T
# endif
# include "win-dirent.h"
#else #else
# define PATH_DEV_NULL "/dev/null" # define PATH_DEV_NULL "/dev/null"
# include <dirent.h>
# include <unistd.h>
#endif #endif
#endif #endif