From c224fd594b748805fbd1f87f64b3f5abd1284cb6 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 26 Jan 2014 21:55:59 +0000 Subject: [PATCH] [LIBWINE][WINED3D] - Import isfinite from Wine libport & hack-define copysignf -- aka fix build svn path=/trunk/; revision=61847 --- reactos/dll/directx/wine/wined3d/utils.c | 5 ++- reactos/include/reactos/wine/config.h | 3 ++ reactos/include/reactos/wine/port.h | 14 +++++-- reactos/lib/3rdparty/libwine/CMakeLists.txt | 1 + reactos/lib/3rdparty/libwine/isfinite.c | 46 +++++++++++++++++++++ reactos/lib/3rdparty/libwine/isinf.c | 4 +- reactos/lib/3rdparty/libwine/isnan.c | 4 +- 7 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 reactos/lib/3rdparty/libwine/isfinite.c diff --git a/reactos/dll/directx/wine/wined3d/utils.c b/reactos/dll/directx/wine/wined3d/utils.c index a69cedea32c..18ee65e7b39 100644 --- a/reactos/dll/directx/wine/wined3d/utils.c +++ b/reactos/dll/directx/wine/wined3d/utils.c @@ -25,7 +25,10 @@ */ #include "wined3d_private.h" -#include + +#ifdef _MSC_VER +#define copysignf(x, y) ((x) < 0.0f ? -fabsf(y) : fabsf(y)) +#endif WINE_DEFAULT_DEBUG_CHANNEL(d3d); diff --git a/reactos/include/reactos/wine/config.h b/reactos/include/reactos/wine/config.h index 3f56ce35033..6f1d8d632cb 100644 --- a/reactos/include/reactos/wine/config.h +++ b/reactos/include/reactos/wine/config.h @@ -296,6 +296,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_IO_H 1 +/* Define to 1 if you have the `isfinite' function. */ +/* #undef HAVE_ISFINITE */ + /* Define to 1 if you have the `isinf' function. */ /* #undef HAVE_ISINF */ diff --git a/reactos/include/reactos/wine/port.h b/reactos/include/reactos/wine/port.h index 43f693b08ee..7b42643de67 100644 --- a/reactos/include/reactos/wine/port.h +++ b/reactos/include/reactos/wine/port.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WINE_WINE_PORT_H @@ -25,7 +25,9 @@ # error You must include config.h to use this header #endif -#define _GNU_SOURCE /* for pread/pwrite */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE /* for pread/pwrite, isfinite */ +#endif #include #include #include @@ -246,11 +248,15 @@ extern int getopt_long_only (int ___argc, char *const *___argv, size_t getpagesize(void); #endif /* HAVE_GETPAGESIZE */ -#if !defined(HAVE_ISINF) && !defined(_ISINF) && !defined(isinf) +#if !defined(HAVE_ISFINITE) && !defined(isfinite) +int isfinite(double x); +#endif + +#if !defined(HAVE_ISINF) && !defined(isinf) int isinf(double x); #endif -#if !defined(HAVE_ISNAN) && !defined(_ISNAN) && !defined(isnan) +#if !defined(HAVE_ISNAN) && !defined(isnan) int isnan(double x); #endif diff --git a/reactos/lib/3rdparty/libwine/CMakeLists.txt b/reactos/lib/3rdparty/libwine/CMakeLists.txt index d7bf83449fc..a57e9851b47 100644 --- a/reactos/lib/3rdparty/libwine/CMakeLists.txt +++ b/reactos/lib/3rdparty/libwine/CMakeLists.txt @@ -6,6 +6,7 @@ list(APPEND SOURCE config.c debug_ros.c isinf.c + isfinite.c isnan.c loader.c ${REACTOS_SOURCE_DIR}/lib/sdk/crt/string/wctype.c diff --git a/reactos/lib/3rdparty/libwine/isfinite.c b/reactos/lib/3rdparty/libwine/isfinite.c new file mode 100644 index 00000000000..9909f6d294e --- /dev/null +++ b/reactos/lib/3rdparty/libwine/isfinite.c @@ -0,0 +1,46 @@ +/* + * isfinite function + * + * Copyright 2013 Francois Gouget + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include "wine/port.h" + +#if !defined(HAVE_ISFINITE) && !defined(isfinite) + +#ifdef HAVE_IEEEFP_H +#include + +int isfinite(double x) +{ + return finite(x); +} + +#elif defined(HAVE_FLOAT_H) && defined(HAVE__FINITE) +#include + +int isfinite(double x) +{ + return _finite(x); +} + +#else +#error No isfinite() implementation available. +#endif + +#endif /* !defined(HAVE_ISFINITE) && !defined(isfinite) */ diff --git a/reactos/lib/3rdparty/libwine/isinf.c b/reactos/lib/3rdparty/libwine/isinf.c index baef611b0eb..4a97f37f6ce 100644 --- a/reactos/lib/3rdparty/libwine/isinf.c +++ b/reactos/lib/3rdparty/libwine/isinf.c @@ -21,7 +21,7 @@ #include "config.h" #include "wine/port.h" -#if !defined(HAVE_ISINF) && !defined(_ISINF) && !defined(isinf) +#if !defined(HAVE_ISINF) && !defined(isinf) #ifdef HAVE_IEEEFP_H #include @@ -43,4 +43,4 @@ int isinf(double x) #error No isinf() implementation available. #endif -#endif /* !defined(HAVE_ISINF) && !defined(_ISINF) && !defined(isinf) */ +#endif /* !defined(HAVE_ISINF) && !defined(isinf) */ diff --git a/reactos/lib/3rdparty/libwine/isnan.c b/reactos/lib/3rdparty/libwine/isnan.c index 50445a1e956..1025b651925 100644 --- a/reactos/lib/3rdparty/libwine/isnan.c +++ b/reactos/lib/3rdparty/libwine/isnan.c @@ -21,7 +21,7 @@ #include "config.h" #include "wine/port.h" -#if !defined(HAVE_ISNAN) && !defined(_ISNAN) && !defined(isnan) +#if !defined(HAVE_ISNAN) && !defined(isnan) #ifdef HAVE_IEEEFP_H #include @@ -43,4 +43,4 @@ int isnan(double x) #error No isnan() implementation available. #endif -#endif /* !defined(HAVE_ISNAN) && !defined(_ISNAN) && !defined(isnan) */ +#endif /* !defined(HAVE_ISNAN) && !defined(isnan) */ -- 2.17.1