|
| 1 | +/* |
| 2 | + * PROJECT: ReactOS msvcrt.dll |
| 3 | + * LICENSE: MIT (https://spdx.org/licenses/MIT) |
| 4 | + * PURPOSE: POSIX/large-file CRT names expected by a modern mingw-w64 |
| 5 | + * libstdc++ (e.g. GCC 16). The real mingw CRT (msvcrt/ucrt) |
| 6 | + * exports these; ReactOS only shipped the _-prefixed Win32 |
| 7 | + * variants, so provide thin forwarders here. Consumed by C++ |
| 8 | + * modules that link the real libstdc++ (e.g. its std::basic_file). |
| 9 | + */ |
| 10 | + |
| 11 | +#include <stdio.h> |
| 12 | +#include <io.h> |
| 13 | +#include <string.h> |
| 14 | +#include <ctype.h> |
| 15 | +#include <sys/stat.h> |
| 16 | +#include <msvcrt.h> |
| 17 | + |
| 18 | +__int64 __cdecl lseek64(int _FileHandle, __int64 _Offset, int _Origin) |
| 19 | +{ |
| 20 | + return _lseeki64(_FileHandle, _Offset, _Origin); |
| 21 | +} |
| 22 | + |
| 23 | +int __cdecl fstat64(int _FileHandle, struct _stat64 *_Stat) |
| 24 | +{ |
| 25 | + return _fstat64(_FileHandle, _Stat); |
| 26 | +} |
| 27 | + |
| 28 | +int __cdecl fseeko64(FILE *_File, __int64 _Offset, int _Origin) |
| 29 | +{ |
| 30 | + return _fseeki64(_File, _Offset, _Origin); |
| 31 | +} |
| 32 | + |
| 33 | +__int64 __cdecl ftello64(FILE *_File) |
| 34 | +{ |
| 35 | + return _ftelli64(_File); |
| 36 | +} |
| 37 | + |
| 38 | +/* |
| 39 | + * wctype() maps a character-class name to a mask usable with iswctype(). |
| 40 | + * msvcrt's ctype.c only compiles it for _MSVCR_VER >= 120, but a modern |
| 41 | + * libstdc++ imports it from msvcrt.dll, so provide it here for plain msvcrt. |
| 42 | + */ |
| 43 | +#if _MSVCR_VER < 120 |
| 44 | +unsigned short __cdecl wctype(const char *_Property) |
| 45 | +{ |
| 46 | + static const struct { const char *name; unsigned short mask; } properties[] = |
| 47 | + { |
| 48 | + { "alnum", _DIGIT | _ALPHA }, |
| 49 | + { "alpha", _ALPHA }, |
| 50 | + { "cntrl", _CONTROL }, |
| 51 | + { "digit", _DIGIT }, |
| 52 | + { "graph", _DIGIT | _PUNCT | _ALPHA }, |
| 53 | + { "lower", _LOWER }, |
| 54 | + { "print", _DIGIT | _PUNCT | _BLANK | _ALPHA }, |
| 55 | + { "punct", _PUNCT }, |
| 56 | + { "space", _SPACE }, |
| 57 | + { "upper", _UPPER }, |
| 58 | + { "xdigit", _HEX }, |
| 59 | + }; |
| 60 | + unsigned int i; |
| 61 | + |
| 62 | + for (i = 0; i < sizeof(properties) / sizeof(properties[0]); i++) |
| 63 | + { |
| 64 | + if (strcmp(_Property, properties[i].name) == 0) |
| 65 | + return properties[i].mask; |
| 66 | + } |
| 67 | + |
| 68 | + return 0; |
| 69 | +} |
| 70 | +#endif /* _MSVCR_VER < 120 */ |
0 commit comments