Commit 4dba956e authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Add parameter checking in _controlfp_s.

parent 1ae23af8
...@@ -909,12 +909,7 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask) ...@@ -909,12 +909,7 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
*/ */
unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask) unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
{ {
#ifdef __i386__
return _control87( newval, mask & ~MSVCRT__EM_DENORMAL ); return _control87( newval, mask & ~MSVCRT__EM_DENORMAL );
#else
FIXME(":Not Implemented!\n");
return 0;
#endif
} }
/********************************************************************* /*********************************************************************
...@@ -922,21 +917,16 @@ unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask) ...@@ -922,21 +917,16 @@ unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
*/ */
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask) int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
{ {
#ifdef __i386__ static const unsigned int all_flags = (MSVCRT__MCW_EM | MSVCRT__MCW_IC | MSVCRT__MCW_RC |
unsigned int flags; MSVCRT__MCW_PC | MSVCRT__MCW_DN);
FIXME("(%p %u %u) semi-stub\n", cur, newval, mask);
flags = _control87( newval, mask & ~MSVCRT__EM_DENORMAL );
if(cur) if (!MSVCRT_CHECK_PMT(cur != NULL) || !MSVCRT_CHECK_PMT( !(mask & ~all_flags) ))
*cur = flags; {
*MSVCRT__errno() = MSVCRT_EINVAL;
return 0; return MSVCRT_EINVAL;
#else }
FIXME(":Not Implemented!\n"); *cur = _controlfp( newval, mask );
return 0; return 0;
#endif
} }
/********************************************************************* /*********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment