diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index bb78b1739bd..5d04ade62c4 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -1,6 +1,6 @@ - + . include @@ -56,6 +56,12 @@ chkstk_asm.s + + + seh.s + chkstk_asm.s + + xcptfil.c @@ -75,6 +81,14 @@ statfp.c + + + clearfp.c + cntrlfp.c + logb.c + statfp.c + + locale.c @@ -112,8 +126,15 @@ log10_asm.s - - + + + atan2.c + exp.c + fmod.c + ldexp.c + + + diff --git a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s new file mode 100644 index 00000000000..be54983f1cb --- /dev/null +++ b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s @@ -0,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Stack checker + * FILE: lib/ntdll/rtl/i386/chkstk.s + * PROGRAMER: + */ + +.globl _chkstk +.globl _alloca_probe + +/* + _chkstk() is called by all stack allocations of more than 4 KB. It grows the + stack in areas of 4 KB each, trying to access each area. This ensures that the + guard page for the stack is hit, and the stack growing triggered + */ +_chkstk: +_alloca_probe: + /* return */ + ret + +/* EOF */ diff --git a/reactos/lib/sdk/crt/except/amd64/seh.s b/reactos/lib/sdk/crt/except/amd64/seh.s new file mode 100644 index 00000000000..3f814078697 --- /dev/null +++ b/reactos/lib/sdk/crt/except/amd64/seh.s @@ -0,0 +1,84 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/crt/misc/i386/seh.S + * PURPOSE: SEH Support for the CRT + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +.intel_syntax noprefix + +#define DISPOSITION_DISMISS 0 +#define DISPOSITION_CONTINUE_SEARCH 1 +#define DISPOSITION_COLLIDED_UNWIND 3 + +/* GLOBALS *******************************************************************/ + +.globl __global_unwind2 +.globl __local_unwind2 +.globl __abnormal_termination +.globl __except_handler2 +.globl __except_handler3 + +/* FUNCTIONS *****************************************************************/ + +.func unwind_handler +_unwind_handler: + ret +.endfunc + +.func _global_unwind2 +__global_unwind2: + ret +.endfunc + +.func _abnormal_termination +__abnormal_termination: + ret +.endfunc + +.func _local_unwind2 +__local_unwind2: + ret +.endfunc + +.func _except_handler2 +__except_handler2: + ret +.endfunc + +.func _except_handler3 +__except_handler3: + ret +.endfunc + +// +// +// REMOVE ME REMOVE ME REMOVE ME REMOVE ME REMOVE ME REMOVE ME REMOVE ME +// +// +.func RtlpGetStackLimits@8 +.globl _RtlpGetStackLimits@8 +_RtlpGetStackLimits@8: + + /* Get the current thread */ + mov eax, [fs:KPCR_CURRENT_THREAD] + + /* Get the stack limits */ + mov ecx, [eax+KTHREAD_STACK_LIMIT] + mov edx, [eax+KTHREAD_INITIAL_STACK] + sub edx, SIZEOF_FX_SAVE_AREA + + /* Return them */ + mov eax, [esp+4] + mov [eax], ecx + + mov eax, [esp+8] + mov [eax], edx + + /* return */ + ret 8 +.endfunc diff --git a/reactos/lib/sdk/crt/process/process.c b/reactos/lib/sdk/crt/process/process.c index 99b3208ea87..1fe8dfbc546 100644 --- a/reactos/lib/sdk/crt/process/process.c +++ b/reactos/lib/sdk/crt/process/process.c @@ -323,7 +323,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env /* * @implemented */ -int _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) +intptr_t _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) { va_list argp; _TCHAR* args; @@ -345,7 +345,7 @@ int _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) /* * @implemented */ -int _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) +intptr_t _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) { _TCHAR* args; int ret = -1; @@ -365,7 +365,7 @@ int _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) /* * @implemented */ -int _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL, const char* const* envp*/) +intptr_t _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL, const char* const* envp*/) { va_list argp; _TCHAR* args; @@ -400,7 +400,7 @@ int _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL, /* * @implemented */ -int _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { _TCHAR *args; _TCHAR *envs; @@ -426,7 +426,7 @@ int _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const /* * @implemented */ -int _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv) { _TCHAR pathname[FILENAME_MAX]; @@ -438,7 +438,7 @@ int _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv) /* * @implemented */ -int _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/) +intptr_t _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/) { va_list argp; _TCHAR* args; @@ -461,7 +461,7 @@ int _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/ /* * @implemented */ -int _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL, const char* const* envp*/) +intptr_t _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL, const char* const* envp*/) { va_list argp; _TCHAR* args; @@ -496,7 +496,7 @@ int _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL, /* * @implemented */ -int _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { _TCHAR pathname[FILENAME_MAX]; @@ -508,7 +508,7 @@ int _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const /* * @implemented */ -int _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) +intptr_t _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; @@ -530,7 +530,7 @@ int _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) /* * @implemented */ -int _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv) { TRACE(MK_STR(_texecv)"('%"sT"')\n", cmdname); return _tspawnv(P_OVERLAY, cmdname, argv); @@ -539,7 +539,7 @@ int _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv) /* * @implemented */ -int _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) +intptr_t _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) { va_list argp; _TCHAR* args; @@ -573,7 +573,7 @@ int _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* cons /* * @implemented */ -int _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { TRACE(MK_STR(_texecve)"('%"sT"')\n", cmdname); return _tspawnve(P_OVERLAY, cmdname, argv, envp); @@ -582,7 +582,7 @@ int _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* con /* * @implemented */ -int _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) +intptr_t _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; @@ -605,7 +605,7 @@ int _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) /* * @implemented */ -int _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv) { TRACE(MK_STR(_texecvp)"('%"sT"')\n", cmdname); return _tspawnvp(P_OVERLAY, cmdname, argv); @@ -614,7 +614,7 @@ int _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv) /* * @implemented */ -int _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) +intptr_t _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) { va_list argp; _TCHAR* args; @@ -649,7 +649,7 @@ int _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* con /* * @implemented */ -int _texecvpe(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _texecvpe(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { TRACE(MK_STR(_texecvpe)"('%"sT"')\n", cmdname); return _tspawnvpe(P_OVERLAY, cmdname, argv, envp); diff --git a/reactos/lib/sdk/crt/stdio/file.c b/reactos/lib/sdk/crt/stdio/file.c index e0ded79f21e..a092e6246dd 100644 --- a/reactos/lib/sdk/crt/stdio/file.c +++ b/reactos/lib/sdk/crt/stdio/file.c @@ -132,21 +132,7 @@ static CRITICAL_SECTION FILE_cs; #define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0) -static void stat64_to_stat(const struct __stat64 *buf64, struct _stat *buf) -{ - buf->st_dev = buf64->st_dev; - buf->st_ino = buf64->st_ino; - buf->st_mode = buf64->st_mode; - buf->st_nlink = buf64->st_nlink; - buf->st_uid = buf64->st_uid; - buf->st_gid = buf64->st_gid; - buf->st_rdev = buf64->st_rdev; - buf->st_size = buf64->st_size; - buf->st_atime = buf64->st_atime; - buf->st_mtime = buf64->st_mtime; - buf->st_ctime = buf64->st_ctime; -} - +#ifndef _WIN64 static void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf) { buf->st_dev = buf64->st_dev; @@ -161,6 +147,7 @@ static void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf buf->st_mtime = buf64->st_mtime; buf->st_ctime = buf64->st_ctime; } +#endif static inline BOOL is_valid_fd(int fd) { @@ -494,7 +481,7 @@ static void int_to_base32(int num, char *str) */ FILE * CDECL __p__iob(void) { - return &_iob[0]; + return _iob; } /********************************************************************* @@ -1165,7 +1152,7 @@ int CDECL _fileno(FILE* file) /********************************************************************* * _fstat64 (MSVCRT.@) */ -int CDECL _fstat64(int fd, struct __stat64* buf) +int CDECL _fstat64(int fd, struct _stat64* buf) { DWORD dw; DWORD type; @@ -1238,14 +1225,60 @@ int CDECL _fstati64(int fd, struct _stati64* buf) /********************************************************************* * _fstat (MSVCRT.@) */ -int CDECL _fstat(int fd, struct _stat* buf) -{ int ret; - struct __stat64 buf64; +int CDECL _fstat(int fd, struct _stat32* buf) +{ + DWORD dw; + DWORD type; + BY_HANDLE_FILE_INFORMATION hfi; + HANDLE hand = fdtoh(fd); - ret = _fstat64(fd, &buf64); - if (!ret) - stat64_to_stat(&buf64, buf); - return ret; + TRACE(":fd (%d) stat (%p)\n",fd,buf); + if (hand == INVALID_HANDLE_VALUE) + return -1; + + if (!buf) + { + WARN(":failed-NULL buf\n"); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + + memset(&hfi, 0, sizeof(hfi)); + memset(buf, 0, sizeof(struct _stat32)); + type = GetFileType(hand); + if (type == FILE_TYPE_PIPE) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFIFO; + buf->st_nlink = 1; + } + else if (type == FILE_TYPE_CHAR) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFCHR; + buf->st_nlink = 1; + } + else /* FILE_TYPE_DISK etc. */ + { + if (!GetFileInformationByHandle(hand, &hfi)) + { + WARN(":failed-last error (%d)\n",GetLastError()); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + buf->st_mode = S_IFREG | S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + buf->st_nlink = hfi.nNumberOfLinks; + } + TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); + return 0; } /********************************************************************* @@ -1286,7 +1319,7 @@ int CDECL _futime(int fd, struct _utimbuf *t) /********************************************************************* * _get_osfhandle (MSVCRT.@) */ -long CDECL _get_osfhandle(int fd) +intptr_t CDECL _get_osfhandle(int fd) { HANDLE hand = fdtoh(fd); TRACE(":fd (%d) handle (%p)\n",fd,hand); @@ -1641,7 +1674,7 @@ int CDECL _wcreat(const wchar_t *path, int flags) /********************************************************************* * _open_osfhandle (MSVCRT.@) */ -int CDECL _open_osfhandle(long handle, int oflags) +int CDECL _open_osfhandle(intptr_t handle, int oflags) { int fd; @@ -1879,14 +1912,67 @@ int CDECL _stati64(const char* path, struct _stati64 * buf) /********************************************************************* * _stat (MSVCRT.@) */ -int CDECL _stat(const char* path, struct _stat * buf) -{ int ret; - struct __stat64 buf64; +int CDECL _stat32(const char* path, struct _stat32 * buf) +{ + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; - ret = _stat64( path, &buf64); - if (!ret) - stat64_to_stat(&buf64, buf); - return ret; + TRACE(":file (%s) buf(%p)\n",path,buf); + + if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(struct _stat32)); + + /* FIXME: rdev isn't drive num, despite what the docs say-what is it? + Bon 011120: This FIXME seems incorrect + Also a letter as first char isn't enough to be classified + as a drive letter + */ + if (isalpha(*path)&& (*(path+1)==':')) + buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + + plen = strlen(path); + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { + unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | + (tolower(path[plen-3]) << 16); + if (ext == EXE || ext == BAT || ext == CMD || ext == COM) + mode |= ALL_S_IEXEC; + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; } /********************************************************************* @@ -1968,14 +2054,63 @@ int CDECL _wstati64(const wchar_t* path, struct _stati64 * buf) /********************************************************************* * _wstat (MSVCRT.@) */ -int CDECL _wstat(const wchar_t* path, struct _stat * buf) +int CDECL _wstat32(const wchar_t* path, struct _stat32 * buf) { - int ret; - struct __stat64 buf64; + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; - ret = _wstat64( path, &buf64 ); - if (!ret) stat64_to_stat(&buf64, buf); - return ret; + TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf); + + if (!GetFileAttributesExW(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(struct _stat32)); + + /* FIXME: rdev isn't drive num, despite what the docs says-what is it? */ + if (iswalpha(*path)) + buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + + plen = strlenW(path); + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { + ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | + ((ULONGLONG)tolowerW(path[plen-3]) << 32); + if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) + mode |= ALL_S_IEXEC; + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; } /********************************************************************* diff --git a/reactos/lib/sdk/crt/stdio/find.c b/reactos/lib/sdk/crt/stdio/find.c index 590ddc3f3a5..8f602a4de97 100644 --- a/reactos/lib/sdk/crt/stdio/find.c +++ b/reactos/lib/sdk/crt/stdio/find.c @@ -1,6 +1,6 @@ #include #include - +#include /* * @implemented */ diff --git a/reactos/lib/sdk/crt/stdlib/errno.c b/reactos/lib/sdk/crt/stdlib/errno.c index 633267eddd1..3a8d76e1be6 100644 --- a/reactos/lib/sdk/crt/stdlib/errno.c +++ b/reactos/lib/sdk/crt/stdlib/errno.c @@ -13,9 +13,9 @@ /* * @implemented */ -int* __doserrno(void) +unsigned long* __doserrno(void) { - return (int*)(&GetThreadData()->tdoserrno); + return (unsigned long*)(&GetThreadData()->tdoserrno); } /* diff --git a/reactos/lib/sdk/crt/stdlib/getenv.c b/reactos/lib/sdk/crt/stdlib/getenv.c index 0427351a6e7..0f5fb4396cb 100644 --- a/reactos/lib/sdk/crt/stdlib/getenv.c +++ b/reactos/lib/sdk/crt/stdlib/getenv.c @@ -9,7 +9,7 @@ */ #include -#undef environ +//#undef environ /* * @implemented diff --git a/reactos/lib/sdk/crt/stdlib/rot.c b/reactos/lib/sdk/crt/stdlib/rot.c index c1fbc73260c..7502fb74fe2 100644 --- a/reactos/lib/sdk/crt/stdlib/rot.c +++ b/reactos/lib/sdk/crt/stdlib/rot.c @@ -10,6 +10,7 @@ #include +unsigned int _rotr( unsigned int value, int shift ); /* * @implemented */ diff --git a/reactos/lib/sdk/crt/stdlib/swab.c b/reactos/lib/sdk/crt/stdlib/swab.c index f3cfba3fba7..e0e8cb78af8 100644 --- a/reactos/lib/sdk/crt/stdlib/swab.c +++ b/reactos/lib/sdk/crt/stdlib/swab.c @@ -15,8 +15,7 @@ * * copy this swab from wine cvs 2006-05-24 */ -void _swab (const char * src, char * dst, size_t sizeToCopy - ) +void _swab (char * src, char * dst, int sizeToCopy) { if (sizeToCopy > 1) diff --git a/reactos/lib/sdk/crt/string/atol.c b/reactos/lib/sdk/crt/string/atol.c index 9aa3af57d87..459446151c4 100644 --- a/reactos/lib/sdk/crt/string/atol.c +++ b/reactos/lib/sdk/crt/string/atol.c @@ -11,9 +11,9 @@ _ttol(const _TCHAR *str) return (long)_ttoi64(str); } -int _atoldbl(long double *value, const char *str) +int _atoldbl(_LDOUBLE *value, char *str) { /* FIXME needs error checking for huge/small values */ //*value = strtold(str,0); - return 0; + return -1; } diff --git a/reactos/lib/sdk/crt/string/ctype.c b/reactos/lib/sdk/crt/string/ctype.c index 46870724404..2606a39d9f8 100644 --- a/reactos/lib/sdk/crt/string/ctype.c +++ b/reactos/lib/sdk/crt/string/ctype.c @@ -4,6 +4,7 @@ #include #undef _pctype +#undef _pwctype /* MS's CRT header defines all that, and we actually implement that */ #undef iswalnum @@ -22,11 +23,13 @@ #undef iswspace #undef iswxdigit #undef __toascii +#undef _tolower +#undef _toupper #define upalpha ('A' - 'a') -unsigned short _ctype[] = { +const unsigned short _ctype[] = { 0, /* , 0xFFFF */ _CONTROL, /* CTRL+@, 0x00 */ _CONTROL, /* CTRL+A, 0x01 */ @@ -545,7 +548,7 @@ int iswxdigit(wint_t c) */ int __toascii(int c) { - return((unsigned)(c) & 0x7f); + return((unsigned int)(c) & 0x7f); } /* diff --git a/reactos/lib/sdk/crt/string/scanf.c b/reactos/lib/sdk/crt/string/scanf.c index e0ba480eb67..4e6c9bb1558 100644 --- a/reactos/lib/sdk/crt/string/scanf.c +++ b/reactos/lib/sdk/crt/string/scanf.c @@ -24,8 +24,6 @@ */ #include - -#include #include // HACK for LIBCNT @@ -183,7 +181,7 @@ int swscanf(const wchar_t *str, const wchar_t *format, ...) /********************************************************************* * _cscanf (MSVCRT.@) */ -int _cscanf(/*const*/ char *format, ...) +int _cscanf(const char *format, ...) { va_list valist; int res; diff --git a/reactos/lib/sdk/crt/time/ctime.c b/reactos/lib/sdk/crt/time/ctime.c index 822003b9fc4..a3ed572d380 100644 --- a/reactos/lib/sdk/crt/time/ctime.c +++ b/reactos/lib/sdk/crt/time/ctime.c @@ -1450,12 +1450,12 @@ __p__tzname(void) /********************************************************************* * _dstbias (MSVCRT.@) */ -int _dstbias = 0; +long _dstbias = 0; /********************************************************************* * __p_dstbias (MSVCRT.@) */ -int * __p__dstbias(void) +long * __p__dstbias(void) { return &_dstbias; } diff --git a/reactos/lib/sdk/crt/time/difftime.c b/reactos/lib/sdk/crt/time/difftime.c index bd3b2215fa6..07889acd8c6 100644 --- a/reactos/lib/sdk/crt/time/difftime.c +++ b/reactos/lib/sdk/crt/time/difftime.c @@ -5,7 +5,7 @@ * @implemented */ double -difftime(time_t time1, time_t time0) +difftime(time_t time1, time_t time2) { - return time1-time0; + return (double)(time1 - time2); }