Blame gl/msvc-nothrow.c

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