https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b707be90a193b12e84c219d121662adc21b15827
commit b707be90a193b12e84c219d121662adc21b15827 Author: Timo Kreuzer <timo.kreu...@reactos.org> AuthorDate: Sun May 12 19:47:18 2024 +0300 Commit: Timo Kreuzer <timo.kreu...@reactos.org> CommitDate: Sun Oct 20 14:12:25 2024 +0300 [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 --- base/applications/cmdutils/attrib/attrib.c | 2 +- base/shell/cmd/set.c | 4 +-- dll/win32/shell32/folders/CFSFolder.cpp | 2 +- modules/rosapps/applications/cmdutils/cat/cat.c | 6 ++-- sdk/include/crt/unistd.h | 4 +-- sdk/include/reactos/wine/port.h | 1 + sdk/lib/crt/printf/_sxprintf.c | 12 +++---- sdk/lib/crt/printf/streamout.c | 46 ++++++++++++------------- sdk/lib/crt/startup/crtexe.c | 2 +- sdk/lib/crt/startup/pseudo-reloc.c | 2 +- 10 files changed, 41 insertions(+), 40 deletions(-) diff --git a/base/applications/cmdutils/attrib/attrib.c b/base/applications/cmdutils/attrib/attrib.c index 6b0fb8f9bb8..80945d72fab 100644 --- a/base/applications/cmdutils/attrib/attrib.c +++ b/base/applications/cmdutils/attrib/attrib.c @@ -150,7 +150,7 @@ typedef struct _ENUMFILES_CTX static BOOL EnumFilesWorker( _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; HRESULT hRes; diff --git a/base/shell/cmd/set.c b/base/shell/cmd/set.c index 32ac0a8ed0c..321c62844c7 100644 --- a/base/shell/cmd/set.c +++ b/base/shell/cmd/set.c @@ -278,7 +278,7 @@ ident_len(LPCTSTR p) #define PARSE_IDENT(ident, identlen, p) \ do { \ identlen = ident_len(p); \ - ident = (LPTSTR)alloca((identlen + 1) * sizeof(TCHAR)); \ + ident = (LPTSTR)_alloca((identlen + 1) * sizeof(TCHAR)); \ memmove(ident, p, identlen * sizeof(TCHAR)); \ ident[identlen] = 0; \ p += identlen; \ @@ -681,7 +681,7 @@ evaluate: return FALSE; } - buf = (LPTSTR)alloca(32 * sizeof(TCHAR)); + buf = (LPTSTR)_alloca(32 * sizeof(TCHAR)); _sntprintf(buf, 32, _T("%i"), identval); SetEnvironmentVariable(ident, buf); // TODO FIXME - check return value exprval = identval; diff --git a/dll/win32/shell32/folders/CFSFolder.cpp b/dll/win32/shell32/folders/CFSFolder.cpp index 25e4a021928..4943eeba0f1 100644 --- a/dll/win32/shell32/folders/CFSFolder.cpp +++ b/dll/win32/shell32/folders/CFSFolder.cpp @@ -872,7 +872,7 @@ HRESULT WINAPI CFSFolder::ParseDisplayName(HWND hwndOwner, else { INT cchElement = lstrlenW(lpszDisplayName) + 1; - LPWSTR pszElement = (LPWSTR)alloca(cchElement * sizeof(WCHAR)); + LPWSTR pszElement = (LPWSTR)_alloca(cchElement * sizeof(WCHAR)); LPWSTR pchNext = lpszDisplayName; hr = Shell_NextElement(&pchNext, pszElement, cchElement, TRUE); if (FAILED(hr)) diff --git a/modules/rosapps/applications/cmdutils/cat/cat.c b/modules/rosapps/applications/cmdutils/cat/cat.c index 75d66c2d79a..cf725aa8c68 100644 --- a/modules/rosapps/applications/cmdutils/cat/cat.c +++ b/modules/rosapps/applications/cmdutils/cat/cat.c @@ -5,7 +5,7 @@ * PURPOSE: Concatenates STDIN or an arbitrary number of files to STDOUT * PROGRAMMERS: David Welch * Semyon Novikov (tappak) - * Herm�s B�lusca - Ma�to + * Hermès Bélusca - Maïto */ #include <stdio.h> @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) } /* 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 */ if (argc <= 1) @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) unsigned int ch; /* Set STDIN to binary */ - _setmode(_fileno(stdin), O_BINARY); + _setmode(_fileno(stdin), _O_BINARY); #if 0 // Version using feof() ch = fgetc(stdin); diff --git a/sdk/include/crt/unistd.h b/sdk/include/crt/unistd.h index 6b66da395cd..ec9e6a4e9e1 100644 --- a/sdk/include/crt/unistd.h +++ b/sdk/include/crt/unistd.h @@ -26,8 +26,8 @@ extern "C" { #define FTRUNCATE_DEFINED /* This is defined as a real library function to allow autoconf to verify its existence. */ -int ftruncate(int, off_t); -__CRT_INLINE int ftruncate(int __fd, off_t __length) +int ftruncate(int, _off_t); +__CRT_INLINE int ftruncate(int __fd, _off_t __length) { return _chsize (__fd, __length); } diff --git a/sdk/include/reactos/wine/port.h b/sdk/include/reactos/wine/port.h index e7ce4ed2555..a10d6c53b43 100644 --- a/sdk/include/reactos/wine/port.h +++ b/sdk/include/reactos/wine/port.h @@ -91,6 +91,7 @@ struct statfs; # endif /* defined(__BEOS__) */ #endif /* !defined(HAVE_STATFS) */ +struct stat; /**************************************************************** * Macro definitions diff --git a/sdk/lib/crt/printf/_sxprintf.c b/sdk/lib/crt/printf/_sxprintf.c index 0e9d35f978f..198a083d885 100644 --- a/sdk/lib/crt/printf/_sxprintf.c +++ b/sdk/lib/crt/printf/_sxprintf.c @@ -22,7 +22,7 @@ #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 #if defined(USER32_WSPRINTF) && defined(_M_IX86) @@ -31,14 +31,14 @@ __stdcall __cdecl #endif _sxprintf( - TCHAR *buffer, + _TCHAR *buffer, #if IS_SECAPI size_t sizeOfBuffer, #endif #if USE_COUNT size_t count, #endif - const TCHAR *format, + const _TCHAR *format, #if USE_VARARGS va_list argptr) #else @@ -74,7 +74,7 @@ _sxprintf( stream._base = (char*)buffer; stream._ptr = stream._base; stream._charbuf = 0; - stream._cnt = (int)(sizeOfBuffer * sizeof(TCHAR)); + stream._cnt = (int)(sizeOfBuffer * sizeof(_TCHAR)); stream._bufsiz = 0; stream._flag = _IOSTRG | _IOWRT; stream._tmpfname = 0; @@ -112,8 +112,8 @@ _sxprintf( buffer[result] = _T('\0'); #else /* Only zero terminate if there is enough space left */ - if ((stream._cnt >= sizeof(TCHAR)) && (stream._ptr)) - *(TCHAR*)stream._ptr = _T('\0'); + if ((stream._cnt >= sizeof(_TCHAR)) && (stream._ptr)) + *(_TCHAR*)stream._ptr = _T('\0'); #endif return result; diff --git a/sdk/lib/crt/printf/streamout.c b/sdk/lib/crt/printf/streamout.c index 36bc7a31182..d3b7a3d8b63 100644 --- a/sdk/lib/crt/printf/streamout.c +++ b/sdk/lib/crt/printf/streamout.c @@ -80,18 +80,18 @@ void __declspec(noinline) #endif format_float( - TCHAR chr, + _TCHAR chr, unsigned int flags, int precision, - TCHAR **string, - const TCHAR **prefix, + _TCHAR **string, + const _TCHAR **prefix, va_list *argptr) { - static const TCHAR digits_l[] = _T("0123456789abcdef0x"); - static const TCHAR digits_u[] = _T("0123456789ABCDEF0X"); - static const TCHAR _nan[] = _T("#QNAN"); - static const TCHAR _infinity[] = _T("#INF"); - const TCHAR *digits = digits_l; + static const _TCHAR digits_l[] = _T("0123456789abcdef0x"); + static const _TCHAR digits_u[] = _T("0123456789ABCDEF0X"); + static const _TCHAR _nan[] = _T("#QNAN"); + static const _TCHAR _infinity[] = _T("#INF"); + const _TCHAR *digits = digits_l; int exponent = 0, sign; long double fpval, fpval2; int padding = 0, num_digits, val32, base = 10; @@ -186,13 +186,13 @@ format_float( /* Handle special cases first */ if (_isnan(fpval)) { - (*string) -= sizeof(_nan) / sizeof(TCHAR) - 1; + (*string) -= sizeof(_nan) / sizeof(_TCHAR) - 1; _tcscpy((*string), _nan); fpval2 = 1; } else if (!_finite(fpval)) { - (*string) -= sizeof(_infinity) / sizeof(TCHAR) - 1; + (*string) -= sizeof(_infinity) / sizeof(_TCHAR) - 1; _tcscpy((*string), _infinity); fpval2 = 1; } @@ -234,16 +234,16 @@ streamout_char(FILE *stream, int chr) #endif #if defined(_USER32_WSPRINTF) || defined(_LIBCNT_) /* Check if the buffer is full */ - if (stream->_cnt < sizeof(TCHAR)) + if (stream->_cnt < sizeof(_TCHAR)) return 0; - *(TCHAR*)stream->_ptr = chr; - stream->_ptr += sizeof(TCHAR); - stream->_cnt -= sizeof(TCHAR); + *(_TCHAR*)stream->_ptr = chr; + stream->_ptr += sizeof(_TCHAR); + stream->_cnt -= sizeof(_TCHAR); return 1; #else - return _fputtc((TCHAR)chr, stream) != _TEOF; + return _fputtc((_TCHAR)chr, stream) != _TEOF; #endif } @@ -251,7 +251,7 @@ static int streamout_astring(FILE *stream, const char *string, size_t count) { - TCHAR chr; + _TCHAR chr; int written = 0; #if !defined(_USER32_WSPRINTF) @@ -323,15 +323,15 @@ streamout_wstring(FILE *stream, const wchar_t *string, size_t count) int __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_u[] = _T("0123456789ABCDEF0X"); + static const _TCHAR digits_l[] = _T("0123456789abcdef0x"); + static const _TCHAR digits_u[] = _T("0123456789ABCDEF0X"); static const char *_nullstring = "(null)"; - TCHAR buffer[BUFFER_SIZE + 1]; - TCHAR chr, *string; + _TCHAR buffer[BUFFER_SIZE + 1]; + _TCHAR chr, *string; STRING *nt_string; - const TCHAR *digits, *prefix; + const _TCHAR *digits, *prefix; int base, fieldwidth, precision, padding; size_t prefixlen, len; int written = 1, written_all = 0; @@ -534,7 +534,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) case_string: if (!string) { - string = (TCHAR*)_nullstring; + string = (_TCHAR*)_nullstring; flags &= ~FLAG_WIDECHAR; } diff --git a/sdk/lib/crt/startup/crtexe.c b/sdk/lib/crt/startup/crtexe.c index 2b5922f98c5..f433a070f45 100644 --- a/sdk/lib/crt/startup/crtexe.c +++ b/sdk/lib/crt/startup/crtexe.c @@ -211,7 +211,7 @@ __tmainCRTStartup (void) /* 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 or in functions inlined into main. */ - lpszCommandLine = (_TCHAR *) alloca (32); + lpszCommandLine = (_TCHAR *) _alloca (32); memset (lpszCommandLine, 0xcc, 32); #ifdef __GNUC__ asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); diff --git a/sdk/lib/crt/startup/pseudo-reloc.c b/sdk/lib/crt/startup/pseudo-reloc.c index dd32ae584da..6eb7f63be00 100644 --- a/sdk/lib/crt/startup/pseudo-reloc.c +++ b/sdk/lib/crt/startup/pseudo-reloc.c @@ -464,7 +464,7 @@ _pei386_runtime_relocator (void) ++was_init; #ifdef __MINGW64_VERSION_MAJOR mSecs = __mingw_GetSectionCount (); - the_secs = (sSecInfo *) alloca (sizeof (sSecInfo) * (size_t) mSecs); + the_secs = (sSecInfo *) _alloca (sizeof (sSecInfo) * (size_t) mSecs); maxSections = 0; #endif /* __MINGW64_VERSION_MAJOR */