libport: Add a finite() portability macro and use it.

Francois Gouget fgouget at free.fr
Mon Nov 25 05:50:09 CST 2013


---

This fixes compilation on Solaris machines.

 dlls/msvcrt/math.c   | 11 +----------
 dlls/wined3d/utils.c |  2 +-
 include/wine/port.h  | 10 ++++++++++
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 68b0dfe..bbe4c52 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #include "config.h"
+#include "wine/port.h"
 
 #include <stdio.h>
 #define __USE_ISOC9X 1
@@ -33,16 +34,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
 
-#ifndef HAVE_FINITE
-#ifndef finite /* Could be a macro */
-#ifdef isfinite
-#define finite(x) isfinite(x)
-#else
-#define finite(x) (!isnan(x)) /* At least catch some cases */
-#endif
-#endif
-#endif
-
 #ifndef signbit
 #define signbit(x) 0
 #endif
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index c37b677..433065a 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3816,7 +3816,7 @@ void wined3d_ftoa(float value, char *s)
         ++idx;
 
     sprintf(s, "%.8e", value);
-    if (isfinite(value))
+    if (finite(value))
         s[idx] = '.';
 }
 
diff --git a/include/wine/port.h b/include/wine/port.h
index c5359dd..2fd4215 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -268,6 +268,16 @@ int isinf(double x);
 int isnan(double x);
 #endif
 
+#ifndef HAVE_FINITE
+#ifndef finite /* Could be a macro */
+#ifdef isfinite
+#define finite(x) isfinite(x)
+#else
+#define finite(x) (!isnan(x)) /* At least catch some cases */
+#endif
+#endif
+#endif
+
 #ifndef HAVE_LSTAT
 int lstat(const char *file_name, struct stat *buf);
 #endif /* HAVE_LSTAT */
-- 
1.8.4.2



More information about the wine-patches mailing list