| 1 | /* RetroArch - A frontend for libretro. |
| 2 | * Copyright (C) 2010-2012 - Hans-Kristian Arntzen |
| 3 | * |
| 4 | * RetroArch is free software: you can redistribute it and/or modify it under the terms |
| 5 | * of the GNU General Public License as published by the Free Software Found- |
| 6 | * ation, either version 3 of the License, or (at your option) any later version. |
| 7 | * |
| 8 | * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 9 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 10 | * PURPOSE. See the GNU General Public License for more details. |
| 11 | * |
| 12 | * You should have received a copy of the GNU General Public License along with RetroArch. |
| 13 | * If not, see <http://www.gnu.org/licenses/>. |
| 14 | */ |
| 15 | |
| 16 | #ifndef __RARCH_MSVC_COMPAT_H |
| 17 | #define __RARCH_MSVC_COMPAT_H |
| 18 | |
| 19 | #ifdef _MSC_VER |
| 20 | |
| 21 | #undef UNICODE // Do not bother with UNICODE at this time. |
| 22 | #include <stddef.h> |
| 23 | #include <io.h> |
| 24 | #include <math.h> |
| 25 | |
| 26 | // Python headers defines ssize_t and sets HAVE_SSIZE_T. Cannot duplicate these efforts. |
| 27 | #ifndef HAVE_SSIZE_T |
| 28 | #if defined(_WIN64) |
| 29 | typedef __int64 ssize_t; |
| 30 | #elif defined(_WIN32) |
| 31 | typedef int ssize_t; |
| 32 | #endif |
| 33 | #endif |
| 34 | |
| 35 | #define snprintf _snprintf |
| 36 | #define strtoll _strtoi64 |
| 37 | #define strtoull _strtoui64 |
| 38 | #define strcasecmp _stricmp |
| 39 | #define strncasecmp _strnicmp |
| 40 | #define strdup _strdup |
| 41 | #define lseek _lseek |
| 42 | |
| 43 | #include <tchar.h> |
| 44 | #define strlen _tcslen |
| 45 | |
| 46 | # define S_IRUSR S_IREAD /* read, user */ |
| 47 | # define S_IWUSR S_IWRITE /* write, user */ |
| 48 | |
| 49 | // Disable some of the annoying warnings. |
| 50 | #pragma warning(disable : 4800) |
| 51 | #pragma warning(disable : 4244) |
| 52 | #pragma warning(disable : 4305) |
| 53 | #pragma warning(disable : 4146) |
| 54 | #pragma warning(disable : 4267) |
| 55 | |
| 56 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) |
| 57 | |
| 58 | #ifndef PATH_MAX |
| 59 | #define PATH_MAX MAX_PATH |
| 60 | #endif |
| 61 | |
| 62 | #endif |
| 63 | #endif |
| 64 |