Piotr Caban : msvcrt: Use _Dcomplex definition from public header.

Alexandre Julliard julliard at winehq.org
Fri Dec 4 14:36:03 CST 2020


Module: wine
Branch: master
Commit: 494a78940735ab31bef9a8ae1d5e58175667df37
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=494a78940735ab31bef9a8ae1d5e58175667df37

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Dec  4 15:50:01 2020 +0100

msvcrt: Use _Dcomplex definition from public header.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c       |  7 ++++---
 dlls/msvcrt/msvcrt.h     |  2 --
 include/Makefile.in      |  1 +
 include/msvcrt/complex.h | 27 +++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 84f08544092..f9327659f98 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -35,6 +35,7 @@
  * ====================================================
  */
 
+#include <complex.h>
 #include <stdio.h>
 #include <fenv.h>
 #include <fpieee.h>
@@ -4177,14 +4178,14 @@ double CDECL _except1(DWORD fpe, _FP_OPERATION_CODE op, double arg, double res,
 
 _Dcomplex* CDECL _Cbuild(_Dcomplex *ret, double r, double i)
 {
-    ret->x = r;
-    ret->y = i;
+    ret->_Val[0] = r;
+    ret->_Val[1] = i;
     return ret;
 }
 
 double CDECL MSVCR120_creal(_Dcomplex z)
 {
-    return z.x;
+    return z._Val[0];
 }
 
 /*********************************************************************
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 26cb5fee996..b26d736cb18 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -283,8 +283,6 @@ extern unsigned msvcrt_create_io_inherit_block(WORD*, BYTE**) DECLSPEC_HIDDEN;
 
 extern FILE MSVCRT__iob[];
 
-typedef struct _complex _Dcomplex;
-
 #ifdef __i386__
 struct MSVCRT___JUMP_BUFFER {
     unsigned long Ebp;
diff --git a/include/Makefile.in b/include/Makefile.in
index a84e44998cc..9b6858b78f9 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -443,6 +443,7 @@ SOURCES = \
 	mstask.idl \
 	mstcpip.h \
 	msvcrt/assert.h \
+	msvcrt/complex.h \
 	msvcrt/conio.h \
 	msvcrt/corecrt.h \
 	msvcrt/corecrt_startup.h \
diff --git a/include/msvcrt/complex.h b/include/msvcrt/complex.h
new file mode 100644
index 00000000000..2d7009c470c
--- /dev/null
+++ b/include/msvcrt/complex.h
@@ -0,0 +1,27 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the Wine project.
+ */
+
+#ifndef _COMPLEX_H_DEFINED
+#define _COMPLEX_H_DEFINED
+
+#include <corecrt.h>
+
+#ifndef _C_COMPLEX_T
+#define _C_COMPLEX_T
+typedef struct _C_double_complex
+{
+    double _Val[2];
+} _C_double_complex;
+
+typedef struct _C_float_complex
+{
+    float _Val[2];
+} _C_float_complex;
+#endif
+
+typedef _C_double_complex _Dcomplex;
+typedef _C_float_complex _Fcomplex;
+
+#endif /* _COMPLEX_H_DEFINED */




More information about the wine-cvs mailing list