From df7cba1495c167f1019dec7f4398dc5de62a5937 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 25 Feb 2014 14:38:41 +0800 Subject: Fix Build on Visual Studio Some items from pygi-enum-marshal.c were moved to pygi-basictype.c, which included the use of the NAN and INFINITY macros/constants, so the definitions for those need to be moved to pygi-basictype.c as well. Also avoid defining a variable in the middle of the block. https://bugzilla.gnome.org/show_bug.cgi?id=725122 --- gi/pygi-basictype.c | 16 ++++++++++++++++ gi/pygi-cache.c | 3 ++- gi/pygi-enum-marshal.c | 16 ---------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c index 6fbe9292..c9606a93 100644 --- a/gi/pygi-basictype.c +++ b/gi/pygi-basictype.c @@ -25,6 +25,22 @@ #include "pygi-argument.h" #include "pygi-private.h" +#ifdef G_OS_WIN32 +#ifdef _MSC_VER +#include + +#ifndef NAN +static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; +#define NAN (*(const float *) __nan) +#endif + +#ifndef INFINITY +#define INFINITY HUGE_VAL +#endif + +#endif +#endif + /* * From Python Marshaling diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c index 8055c155..abf8e100 100644 --- a/gi/pygi-cache.c +++ b/gi/pygi-cache.c @@ -475,6 +475,7 @@ _args_cache_generate (GICallableInfo *callable_info, GITransfer return_transfer; PyGIArgCache *return_cache; PyGIDirection return_direction; + gssize last_explicit_arg_index; /* Return arguments are always considered out */ return_direction = _pygi_get_direction (callable_cache, GI_DIRECTION_OUT); @@ -637,7 +638,7 @@ _args_cache_generate (GICallableInfo *callable_info, callable_cache->n_py_required_args = 0; callable_cache->user_data_varargs_index = -1; - gssize last_explicit_arg_index = -1; + last_explicit_arg_index = -1; /* Reverse loop through all the arguments to setup arg_name_list/hash * and find the number of required arguments */ diff --git a/gi/pygi-enum-marshal.c b/gi/pygi-enum-marshal.c index dec59243..32ca9dcd 100644 --- a/gi/pygi-enum-marshal.c +++ b/gi/pygi-enum-marshal.c @@ -25,22 +25,6 @@ #include "pygi-enum-marshal.h" #include "pygi-private.h" -#ifdef _WIN32 -#ifdef _MSC_VER -#include - -#ifndef NAN -static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; -#define NAN (*(const float *) __nan) -#endif - -#ifndef INFINITY -#define INFINITY HUGE_VAL -#endif - -#endif -#endif - static gboolean gi_argument_from_c_long (GIArgument *arg_out, long c_long_in, -- cgit v1.2.1