Author: jgardou
Date: Sat Dec  8 17:44:38 2012
New Revision: 57823
URL: 
http://svn.reactos.org/svn/reactos?rev=57823&view=rev
Log:
[MSVCRT]
 - Properly implement and export _fpcontrol_s
Modified:
    trunk/reactos/dll/win32/msvcrt/msvcrt.spec
    trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c
Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.sp…
==============================================================================
--- trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msvcrt/msvcrt.spec [iso-8859-1] Sat Dec  8 17:44:38 2012
@@ -302,7 +302,7 @@
 @ extern _commode
 @ cdecl _control87(long long)
 @ cdecl _controlfp(long long)
-# @ cdecl _controlfp_s(ptr long long)
+@ cdecl _controlfp_s(ptr long long)
 @ cdecl _copysign( double double )
 @ varargs _cprintf(str)
 # stub _cprintf_l
Modified: trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/i386/cnt…
==============================================================================
--- trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] Sat Dec  8 17:44:38 2012
@@ -120,15 +120,15 @@
 int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
 {
 #ifdef __i386__
-    unsigned int flags;
+    unsigned int val;
-    FIXME("(%p %u %u) semi-stub\n", cur, newval, mask);
-
-    flags = _control87( newval, mask & ~_EM_DENORMAL );
-
-    if(cur)
-        *cur = flags;
-
+    if (!MSVCRT_CHECK_PMT( !(newval & mask & ~(_MCW_EM | _MCW_IC | _MCW_RC |
_MCW_PC | _MCW_DN))))
+    {
+        if (cur) *cur = _controlfp( 0, 0 );  /* retrieve it anyway */
+        return MSVCRT_EINVAL;
+    }
+    val = _controlfp( newval, mask );
+    if (cur) *cur = val;
     return 0;
 #else
     FIXME(":Not Implemented!\n");