[REACTOS] Use standard conforming names

- Use _alloca instead of non-standard alloca
- Use _TCHAR instead of non-standard TCHAR
- Use _off_t instead of deprecated off_t
- Use _O_BINARY instead of O_BINARY
This commit is contained in:
Timo Kreuzer 2024-05-12 19:47:18 +03:00
parent 1de09c477c
commit b707be90a1
10 changed files with 41 additions and 40 deletions

View file

@ -150,7 +150,7 @@ typedef struct _ENUMFILES_CTX
static BOOL static BOOL
EnumFilesWorker( EnumFilesWorker(
_Inout_ PENUMFILES_CTX EnumCtx, _Inout_ PENUMFILES_CTX EnumCtx,
_Inout_ off_t offFilePart) // Offset to the file name inside FullPathBuffer _Inout_ _off_t offFilePart) // Offset to the file name inside FullPathBuffer
{ {
BOOL bFound = FALSE; BOOL bFound = FALSE;
HRESULT hRes; HRESULT hRes;

View file

@ -278,7 +278,7 @@ ident_len(LPCTSTR p)
#define PARSE_IDENT(ident, identlen, p) \ #define PARSE_IDENT(ident, identlen, p) \
do { \ do { \
identlen = ident_len(p); \ identlen = ident_len(p); \
ident = (LPTSTR)alloca((identlen + 1) * sizeof(TCHAR)); \ ident = (LPTSTR)_alloca((identlen + 1) * sizeof(TCHAR)); \
memmove(ident, p, identlen * sizeof(TCHAR)); \ memmove(ident, p, identlen * sizeof(TCHAR)); \
ident[identlen] = 0; \ ident[identlen] = 0; \
p += identlen; \ p += identlen; \
@ -681,7 +681,7 @@ evaluate:
return FALSE; return FALSE;
} }
buf = (LPTSTR)alloca(32 * sizeof(TCHAR)); buf = (LPTSTR)_alloca(32 * sizeof(TCHAR));
_sntprintf(buf, 32, _T("%i"), identval); _sntprintf(buf, 32, _T("%i"), identval);
SetEnvironmentVariable(ident, buf); // TODO FIXME - check return value SetEnvironmentVariable(ident, buf); // TODO FIXME - check return value
exprval = identval; exprval = identval;

View file

@ -872,7 +872,7 @@ HRESULT WINAPI CFSFolder::ParseDisplayName(HWND hwndOwner,
else else
{ {
INT cchElement = lstrlenW(lpszDisplayName) + 1; INT cchElement = lstrlenW(lpszDisplayName) + 1;
LPWSTR pszElement = (LPWSTR)alloca(cchElement * sizeof(WCHAR)); LPWSTR pszElement = (LPWSTR)_alloca(cchElement * sizeof(WCHAR));
LPWSTR pchNext = lpszDisplayName; LPWSTR pchNext = lpszDisplayName;
hr = Shell_NextElement(&pchNext, pszElement, cchElement, TRUE); hr = Shell_NextElement(&pchNext, pszElement, cchElement, TRUE);
if (FAILED(hr)) if (FAILED(hr))

View file

@ -5,7 +5,7 @@
* PURPOSE: Concatenates STDIN or an arbitrary number of files to STDOUT * PURPOSE: Concatenates STDIN or an arbitrary number of files to STDOUT
* PROGRAMMERS: David Welch * PROGRAMMERS: David Welch
* Semyon Novikov (tappak) * Semyon Novikov (tappak)
* Hermès Bélusca - Maïto * Hermès Bélusca - Maïto
*/ */
#include <stdio.h> #include <stdio.h>
@ -54,7 +54,7 @@ int main(int argc, char* argv[])
} }
/* Set STDOUT to binary */ /* Set STDOUT to binary */
_setmode(_fileno(stdout), O_BINARY); _setmode(_fileno(stdout), _O_BINARY);
/* Special case where we run 'cat' without any argument: we use STDIN */ /* Special case where we run 'cat' without any argument: we use STDIN */
if (argc <= 1) if (argc <= 1)
@ -62,7 +62,7 @@ int main(int argc, char* argv[])
unsigned int ch; unsigned int ch;
/* Set STDIN to binary */ /* Set STDIN to binary */
_setmode(_fileno(stdin), O_BINARY); _setmode(_fileno(stdin), _O_BINARY);
#if 0 // Version using feof() #if 0 // Version using feof()
ch = fgetc(stdin); ch = fgetc(stdin);

View file

@ -26,8 +26,8 @@ extern "C" {
#define FTRUNCATE_DEFINED #define FTRUNCATE_DEFINED
/* This is defined as a real library function to allow autoconf /* This is defined as a real library function to allow autoconf
to verify its existence. */ to verify its existence. */
int ftruncate(int, off_t); int ftruncate(int, _off_t);
__CRT_INLINE int ftruncate(int __fd, off_t __length) __CRT_INLINE int ftruncate(int __fd, _off_t __length)
{ {
return _chsize (__fd, __length); return _chsize (__fd, __length);
} }

View file

@ -91,6 +91,7 @@ struct statfs;
# endif /* defined(__BEOS__) */ # endif /* defined(__BEOS__) */
#endif /* !defined(HAVE_STATFS) */ #endif /* !defined(HAVE_STATFS) */
struct stat;
/**************************************************************** /****************************************************************
* Macro definitions * Macro definitions

View file

@ -22,7 +22,7 @@
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
int __cdecl _tstreamout(FILE *stream, const TCHAR *format, va_list argptr); int __cdecl _tstreamout(FILE *stream, const _TCHAR *format, va_list argptr);
int int
#if defined(USER32_WSPRINTF) && defined(_M_IX86) #if defined(USER32_WSPRINTF) && defined(_M_IX86)
@ -31,14 +31,14 @@ __stdcall
__cdecl __cdecl
#endif #endif
_sxprintf( _sxprintf(
TCHAR *buffer, _TCHAR *buffer,
#if IS_SECAPI #if IS_SECAPI
size_t sizeOfBuffer, size_t sizeOfBuffer,
#endif #endif
#if USE_COUNT #if USE_COUNT
size_t count, size_t count,
#endif #endif
const TCHAR *format, const _TCHAR *format,
#if USE_VARARGS #if USE_VARARGS
va_list argptr) va_list argptr)
#else #else
@ -74,7 +74,7 @@ _sxprintf(
stream._base = (char*)buffer; stream._base = (char*)buffer;
stream._ptr = stream._base; stream._ptr = stream._base;
stream._charbuf = 0; stream._charbuf = 0;
stream._cnt = (int)(sizeOfBuffer * sizeof(TCHAR)); stream._cnt = (int)(sizeOfBuffer * sizeof(_TCHAR));
stream._bufsiz = 0; stream._bufsiz = 0;
stream._flag = _IOSTRG | _IOWRT; stream._flag = _IOSTRG | _IOWRT;
stream._tmpfname = 0; stream._tmpfname = 0;
@ -112,8 +112,8 @@ _sxprintf(
buffer[result] = _T('\0'); buffer[result] = _T('\0');
#else #else
/* Only zero terminate if there is enough space left */ /* Only zero terminate if there is enough space left */
if ((stream._cnt >= sizeof(TCHAR)) && (stream._ptr)) if ((stream._cnt >= sizeof(_TCHAR)) && (stream._ptr))
*(TCHAR*)stream._ptr = _T('\0'); *(_TCHAR*)stream._ptr = _T('\0');
#endif #endif
return result; return result;

View file

@ -80,18 +80,18 @@ void
__declspec(noinline) __declspec(noinline)
#endif #endif
format_float( format_float(
TCHAR chr, _TCHAR chr,
unsigned int flags, unsigned int flags,
int precision, int precision,
TCHAR **string, _TCHAR **string,
const TCHAR **prefix, const _TCHAR **prefix,
va_list *argptr) va_list *argptr)
{ {
static const TCHAR digits_l[] = _T("0123456789abcdef0x"); static const _TCHAR digits_l[] = _T("0123456789abcdef0x");
static const TCHAR digits_u[] = _T("0123456789ABCDEF0X"); static const _TCHAR digits_u[] = _T("0123456789ABCDEF0X");
static const TCHAR _nan[] = _T("#QNAN"); static const _TCHAR _nan[] = _T("#QNAN");
static const TCHAR _infinity[] = _T("#INF"); static const _TCHAR _infinity[] = _T("#INF");
const TCHAR *digits = digits_l; const _TCHAR *digits = digits_l;
int exponent = 0, sign; int exponent = 0, sign;
long double fpval, fpval2; long double fpval, fpval2;
int padding = 0, num_digits, val32, base = 10; int padding = 0, num_digits, val32, base = 10;
@ -186,13 +186,13 @@ format_float(
/* Handle special cases first */ /* Handle special cases first */
if (_isnan(fpval)) if (_isnan(fpval))
{ {
(*string) -= sizeof(_nan) / sizeof(TCHAR) - 1; (*string) -= sizeof(_nan) / sizeof(_TCHAR) - 1;
_tcscpy((*string), _nan); _tcscpy((*string), _nan);
fpval2 = 1; fpval2 = 1;
} }
else if (!_finite(fpval)) else if (!_finite(fpval))
{ {
(*string) -= sizeof(_infinity) / sizeof(TCHAR) - 1; (*string) -= sizeof(_infinity) / sizeof(_TCHAR) - 1;
_tcscpy((*string), _infinity); _tcscpy((*string), _infinity);
fpval2 = 1; fpval2 = 1;
} }
@ -234,16 +234,16 @@ streamout_char(FILE *stream, int chr)
#endif #endif
#if defined(_USER32_WSPRINTF) || defined(_LIBCNT_) #if defined(_USER32_WSPRINTF) || defined(_LIBCNT_)
/* Check if the buffer is full */ /* Check if the buffer is full */
if (stream->_cnt < sizeof(TCHAR)) if (stream->_cnt < sizeof(_TCHAR))
return 0; return 0;
*(TCHAR*)stream->_ptr = chr; *(_TCHAR*)stream->_ptr = chr;
stream->_ptr += sizeof(TCHAR); stream->_ptr += sizeof(_TCHAR);
stream->_cnt -= sizeof(TCHAR); stream->_cnt -= sizeof(_TCHAR);
return 1; return 1;
#else #else
return _fputtc((TCHAR)chr, stream) != _TEOF; return _fputtc((_TCHAR)chr, stream) != _TEOF;
#endif #endif
} }
@ -251,7 +251,7 @@ static
int int
streamout_astring(FILE *stream, const char *string, size_t count) streamout_astring(FILE *stream, const char *string, size_t count)
{ {
TCHAR chr; _TCHAR chr;
int written = 0; int written = 0;
#if !defined(_USER32_WSPRINTF) #if !defined(_USER32_WSPRINTF)
@ -323,15 +323,15 @@ streamout_wstring(FILE *stream, const wchar_t *string, size_t count)
int int
__cdecl __cdecl
streamout(FILE *stream, const TCHAR *format, va_list argptr) streamout(FILE *stream, const _TCHAR *format, va_list argptr)
{ {
static const TCHAR digits_l[] = _T("0123456789abcdef0x"); static const _TCHAR digits_l[] = _T("0123456789abcdef0x");
static const TCHAR digits_u[] = _T("0123456789ABCDEF0X"); static const _TCHAR digits_u[] = _T("0123456789ABCDEF0X");
static const char *_nullstring = "(null)"; static const char *_nullstring = "(null)";
TCHAR buffer[BUFFER_SIZE + 1]; _TCHAR buffer[BUFFER_SIZE + 1];
TCHAR chr, *string; _TCHAR chr, *string;
STRING *nt_string; STRING *nt_string;
const TCHAR *digits, *prefix; const _TCHAR *digits, *prefix;
int base, fieldwidth, precision, padding; int base, fieldwidth, precision, padding;
size_t prefixlen, len; size_t prefixlen, len;
int written = 1, written_all = 0; int written = 1, written_all = 0;
@ -534,7 +534,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr)
case_string: case_string:
if (!string) if (!string)
{ {
string = (TCHAR*)_nullstring; string = (_TCHAR*)_nullstring;
flags &= ~FLAG_WIDECHAR; flags &= ~FLAG_WIDECHAR;
} }

View file

@ -211,7 +211,7 @@ __tmainCRTStartup (void)
/* We need to make sure that this function is build with frame-pointer /* We need to make sure that this function is build with frame-pointer
and that we align the stack to 16 bytes for the sake of SSE ops in main and that we align the stack to 16 bytes for the sake of SSE ops in main
or in functions inlined into main. */ or in functions inlined into main. */
lpszCommandLine = (_TCHAR *) alloca (32); lpszCommandLine = (_TCHAR *) _alloca (32);
memset (lpszCommandLine, 0xcc, 32); memset (lpszCommandLine, 0xcc, 32);
#ifdef __GNUC__ #ifdef __GNUC__
asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); asm __volatile__ ("andl $-16, %%esp" : : : "%esp");

View file

@ -464,7 +464,7 @@ _pei386_runtime_relocator (void)
++was_init; ++was_init;
#ifdef __MINGW64_VERSION_MAJOR #ifdef __MINGW64_VERSION_MAJOR
mSecs = __mingw_GetSectionCount (); mSecs = __mingw_GetSectionCount ();
the_secs = (sSecInfo *) alloca (sizeof (sSecInfo) * (size_t) mSecs); the_secs = (sSecInfo *) _alloca (sizeof (sSecInfo) * (size_t) mSecs);
maxSections = 0; maxSections = 0;
#endif /* __MINGW64_VERSION_MAJOR */ #endif /* __MINGW64_VERSION_MAJOR */