Blame gl/msvc-nothrow.c

Packit Service 4684c1
/* Wrappers that don't throw invalid parameter notifications
Packit Service 4684c1
   with MSVC runtime libraries.
Packit Service 4684c1
   Copyright (C) 2011-2020 Free Software Foundation, Inc.
Packit Service 4684c1
Packit Service 4684c1
   This program is free software; you can redistribute it and/or modify
Packit Service 4684c1
   it under the terms of the GNU Lesser General Public License as published by
Packit Service 4684c1
   the Free Software Foundation; either version 2.1, or (at your option)
Packit Service 4684c1
   any later version.
Packit Service 4684c1
Packit Service 4684c1
   This program is distributed in the hope that it will be useful,
Packit Service 4684c1
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 4684c1
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 4684c1
   GNU Lesser General Public License for more details.
Packit Service 4684c1
Packit Service 4684c1
   You should have received a copy of the GNU Lesser General Public License along
Packit Service 4684c1
   with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit Service 4684c1
Packit Service 4684c1
#include <config.h>
Packit Service 4684c1
Packit Service 4684c1
/* Specification.  */
Packit Service 4684c1
#include "msvc-nothrow.h"
Packit Service 4684c1
Packit Service 4684c1
/* Get declarations of the native Windows API functions.  */
Packit Service 4684c1
#define WIN32_LEAN_AND_MEAN
Packit Service 4684c1
#include <windows.h>
Packit Service 4684c1
Packit Service 4684c1
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
Packit Service 4684c1
# include "msvc-inval.h"
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#undef _get_osfhandle
Packit Service 4684c1
Packit Service 4684c1
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
Packit Service 4684c1
intptr_t
Packit Service 4684c1
_gl_nothrow_get_osfhandle (int fd)
Packit Service 4684c1
{
Packit Service 4684c1
  intptr_t result;
Packit Service 4684c1
Packit Service 4684c1
  TRY_MSVC_INVAL
Packit Service 4684c1
    {
Packit Service 4684c1
      result = _get_osfhandle (fd);
Packit Service 4684c1
    }
Packit Service 4684c1
  CATCH_MSVC_INVAL
Packit Service 4684c1
    {
Packit Service 4684c1
      result = (intptr_t) INVALID_HANDLE_VALUE;
Packit Service 4684c1
    }
Packit Service 4684c1
  DONE_MSVC_INVAL;
Packit Service 4684c1
Packit Service 4684c1
  return result;
Packit Service 4684c1
}
Packit Service 4684c1
#endif