diff --git a/reactos/lib/crtdll/malloc/expand.c b/reactos/lib/crtdll/malloc/expand.c index 321330b097b..408757f6c1f 100644 --- a/reactos/lib/crtdll/malloc/expand.c +++ b/reactos/lib/crtdll/malloc/expand.c @@ -1,44 +1,42 @@ #include #include -#include -#include +#include +#include -void *_expand( void *pold, size_t size ) +void* _expand(void* pold, size_t size) { PHEAP_BUCKET pbucket; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE); + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE); /* sanity checks */ - if(pfrag->Magic!=HEAP_FRAG_MAGIC) + if (pfrag->Magic != HEAP_FRAG_MAGIC) return NULL; /* get bucket size */ - psub=pfrag->Sub; - pbucket=psub->Bucket; - if(size<=pbucket->Size) - { + psub = pfrag->Sub; + pbucket = psub->Bucket; + if(size <= pbucket->Size) { pfrag->Size=size; return pold; } else - return NULL; - + return NULL; return NULL; } -size_t _msize (void* pBlock) +size_t _msize(void* pBlock) { PHEAP_BUCKET pbucket; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE); + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE); /* sanity checks */ - if(pfrag->Magic!=HEAP_FRAG_MAGIC) + if (pfrag->Magic != HEAP_FRAG_MAGIC) return 0; /* get bucket size */ - psub=pfrag->Sub; - pbucket=psub->Bucket; + psub = pfrag->Sub; + pbucket = psub->Bucket; return pbucket->Size; } diff --git a/reactos/lib/crtdll/malloc/heap.c b/reactos/lib/crtdll/malloc/heap.c index 11d9907eb16..5737e7555f7 100644 --- a/reactos/lib/crtdll/malloc/heap.c +++ b/reactos/lib/crtdll/malloc/heap.c @@ -1,29 +1,30 @@ #include -#include +#include -int _heapchk (void) +int _heapchk(void) { if (!HeapValidate(GetProcessHeap(), 0, NULL)) return -1; return 0; } -int _heapmin (void) + +int _heapmin(void) { - if ( !HeapCompact( GetProcessHeap(), 0 )) + if (!HeapCompact(GetProcessHeap(), 0)) return -1; return 0; } -int _heapset (unsigned int unFill) + +int _heapset(unsigned int unFill) { - if ( _heapchk() == -1 ) + if (_heapchk() == -1) return -1; return 0; } - -int _heapwalk ( struct _heapinfo *entry) +int _heapwalk(struct _heapinfo* entry) { return 0; } diff --git a/reactos/lib/crtdll/math/acos.c b/reactos/lib/crtdll/math/acos.c index 776ddd2534a..23376a6116c 100644 --- a/reactos/lib/crtdll/math/acos.c +++ b/reactos/lib/crtdll/math/acos.c @@ -18,9 +18,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include -double acos (double __x) + +double acos(double __x) { - return atan2 (sqrt (1.0 - __x * __x), __x); + return atan2(sqrt(1.0 - __x * __x), __x); } diff --git a/reactos/lib/crtdll/math/acosh.c b/reactos/lib/crtdll/math/acosh.c index 15f556cbc96..cb1dbed706b 100644 --- a/reactos/lib/crtdll/math/acosh.c +++ b/reactos/lib/crtdll/math/acosh.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -double -acosh(double x) + +double acosh(double x) { - return log(x + sqrt(x*x - 1)); + return log(x + sqrt(x*x - 1)); } diff --git a/reactos/lib/crtdll/math/asin.c b/reactos/lib/crtdll/math/asin.c index 410981127a2..fa57df2850c 100644 --- a/reactos/lib/crtdll/math/asin.c +++ b/reactos/lib/crtdll/math/asin.c @@ -18,9 +18,10 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include -double asin (double __x) + +double asin(double __x) { - return atan2 (__x, sqrt (1.0 - __x * __x)); + return atan2(__x, sqrt(1.0 - __x * __x)); } diff --git a/reactos/lib/crtdll/math/asinh.c b/reactos/lib/crtdll/math/asinh.c index 7089ebcf64a..402c46e9b92 100644 --- a/reactos/lib/crtdll/math/asinh.c +++ b/reactos/lib/crtdll/math/asinh.c @@ -1,9 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -double -asinh(double x) + +double asinh(double x) { - return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x); + return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x); } - diff --git a/reactos/lib/crtdll/math/atanh.c b/reactos/lib/crtdll/math/atanh.c index fdfb3194cf9..ee1228826ad 100644 --- a/reactos/lib/crtdll/math/atanh.c +++ b/reactos/lib/crtdll/math/atanh.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -double -atanh(double x) + +double atanh(double x) { return log((1+x)/(1-x)) / 2.0; } diff --git a/reactos/lib/crtdll/math/cosh.c b/reactos/lib/crtdll/math/cosh.c index 85e95f088ac..10fadd67ec2 100644 --- a/reactos/lib/crtdll/math/cosh.c +++ b/reactos/lib/crtdll/math/cosh.c @@ -1,8 +1,9 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include + double cosh(double x) { - const double ebig = exp(fabs(x)); - return (ebig + 1.0/ebig) / 2.0; + const double ebig = exp(fabs(x)); + return (ebig + 1.0/ebig) / 2.0; } diff --git a/reactos/lib/crtdll/math/j0_y0.c b/reactos/lib/crtdll/math/j0_y0.c index 7512077a5d7..83035eea002 100644 --- a/reactos/lib/crtdll/math/j0_y0.c +++ b/reactos/lib/crtdll/math/j0_y0.c @@ -1,4 +1,5 @@ -#include +#include + double _j0(double x) { diff --git a/reactos/lib/crtdll/math/j1_y1.c b/reactos/lib/crtdll/math/j1_y1.c index 90e2fb1a5b4..55d6bd62a6f 100644 --- a/reactos/lib/crtdll/math/j1_y1.c +++ b/reactos/lib/crtdll/math/j1_y1.c @@ -1,4 +1,5 @@ -#include +#include + double _j1(double x) { diff --git a/reactos/lib/crtdll/math/jn_yn.c b/reactos/lib/crtdll/math/jn_yn.c index b641a81dc07..8a3c833ad24 100644 --- a/reactos/lib/crtdll/math/jn_yn.c +++ b/reactos/lib/crtdll/math/jn_yn.c @@ -1,4 +1,5 @@ -#include +#include + double _jn(int n, double x) { diff --git a/reactos/lib/crtdll/math/stubs.c b/reactos/lib/crtdll/math/stubs.c index 65b601026a4..57eb090db01 100644 --- a/reactos/lib/crtdll/math/stubs.c +++ b/reactos/lib/crtdll/math/stubs.c @@ -1,84 +1,85 @@ -#include - -double _CIsin (double x); -double _CIcos (double x); -double _CItan (double x); -double _CIsinh (double x); -double _CIcosh (double x); -double _CItanh (double x); -double _CIasin (double x); -double _CIacos (double x); -double _CIatan (double x); -double _CIatan2 (double y, double x); -double _CIexp (double x); -double _CIlog (double x); -double _CIlog10 (double x); -double _CIpow (double x, double y); -double _CIsqrt (double x); -double _CIfmod (double x, double y); +#include -double _CIsin (double x) +double _CIsin(double x); +double _CIcos(double x); +double _CItan(double x); +double _CIsinh(double x); +double _CIcosh(double x); +double _CItanh(double x); +double _CIasin(double x); +double _CIacos(double x); +double _CIatan(double x); +double _CIatan2(double y, double x); +double _CIexp(double x); +double _CIlog(double x); +double _CIlog10(double x); +double _CIpow(double x, double y); +double _CIsqrt(double x); +double _CIfmod(double x, double y); + + +double _CIsin(double x) { return sin(x); } -double _CIcos (double x) +double _CIcos(double x) { return cos(x); } -double _CItan (double x) +double _CItan(double x) { return tan(x); } -double _CIsinh (double x) +double _CIsinh(double x) { return sinh(x); } -double _CIcosh (double x) +double _CIcosh(double x) { return cosh(x); } -double _CItanh (double x) +double _CItanh(double x) { return tanh(x); } -double _CIasin (double x) +double _CIasin(double x) { return asin(x); } -double _CIacos (double x) +double _CIacos(double x) { return acos(x); } -double _CIatan (double x) +double _CIatan(double x) { return atan(x); } -double _CIatan2 (double y, double x) +double _CIatan2(double y, double x) { - return atan2(y,x); + return atan2(y, x); } -double _CIexp (double x) +double _CIexp(double x) { return exp(x); } -double _CIlog (double x) +double _CIlog(double x) { return log(x); } -double _CIlog10 (double x) +double _CIlog10(double x) { return log10(x); } -double _CIpow (double x, double y) +double _CIpow(double x, double y) { - return pow(x,y); + return pow(x, y); } -double _CIsqrt (double x) +double _CIsqrt(double x) { return sqrt(x); } -double _CIfmod (double x, double y) +double _CIfmod(double x, double y) { - return fmod(x,y); + return fmod(x, y); } diff --git a/reactos/lib/crtdll/mbstring/ischira.c b/reactos/lib/crtdll/mbstring/ischira.c index 87a22361875..0b6ca56d165 100644 --- a/reactos/lib/crtdll/mbstring/ischira.c +++ b/reactos/lib/crtdll/mbstring/ischira.c @@ -8,25 +8,26 @@ * 12/04/99: Created */ -#include -#include +#include +#include -int _ismbchira( unsigned int c ) + +int _ismbchira(unsigned int c) { return ((c>=0x829F) && (c<=0x82F1)); } -int _ismbckata( unsigned int c ) +int _ismbckata(unsigned int c) { return ((c>=0x8340) && (c<=0x8396)); } -unsigned int _mbctohira( unsigned int c ) +unsigned int _mbctohira(unsigned int c) { return c; } -unsigned int _mbctokata( unsigned int c ) +unsigned int _mbctokata(unsigned int c) { return c; } diff --git a/reactos/lib/crtdll/mbstring/ismbpun.c b/reactos/lib/crtdll/mbstring/ismbpun.c index eb418e44190..0575693977c 100644 --- a/reactos/lib/crtdll/mbstring/ismbpun.c +++ b/reactos/lib/crtdll/mbstring/ismbpun.c @@ -1,10 +1,8 @@ - //iskana() :(0xA1 <= c <= 0xDF) - //iskpun() :(0xA1 <= c <= 0xA6) - //iskmoji() :(0xA7 <= c <= 0xDF) -#include -#include -#include +#include +#include +#include + int _ismbbpunct(unsigned char c) { @@ -12,3 +10,6 @@ int _ismbbpunct(unsigned char c) return (ispunct(c) || _ismbbkana(c)); } + //iskana() :(0xA1 <= c <= 0xDF) + //iskpun() :(0xA1 <= c <= 0xA6) + //iskmoji() :(0xA7 <= c <= 0xDF) diff --git a/reactos/lib/crtdll/mbstring/mbsnicmp.c b/reactos/lib/crtdll/mbstring/mbsnicmp.c index 49c7c3fc791..93f6b491409 100644 --- a/reactos/lib/crtdll/mbstring/mbsnicmp.c +++ b/reactos/lib/crtdll/mbstring/mbsnicmp.c @@ -1,15 +1,17 @@ -#include +#include + size_t _mbclen2(const unsigned int s); unsigned int _mbbtoupper(unsigned int c); -int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n) + +int _mbsnicmp(const unsigned char* s1, const unsigned char* s2, size_t n) { if (n == 0) return 0; do { if (_mbbtoupper(*s1) != _mbbtoupper(*s2)) - return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2); + return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2); s1 += _mbclen2(*s1); s2 += _mbclen2(*s2); @@ -21,13 +23,13 @@ int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n) return 0; } -int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n) +int _mbsnbicmp(const unsigned char* s1, const unsigned char* s2, size_t n) { if (n == 0) return 0; do { if (_mbbtoupper(*s1) != _mbbtoupper(*s2)) - return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2); + return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2); s1 += _mbclen2(*s1); s2 += _mbclen2(*s2); diff --git a/reactos/lib/crtdll/misc/dllcrt1.c b/reactos/lib/crtdll/misc/dllcrt1.c index 02c2b91fd78..908012bedca 100644 --- a/reactos/lib/crtdll/misc/dllcrt1.c +++ b/reactos/lib/crtdll/misc/dllcrt1.c @@ -20,17 +20,18 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: ariadne $ - * $Date: 1999/04/02 21:43:56 $ + * $Revision: 1.3 $ + * $Author: robd $ + * $Date: 2002/11/29 12:27:48 $ * */ -#include -#include -#include +#include +#include +#include #include + /* See note in crt0.c */ #include "init.c" @@ -46,12 +47,11 @@ extern void __do_global_dtors(); extern BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID); BOOL WINAPI -DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved) +DllMainCRTStartup(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) { BOOL bRet; - if (dwReason == DLL_PROCESS_ATTACH) - { + if (dwReason == DLL_PROCESS_ATTACH) { _mingw32_init_mainargs(); #ifdef __GNUC__ @@ -68,8 +68,7 @@ DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved) bRet = DllMain(hDll, dwReason, lpReserved); #ifdef __GNUC__ - if (dwReason == DLL_PROCESS_DETACH) - { + if (dwReason == DLL_PROCESS_DETACH) { /* From libgcc.a, calls global class destructors. */ __do_global_dtors(); } @@ -87,7 +86,7 @@ DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved) * Thanks to Andrey A. Smirnov for pointing this one out. */ int -atexit (void (*pfn)()) +atexit(void (*pfn)()) { return 0; } diff --git a/reactos/lib/crtdll/misc/gccmain.c b/reactos/lib/crtdll/misc/gccmain.c index 49bb6db858f..73bc9c259b0 100644 --- a/reactos/lib/crtdll/misc/gccmain.c +++ b/reactos/lib/crtdll/misc/gccmain.c @@ -11,23 +11,23 @@ * Contributors: * Code supplied by Stan Cox * - * $Revision: 1.2 $ - * $Author: ariadne $ - * $Date: 1999/04/02 21:43:56 $ + * $Revision: 1.3 $ + * $Author: robd $ + * $Date: 2002/11/29 12:27:48 $ * */ /* Needed for the atexit prototype. */ -#include +#include + typedef void (*func_ptr) (void); extern func_ptr __CTOR_LIST__[]; extern func_ptr __DTOR_LIST__[]; -void -__do_global_dtors (void) +void __do_global_dtors(void) { - static func_ptr *p = __DTOR_LIST__ + 1; + static func_ptr* p = __DTOR_LIST__ + 1; /* * Call each destructor in the destructor list until a null pointer @@ -40,10 +40,9 @@ __do_global_dtors (void) } } -void -__do_global_ctors (void) +void __do_global_ctors(void) { - unsigned long nptrs = (unsigned long) __CTOR_LIST__[0]; + unsigned long nptrs = (unsigned long)__CTOR_LIST__[0]; unsigned i; /* @@ -51,8 +50,7 @@ __do_global_ctors (void) * is terminated with a null entry. Otherwise the first entry was * the number of pointers in the list. */ - if (nptrs == -1) - { + if (nptrs == -1) { for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++) ; } @@ -60,24 +58,21 @@ __do_global_ctors (void) /* * Go through the list backwards calling constructors. */ - for (i = nptrs; i >= 1; i--) - { + for (i = nptrs; i >= 1; i--) { __CTOR_LIST__[i] (); } /* * Register the destructors for processing on exit. */ - atexit (__do_global_dtors); + atexit(__do_global_dtors); } static int initialized = 0; -void -__main (void) +void __main(void) { - if (! initialized) - { + if (!initialized) { initialized = 1; __do_global_ctors (); } diff --git a/reactos/lib/crtdll/misc/main.c b/reactos/lib/crtdll/misc/main.c index a539f7edfc8..aa080bc043b 100644 --- a/reactos/lib/crtdll/misc/main.c +++ b/reactos/lib/crtdll/misc/main.c @@ -20,27 +20,26 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: ariadne $ - * $Date: 1999/04/02 21:43:56 $ + * $Revision: 1.3 $ + * $Author: robd $ + * $Date: 2002/11/29 12:27:48 $ * */ -#include -#include +#include +#include #include + #define ISSPACE(a) (a == ' ' || a == '\t') -extern int PASCAL WinMain (HANDLE hInst, HANDLE hPrevInst, LPSTR szCmdLine, - int nShow); +extern int PASCAL WinMain (HANDLE hInst, HANDLE hPrevInst, LPSTR szCmdLine, int nShow); -int -main (int argc, char* argv[], char* environ[]) +int main(int argc, char* argv[], char* environ[]) { - char* szCmd; + char* szCmd; STARTUPINFO startinfo; - int nRet; + int nRet; /* Get the command line passed to the process. */ szCmd = GetCommandLineA(); @@ -92,4 +91,3 @@ main (int argc, char* argv[], char* environ[]) return nRet; } - diff --git a/reactos/lib/crtdll/misc/setnew.c b/reactos/lib/crtdll/misc/setnew.c index 885bd3b9fe0..9f0ad6f54ba 100644 --- a/reactos/lib/crtdll/misc/setnew.c +++ b/reactos/lib/crtdll/misc/setnew.c @@ -1,29 +1,28 @@ -#include +#include -typedef int (* new_handler_t)( size_t ); +typedef int (*new_handler_t)(size_t); new_handler_t new_handler; #undef _set_new_handler new_handler_t _set_new_handler__FPFUi_i(new_handler_t hnd) { - new_handler_t old = new_handler; - - new_handler = hnd; - - return old; + new_handler_t old = new_handler; + + new_handler = hnd; + return old; } #undef delete -void __builtin_delete (void* m) +void __builtin_delete(void* m) { - if ( m != NULL ) - free( m ); + if (m != NULL) + free(m); } #undef new -void * __builtin_new (unsigned int s ) +void* __builtin_new(unsigned int s) { - return malloc( s ); + return malloc( s ); } diff --git a/reactos/lib/crtdll/process/_cwait.c b/reactos/lib/crtdll/process/_cwait.c index 628a72deb9f..d3a9b66e86c 100644 --- a/reactos/lib/crtdll/process/_cwait.c +++ b/reactos/lib/crtdll/process/_cwait.c @@ -8,23 +8,24 @@ * 04/03/99: Created */ #include -#include -#include -#include +#include +#include +#include -int _cwait (int* pnStatus, int hProc, int nAction) + +int _cwait(int* pnStatus, int hProc, int nAction) { - DWORD ExitCode; + DWORD ExitCode; nAction = 0; - if ( WaitForSingleObject((void *)hProc,INFINITE) != WAIT_OBJECT_0 ) { + if (WaitForSingleObject((void*)hProc, INFINITE) != WAIT_OBJECT_0) { __set_errno(ECHILD); return -1; } - if ( !GetExitCodeProcess((void *)hProc,&ExitCode) ) + if (!GetExitCodeProcess((void*)hProc, &ExitCode)) return -1; if (pnStatus != NULL) - *pnStatus = (int)ExitCode; + *pnStatus = (int)ExitCode; return hProc; } diff --git a/reactos/lib/crtdll/process/dll.c b/reactos/lib/crtdll/process/dll.c index 71a33b1d521..daa003d2c58 100644 --- a/reactos/lib/crtdll/process/dll.c +++ b/reactos/lib/crtdll/process/dll.c @@ -9,23 +9,22 @@ */ #include -#include +#include -void *_loaddll (char *name) + +void* _loaddll(char* name) { return LoadLibraryA(name); } -int _unloaddll(void *handle) +int _unloaddll(void* handle) { return FreeLibrary(handle); } -FARPROC _getdllprocaddr(void *hModule,char * lpProcName, int iOrdinal) +FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal) { - - - if ( lpProcName != NULL ) + if (lpProcName != NULL) return GetProcAddress(hModule, lpProcName); else return GetProcAddress(hModule, (LPSTR)iOrdinal); diff --git a/reactos/lib/crtdll/process/execve.c b/reactos/lib/crtdll/process/execve.c index 3ea6ae91a0d..2ee6ad187f1 100644 --- a/reactos/lib/crtdll/process/execve.c +++ b/reactos/lib/crtdll/process/execve.c @@ -1,7 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include + int _execve(const char* szPath, char* const* szaArgv, char* const* szaEnv) { - return spawnve(P_OVERLAY, szPath, szaArgv, szaEnv); + return spawnve(P_OVERLAY, szPath, szaArgv, szaEnv); } diff --git a/reactos/lib/crtdll/process/spawnl.c b/reactos/lib/crtdll/process/spawnl.c index c2518d4f974..9e807624a0d 100644 --- a/reactos/lib/crtdll/process/spawnl.c +++ b/reactos/lib/crtdll/process/spawnl.c @@ -1,21 +1,22 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #include + int _spawnl(int nMode, const char* szPath, const char* szArgv0,...) { - char *szArg[100]; - const char *a; + char* szArg[100]; + const char* a; int i = 1; va_list l = 0; szArg[0]=(char*)szArgv0; va_start(l,szArgv0); do { - a = va_arg(l,const char *); - szArg[i++] = (char *)a; - } while ( a != NULL && i < 100 ); + a = va_arg(l, const char*); + szArg[i++] = (char*)a; + } while (a != NULL && i < 100); return _spawnve(nMode, szPath, szArg, _environ); } diff --git a/reactos/lib/crtdll/process/spawnle.c b/reactos/lib/crtdll/process/spawnle.c index 9a8e2dd13c4..27c354f6077 100644 --- a/reactos/lib/crtdll/process/spawnle.c +++ b/reactos/lib/crtdll/process/spawnle.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include int _spawnle(int mode, const char *path, const char *szArgv0, ... /*, const char **envp */) diff --git a/reactos/lib/crtdll/stdio/allocfil.c b/reactos/lib/crtdll/stdio/allocfil.c index b0f9e6446e9..7d86ebb5cf7 100644 --- a/reactos/lib/crtdll/stdio/allocfil.c +++ b/reactos/lib/crtdll/stdio/allocfil.c @@ -1,8 +1,8 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include FILE * __alloc_file(void); diff --git a/reactos/lib/crtdll/stdio/clearerr.c b/reactos/lib/crtdll/stdio/clearerr.c index 0543ed0abcd..5055fa7f670 100644 --- a/reactos/lib/crtdll/stdio/clearerr.c +++ b/reactos/lib/crtdll/stdio/clearerr.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include #ifdef clearerr #undef clearerr diff --git a/reactos/lib/crtdll/stdio/doscan.c b/reactos/lib/crtdll/stdio/doscan.c index a14f773f24e..09868e22217 100644 --- a/reactos/lib/crtdll/stdio/doscan.c +++ b/reactos/lib/crtdll/stdio/doscan.c @@ -1,10 +1,10 @@ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include #define atold atof @@ -16,7 +16,7 @@ int _doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *), const char *fmt, va_list argp); -//#include +//#include #define SPC 01 #define STP 02 diff --git a/reactos/lib/crtdll/stdio/fclose.c b/reactos/lib/crtdll/stdio/fclose.c index 1b141c5ca5a..74b3b0c2afb 100644 --- a/reactos/lib/crtdll/stdio/fclose.c +++ b/reactos/lib/crtdll/stdio/fclose.c @@ -1,12 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // changed check for writable stream diff --git a/reactos/lib/crtdll/stdio/feof.c b/reactos/lib/crtdll/stdio/feof.c index 8f6f01fec41..a2487d8bd17 100644 --- a/reactos/lib/crtdll/stdio/feof.c +++ b/reactos/lib/crtdll/stdio/feof.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include #ifdef feof #undef feof diff --git a/reactos/lib/crtdll/stdio/ferror.c b/reactos/lib/crtdll/stdio/ferror.c index 06d77c132cd..05110cd6272 100644 --- a/reactos/lib/crtdll/stdio/ferror.c +++ b/reactos/lib/crtdll/stdio/ferror.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #ifdef ferror #undef ferror diff --git a/reactos/lib/crtdll/stdio/filbuf.c b/reactos/lib/crtdll/stdio/filbuf.c index b9b008affe1..b98f48b0749 100644 --- a/reactos/lib/crtdll/stdio/filbuf.c +++ b/reactos/lib/crtdll/stdio/filbuf.c @@ -2,14 +2,14 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include int _readcnv(int fn, void *buf, size_t siz ); diff --git a/reactos/lib/crtdll/stdio/fopen.c b/reactos/lib/crtdll/stdio/fopen.c index 9335cf21f85..b657438c3d3 100644 --- a/reactos/lib/crtdll/stdio/fopen.c +++ b/reactos/lib/crtdll/stdio/fopen.c @@ -1,10 +1,10 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO); diff --git a/reactos/lib/crtdll/stdio/fprintf.c b/reactos/lib/crtdll/stdio/fprintf.c index 9ac7b6b0082..6c503dea6cb 100644 --- a/reactos/lib/crtdll/stdio/fprintf.c +++ b/reactos/lib/crtdll/stdio/fprintf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include int fprintf(register FILE *iop, const char *fmt, ...) diff --git a/reactos/lib/crtdll/stdio/fputs.c b/reactos/lib/crtdll/stdio/fputs.c index d8fbfff9eed..b47e65bb777 100644 --- a/reactos/lib/crtdll/stdio/fputs.c +++ b/reactos/lib/crtdll/stdio/fputs.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include #include int diff --git a/reactos/lib/crtdll/stdio/fread.c b/reactos/lib/crtdll/stdio/fread.c index c9f72385c98..79fc3725851 100644 --- a/reactos/lib/crtdll/stdio/fread.c +++ b/reactos/lib/crtdll/stdio/fread.c @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // carriage return line feed conversion is done in filbuf and flsbuf diff --git a/reactos/lib/crtdll/stdio/frlist.c b/reactos/lib/crtdll/stdio/frlist.c index 511d931a6c4..33969982c83 100644 --- a/reactos/lib/crtdll/stdio/frlist.c +++ b/reactos/lib/crtdll/stdio/frlist.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -//#include -#include +#include +//#include +#include static __file_rec __initial_file_rec = { diff --git a/reactos/lib/crtdll/stdio/fscanf.c b/reactos/lib/crtdll/stdio/fscanf.c index f8f33e7e99c..5e04c6c45b2 100644 --- a/reactos/lib/crtdll/stdio/fscanf.c +++ b/reactos/lib/crtdll/stdio/fscanf.c @@ -18,9 +18,9 @@ Cambridge, MA 02139, USA. */ #include -#include -#include -#include +#include +#include +#include int __vfscanf (FILE *s, const char *format, va_list argptr); diff --git a/reactos/lib/crtdll/stdio/getc.c b/reactos/lib/crtdll/stdio/getc.c index fe87af39952..4461664dce1 100644 --- a/reactos/lib/crtdll/stdio/getc.c +++ b/reactos/lib/crtdll/stdio/getc.c @@ -1,8 +1,8 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include //getc can be a macro #undef getc diff --git a/reactos/lib/crtdll/stdio/getchar.c b/reactos/lib/crtdll/stdio/getchar.c index fe0f036d2f7..14392d2cb81 100644 --- a/reactos/lib/crtdll/stdio/getchar.c +++ b/reactos/lib/crtdll/stdio/getchar.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #undef getchar int diff --git a/reactos/lib/crtdll/stdio/getenv.c b/reactos/lib/crtdll/stdio/getenv.c index 9188ddbaa40..30a2f3802b6 100644 --- a/reactos/lib/crtdll/stdio/getenv.c +++ b/reactos/lib/crtdll/stdio/getenv.c @@ -1,5 +1,5 @@ #include -#include +#include void *malloc(size_t size); diff --git a/reactos/lib/crtdll/stdio/setbuffe.c b/reactos/lib/crtdll/stdio/setbuffe.c index 5fb09f2bd06..d694b4da183 100644 --- a/reactos/lib/crtdll/stdio/setbuffe.c +++ b/reactos/lib/crtdll/stdio/setbuffe.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include +//#include +#include +#include void setbuffer(FILE *f, void *buf, int size) { diff --git a/reactos/lib/crtdll/stdio/setlineb.c b/reactos/lib/crtdll/stdio/setlineb.c index e8dcb040d4d..a46de6645d7 100644 --- a/reactos/lib/crtdll/stdio/setlineb.c +++ b/reactos/lib/crtdll/stdio/setlineb.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include // not exported diff --git a/reactos/lib/crtdll/stdio/setvbuf.c b/reactos/lib/crtdll/stdio/setvbuf.c index 2f095e3d05d..2b1d074915f 100644 --- a/reactos/lib/crtdll/stdio/setvbuf.c +++ b/reactos/lib/crtdll/stdio/setvbuf.c @@ -1,11 +1,11 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include int setvbuf(FILE *f, char *buf, int type, size_t len) diff --git a/reactos/lib/crtdll/stdio/sprintf.c b/reactos/lib/crtdll/stdio/sprintf.c index 855bc55a2c3..205697c93d4 100644 --- a/reactos/lib/crtdll/stdio/sprintf.c +++ b/reactos/lib/crtdll/stdio/sprintf.c @@ -19,10 +19,10 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include +#include +#include #include -#include +#include #undef sprintf #undef wsprintf diff --git a/reactos/lib/crtdll/stdio/stdiohk.c b/reactos/lib/crtdll/stdio/stdiohk.c index 83092aaa1f8..a808c37541a 100644 --- a/reactos/lib/crtdll/stdio/stdiohk.c +++ b/reactos/lib/crtdll/stdio/stdiohk.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include static void fcloseall_helper(FILE *f) diff --git a/reactos/lib/crtdll/stdlib/_exit.c b/reactos/lib/crtdll/stdlib/_exit.c index 2f6cef332f8..c67e0cffb96 100644 --- a/reactos/lib/crtdll/stdlib/_exit.c +++ b/reactos/lib/crtdll/stdlib/_exit.c @@ -1,8 +1,8 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include struct __atexit *__atexit_ptr = 0; diff --git a/reactos/lib/crtdll/stdlib/abort.c b/reactos/lib/crtdll/stdlib/abort.c index 3c33587b678..b76a2275e99 100644 --- a/reactos/lib/crtdll/stdlib/abort.c +++ b/reactos/lib/crtdll/stdlib/abort.c @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include char *msg ="Abort\n\r"; diff --git a/reactos/lib/crtdll/stdlib/atexit.c b/reactos/lib/crtdll/stdlib/atexit.c index 462fa07fdb5..fd80fde5f53 100644 --- a/reactos/lib/crtdll/stdlib/atexit.c +++ b/reactos/lib/crtdll/stdlib/atexit.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int atexit(void (*a)(void)) diff --git a/reactos/lib/crtdll/stdlib/atof.c b/reactos/lib/crtdll/stdlib/atof.c index 2b93d8cc512..8497148784a 100644 --- a/reactos/lib/crtdll/stdlib/atof.c +++ b/reactos/lib/crtdll/stdlib/atof.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double atof(const char *ascii) diff --git a/reactos/lib/crtdll/stdlib/atoi.c b/reactos/lib/crtdll/stdlib/atoi.c index 1d19cf0c61a..c6b95e31af9 100644 --- a/reactos/lib/crtdll/stdlib/atoi.c +++ b/reactos/lib/crtdll/stdlib/atoi.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int atoi(const char *str) diff --git a/reactos/lib/crtdll/stdlib/atol.c b/reactos/lib/crtdll/stdlib/atol.c index 0360505b605..3cac430b260 100644 --- a/reactos/lib/crtdll/stdlib/atol.c +++ b/reactos/lib/crtdll/stdlib/atol.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long atol(const char *str) diff --git a/reactos/lib/crtdll/stdlib/atold.c b/reactos/lib/crtdll/stdlib/atold.c index 1bcaeeb6dc7..c9b511684a4 100644 --- a/reactos/lib/crtdll/stdlib/atold.c +++ b/reactos/lib/crtdll/stdlib/atold.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long double _atold(const char *ascii) diff --git a/reactos/lib/crtdll/stdlib/bsearch.c b/reactos/lib/crtdll/stdlib/bsearch.c index a36e43f5418..7c3d9ed0e66 100644 --- a/reactos/lib/crtdll/stdlib/bsearch.c +++ b/reactos/lib/crtdll/stdlib/bsearch.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include void * bsearch(const void *key, const void *base0, size_t nelem, diff --git a/reactos/lib/crtdll/stdlib/calloc.c b/reactos/lib/crtdll/stdlib/calloc.c index 7325ed635f8..07aa4cf6cdd 100644 --- a/reactos/lib/crtdll/stdlib/calloc.c +++ b/reactos/lib/crtdll/stdlib/calloc.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include void * calloc(size_t size, size_t nelem) diff --git a/reactos/lib/crtdll/stdlib/div.c b/reactos/lib/crtdll/stdlib/div.c index be64654d168..833e6a349e7 100644 --- a/reactos/lib/crtdll/stdlib/div.c +++ b/reactos/lib/crtdll/stdlib/div.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include div_t div(int num, int denom) diff --git a/reactos/lib/crtdll/stdlib/errno.c b/reactos/lib/crtdll/stdlib/errno.c index b2bfaa65b06..ce1fabaae2f 100644 --- a/reactos/lib/crtdll/stdlib/errno.c +++ b/reactos/lib/crtdll/stdlib/errno.c @@ -1,5 +1,5 @@ #include -#include +#include #undef errno int errno; diff --git a/reactos/lib/crtdll/stdlib/gcvt.c b/reactos/lib/crtdll/stdlib/gcvt.c index f32157ada2f..3a0b621945e 100644 --- a/reactos/lib/crtdll/stdlib/gcvt.c +++ b/reactos/lib/crtdll/stdlib/gcvt.c @@ -1,7 +1,7 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include char * _gcvt (double value, int ndigits, char *buf) diff --git a/reactos/lib/crtdll/stdlib/ldiv.c b/reactos/lib/crtdll/stdlib/ldiv.c index 26cbfbb58e6..a3b121b8623 100644 --- a/reactos/lib/crtdll/stdlib/ldiv.c +++ b/reactos/lib/crtdll/stdlib/ldiv.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include ldiv_t ldiv(long num, long denom) diff --git a/reactos/lib/crtdll/stdlib/llabs.c b/reactos/lib/crtdll/stdlib/llabs.c index fc6580adaf6..83ba4ef72c8 100644 --- a/reactos/lib/crtdll/stdlib/llabs.c +++ b/reactos/lib/crtdll/stdlib/llabs.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long long llabs(long long j) diff --git a/reactos/lib/crtdll/stdlib/lldiv.c b/reactos/lib/crtdll/stdlib/lldiv.c index 2a0e3f593fd..75f065bb8f4 100644 --- a/reactos/lib/crtdll/stdlib/lldiv.c +++ b/reactos/lib/crtdll/stdlib/lldiv.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include lldiv_t lldiv(long long num, long long denom) diff --git a/reactos/lib/crtdll/stdlib/qsort.c b/reactos/lib/crtdll/stdlib/qsort.c index f2be7c51680..09f5816f5a8 100644 --- a/reactos/lib/crtdll/stdlib/qsort.c +++ b/reactos/lib/crtdll/stdlib/qsort.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include /*- * Copyright (c) 1980, 1983 The Regents of the University of California. diff --git a/reactos/lib/crtdll/stdlib/rand.c b/reactos/lib/crtdll/stdlib/rand.c index 78912a29667..74761b72f6e 100644 --- a/reactos/lib/crtdll/stdlib/rand.c +++ b/reactos/lib/crtdll/stdlib/rand.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include static unsigned long long next = 0; diff --git a/reactos/lib/crtdll/stdlib/strtoll.c b/reactos/lib/crtdll/stdlib/strtoll.c index 237aeacb2a6..b609e79d233 100644 --- a/reactos/lib/crtdll/stdlib/strtoll.c +++ b/reactos/lib/crtdll/stdlib/strtoll.c @@ -1,10 +1,10 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -//#include +#include +#include +#include +//#include /* constants used in Solaris */ #define LLONG_MIN -9223372036854775807L-1L diff --git a/reactos/lib/crtdll/stdlib/strtoull.c b/reactos/lib/crtdll/stdlib/strtoull.c index d94845e2b39..ec9f852525f 100644 --- a/reactos/lib/crtdll/stdlib/strtoull.c +++ b/reactos/lib/crtdll/stdlib/strtoull.c @@ -1,10 +1,10 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -//#include +#include +#include +#include +//#include /* * Convert a string to an unsigned long integer. diff --git a/reactos/lib/crtdll/stdlib/swab.c b/reactos/lib/crtdll/stdlib/swab.c index 0126c598f91..ec106acad91 100644 --- a/reactos/lib/crtdll/stdlib/swab.c +++ b/reactos/lib/crtdll/stdlib/swab.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include void _swab (const char* caFrom, char* caTo, size_t sizeToCopy) { diff --git a/reactos/lib/crtdll/stdlib/wcstomb.c b/reactos/lib/crtdll/stdlib/wcstomb.c index 832672a7b52..c5e6492c4e9 100644 --- a/reactos/lib/crtdll/stdlib/wcstomb.c +++ b/reactos/lib/crtdll/stdlib/wcstomb.c @@ -16,12 +16,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include +#include +#include -#include -#include -#include +#include +#include +#include #ifndef EILSEQ #define EILSEQ EINVAL diff --git a/reactos/lib/crtdll/string/str_old.c b/reactos/lib/crtdll/string/str_old.c index e047e3ef91a..6b20e865458 100644 --- a/reactos/lib/crtdll/string/str_old.c +++ b/reactos/lib/crtdll/string/str_old.c @@ -19,14 +19,14 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: ariadne $ - * $Date: 1999/04/03 10:42:18 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/29 12:27:49 $ * */ -#include -#include +#include +#include int strcasecmp (const char* sz1, const char* sz2) diff --git a/reactos/lib/crtdll/string/stricmp.c b/reactos/lib/crtdll/string/stricmp.c index 913ceef9eee..de15d0f8a30 100644 --- a/reactos/lib/crtdll/string/stricmp.c +++ b/reactos/lib/crtdll/string/stricmp.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int _stricmp(const char *s1, const char *s2) diff --git a/reactos/lib/crtdll/string/strrev.c b/reactos/lib/crtdll/string/strrev.c index 757ab08a20c..ef5ab94a482 100644 --- a/reactos/lib/crtdll/string/strrev.c +++ b/reactos/lib/crtdll/string/strrev.c @@ -1,4 +1,4 @@ -#include +#include char * _strrev(char *s) { diff --git a/reactos/lib/crtdll/sys_stat/fstat.c b/reactos/lib/crtdll/sys_stat/fstat.c index f8ae6512fcd..4a604488bad 100644 --- a/reactos/lib/crtdll/sys_stat/fstat.c +++ b/reactos/lib/crtdll/sys_stat/fstat.c @@ -1,4 +1,4 @@ -/* $Id: fstat.c,v 1.11 2002/11/24 18:42:19 robd Exp $ +/* $Id: fstat.c,v 1.12 2002/11/29 12:27:49 robd Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -19,35 +19,34 @@ int _fstat(int fd, struct stat* statbuf) { - BY_HANDLE_FILE_INFORMATION FileInformation; + BY_HANDLE_FILE_INFORMATION FileInformation; - if (!statbuf) - { - __set_errno(EINVAL); - return -1; + if (!statbuf) { + __set_errno(EINVAL); + return -1; } - if ( !GetFileInformationByHandle(_get_osfhandle(fd),&FileInformation) ) { - __set_errno (EBADF); - return -1; - } - statbuf->st_ctime = FileTimeToUnixTime( &FileInformation.ftCreationTime,NULL); - statbuf->st_atime = FileTimeToUnixTime( &FileInformation.ftLastAccessTime,NULL); - statbuf->st_mtime = FileTimeToUnixTime( &FileInformation.ftLastWriteTime,NULL); - if (statbuf->st_atime ==0) - statbuf->st_atime = statbuf->st_mtime; - if (statbuf->st_ctime ==0) - statbuf->st_ctime = statbuf->st_mtime; + if (!GetFileInformationByHandle(_get_osfhandle(fd),&FileInformation)) { + __set_errno (EBADF); + return -1; + } + statbuf->st_ctime = FileTimeToUnixTime(&FileInformation.ftCreationTime,NULL); + statbuf->st_atime = FileTimeToUnixTime(&FileInformation.ftLastAccessTime,NULL); + statbuf->st_mtime = FileTimeToUnixTime(&FileInformation.ftLastWriteTime,NULL); + if (statbuf->st_atime ==0) + statbuf->st_atime = statbuf->st_mtime; + if (statbuf->st_ctime ==0) + statbuf->st_ctime = statbuf->st_mtime; - statbuf->st_dev = FileInformation.dwVolumeSerialNumber; - statbuf->st_size = FileInformation.nFileSizeLow; - statbuf->st_nlink = FileInformation.nNumberOfLinks; - statbuf->st_mode = S_IREAD; - if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - statbuf->st_mode |= S_IFDIR | S_IEXEC; - else - statbuf->st_mode |= S_IFREG; - if ( !(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - statbuf->st_mode |= S_IWRITE; - return 0; + statbuf->st_dev = FileInformation.dwVolumeSerialNumber; + statbuf->st_size = FileInformation.nFileSizeLow; + statbuf->st_nlink = FileInformation.nNumberOfLinks; + statbuf->st_mode = S_IREAD; + if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + statbuf->st_mode |= S_IFDIR | S_IEXEC; + else + statbuf->st_mode |= S_IFREG; + if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + statbuf->st_mode |= S_IWRITE; + return 0; } diff --git a/reactos/lib/crtdll/sys_stat/ftime.c b/reactos/lib/crtdll/sys_stat/ftime.c index 314d6c2f068..6b2dd6c018d 100644 --- a/reactos/lib/crtdll/sys_stat/ftime.c +++ b/reactos/lib/crtdll/sys_stat/ftime.c @@ -26,21 +26,21 @@ Cambridge, MA 02139, USA. */ // crtdll has void return type instead of int void _ftime(struct timeb* timebuf) { - int save = errno; - struct tm *tp; + int save = errno; + struct tm* tp; - __set_errno (0); - if (time (&timebuf->time) == (time_t) -1 && errno != 0) + __set_errno (0); + if (time (&timebuf->time) == (time_t) -1 && errno != 0) + return; + timebuf->millitm = 0; + tp = localtime(&timebuf->time); + if (tp == NULL) + return; + + timebuf->_timezone = tp->tm_gmtoff / 60; + timebuf->dstflag = tp->tm_isdst; + + free(tp); + __set_errno(save); return; - timebuf->millitm = 0; - tp = localtime(&timebuf->time); - if (tp == NULL) - return; - - timebuf->_timezone = tp->tm_gmtoff / 60; - timebuf->dstflag = tp->tm_isdst; - - free(tp); - __set_errno (save); - return; } diff --git a/reactos/lib/crtdll/sys_stat/futime.c b/reactos/lib/crtdll/sys_stat/futime.c index cde6bfb07a9..a1a269cc62d 100644 --- a/reactos/lib/crtdll/sys_stat/futime.c +++ b/reactos/lib/crtdll/sys_stat/futime.c @@ -1,39 +1,40 @@ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -int _futime (int nHandle, struct _utimbuf *pTimes) + +int _futime(int nHandle, struct _utimbuf* pTimes) { - FILETIME LastAccessTime; - FILETIME LastWriteTime; - - // check for stdin / stdout handles ?? - if ( nHandle == -1 ) { - __set_errno(EBADF); - return -1; - } - - if ( pTimes == NULL ) { - pTimes = alloca(sizeof(struct _utimbuf)); - time(&pTimes->actime); - time(&pTimes->modtime); - } - - if ( pTimes->actime < pTimes->modtime ) { - __set_errno(EINVAL); - return -1; - } - - UnixTimeToFileTime(pTimes->actime,&LastAccessTime,0); - UnixTimeToFileTime(pTimes->modtime,&LastWriteTime,0); - if ( !SetFileTime(_get_osfhandle(nHandle),NULL, &LastAccessTime, &LastWriteTime) ) { - __set_errno(EBADF); - return -1; - } + FILETIME LastAccessTime; + FILETIME LastWriteTime; - return 0; + // check for stdin / stdout handles ?? + if (nHandle == -1) { + __set_errno(EBADF); + return -1; + } + + if (pTimes == NULL) { + pTimes = alloca(sizeof(struct _utimbuf)); + time(&pTimes->actime); + time(&pTimes->modtime); + } + + if (pTimes->actime < pTimes->modtime) { + __set_errno(EINVAL); + return -1; + } + + UnixTimeToFileTime(pTimes->actime, &LastAccessTime, 0); + UnixTimeToFileTime(pTimes->modtime, &LastWriteTime, 0); + if (!SetFileTime(_get_osfhandle(nHandle), NULL, &LastAccessTime, &LastWriteTime)) { + __set_errno(EBADF); + return -1; + } + + return 0; } diff --git a/reactos/lib/crtdll/sys_stat/stat.c b/reactos/lib/crtdll/sys_stat/stat.c index d3c61c9c723..a6e9d72a365 100644 --- a/reactos/lib/crtdll/sys_stat/stat.c +++ b/reactos/lib/crtdll/sys_stat/stat.c @@ -6,51 +6,46 @@ #include -int _stat( const char *path, struct stat *buffer ) +int _stat(const char* path, struct stat* buffer) { - HANDLE fh; - WIN32_FIND_DATA wfd; + HANDLE fh; + WIN32_FIND_DATA wfd; - fh = FindFirstFile (path,&wfd); - if ( fh == INVALID_HANDLE_VALUE ) - { - __set_errno(ENOFILE); - return -1; - } - if ( ! (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - int fd = _open(path,_O_RDONLY); - int ret; - - ret = fstat(fd,buffer); - _close(fd); + fh = FindFirstFile(path, &wfd); + if (fh == INVALID_HANDLE_VALUE) { + __set_errno(ENOFILE); + return -1; + } + if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + int fd = _open(path, _O_RDONLY); + int ret; + ret = fstat(fd, buffer); + _close(fd); + return ret; + } + buffer->st_ctime = FileTimeToUnixTime(&wfd.ftCreationTime,NULL); + buffer->st_atime = FileTimeToUnixTime(&wfd.ftLastAccessTime,NULL); + buffer->st_mtime = FileTimeToUnixTime(&wfd.ftLastWriteTime,NULL); - return ret; - } - buffer->st_ctime = FileTimeToUnixTime( &wfd.ftCreationTime,NULL); - buffer->st_atime = FileTimeToUnixTime( &wfd.ftLastAccessTime,NULL); - buffer->st_mtime = FileTimeToUnixTime( &wfd.ftLastWriteTime,NULL); + if (buffer->st_atime ==0) + buffer->st_atime = buffer->st_mtime; + if (buffer->st_ctime ==0) + buffer->st_ctime = buffer->st_mtime; - if (buffer->st_atime ==0) - buffer->st_atime = buffer->st_mtime; - if (buffer->st_ctime ==0) - buffer->st_ctime = buffer->st_mtime; + buffer->st_mode = S_IREAD; + if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + buffer->st_mode |= S_IFDIR; + else + buffer->st_mode |= S_IFREG; + if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buffer->st_mode |= S_IWRITE | S_IEXEC; - buffer->st_mode = S_IREAD; - if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - buffer->st_mode |= S_IFDIR; - else - buffer->st_mode |= S_IFREG; - if ( ! (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - buffer->st_mode |= S_IWRITE | S_IEXEC; - - buffer->st_size = wfd.nFileSizeLow; - buffer->st_nlink = 1; - if (FindNextFile(fh,&wfd)) - { - __set_errno(ENOFILE); - FindClose(fh); - return -1; - } - return 0; + buffer->st_size = wfd.nFileSizeLow; + buffer->st_nlink = 1; + if (FindNextFile(fh, &wfd)) { + __set_errno(ENOFILE); + FindClose(fh); + return -1; + } + return 0; } diff --git a/reactos/lib/crtdll/sys_stat/systime.c b/reactos/lib/crtdll/sys_stat/systime.c index 2289ad429a1..d168a4f0434 100644 --- a/reactos/lib/crtdll/sys_stat/systime.c +++ b/reactos/lib/crtdll/sys_stat/systime.c @@ -1,67 +1,66 @@ #include -#include +#include int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31}; -unsigned int _getsystime(struct tm *tp) + +unsigned int _getsystime(struct tm* tp) { - SYSTEMTIME Time; - TIME_ZONE_INFORMATION TimeZoneInformation; - DWORD TimeZoneId; - int i; + SYSTEMTIME Time; + TIME_ZONE_INFORMATION TimeZoneInformation; + DWORD TimeZoneId; + int i; - GetLocalTime(&Time); + GetLocalTime(&Time); - tp->tm_year = Time.wYear - 1900; - tp->tm_mon = Time.wMonth - 1; - tp->tm_wday = Time.wDayOfWeek; - tp->tm_mday = Time.wDay; - tp->tm_hour = Time.wHour; - tp->tm_min = Time.wMinute; - tp->tm_sec = Time.wSecond; + tp->tm_year = Time.wYear - 1900; + tp->tm_mon = Time.wMonth - 1; + tp->tm_wday = Time.wDayOfWeek; + tp->tm_mday = Time.wDay; + tp->tm_hour = Time.wHour; + tp->tm_min = Time.wMinute; + tp->tm_sec = Time.wSecond; - tp->tm_isdst = -1; + tp->tm_isdst = -1; - //FIXME GetTimeZoneInformation currently not in kernel32 + //FIXME GetTimeZoneInformation currently not in kernel32 - //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation ); - //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) { - // tp->tm_isdst = 1; - //} - //else - // tp->tm_isdst = 0; - - - - if ( tp->tm_year%4 == 0 ) { - if (tp->tm_year%100 != 0 ) - tp->tm_yday = 1; - else if ( (tp->tm_year-100)%1000 == 0 ) - tp->tm_yday = 1; - } + //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation ); + //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) { + // tp->tm_isdst = 1; + //} + //else + // tp->tm_isdst = 0; - for(i=0;i<=tp->tm_mon;i++) - tp->tm_yday += month[i]; - - return Time.wMilliseconds; + if (tp->tm_year % 4 == 0) { + if (tp->tm_year % 100 != 0) + tp->tm_yday = 1; + else if ((tp->tm_year-100) % 1000 == 0) + tp->tm_yday = 1; + } + + for (i = 0; i <= tp->tm_mon; i++) + tp->tm_yday += month[i]; + + return Time.wMilliseconds; } -unsigned int _setsystime(struct tm *tp, unsigned int ms) +unsigned int _setsystime(struct tm* tp, unsigned int ms) { - SYSTEMTIME Time; + SYSTEMTIME Time; - Time.wYear = tp->tm_year + 1900; - Time.wMonth = tp->tm_mon + 1; - Time.wDayOfWeek = tp->tm_wday; - Time.wDay = tp->tm_mday; - Time.wHour = tp->tm_hour; - Time.wMinute = tp->tm_min; - Time.wSecond = tp->tm_sec; - Time.wMilliseconds = ms; + Time.wYear = tp->tm_year + 1900; + Time.wMonth = tp->tm_mon + 1; + Time.wDayOfWeek = tp->tm_wday; + Time.wDay = tp->tm_mday; + Time.wHour = tp->tm_hour; + Time.wMinute = tp->tm_min; + Time.wSecond = tp->tm_sec; + Time.wMilliseconds = ms; - if ( !SetLocalTime(&Time)) - return -1; + if (!SetLocalTime(&Time)) + return -1; - return 0; + return 0; } diff --git a/reactos/lib/crtdll/time/strftime.c b/reactos/lib/crtdll/time/strftime.c index c5c65dff78c..5c83edfb35b 100644 --- a/reactos/lib/crtdll/time/strftime.c +++ b/reactos/lib/crtdll/time/strftime.c @@ -1,32 +1,33 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include + #define TM_YEAR_BASE 1900 -static const char *afmt[] = { +static const char* afmt[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }; -static const char *Afmt[] = { +static const char* Afmt[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }; -static const char *bfmt[] = { +static const char* bfmt[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; -static const char *Bfmt[] = { +static const char* Bfmt[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; static size_t gsize; -static char *pt; +static char* pt; -static int -_add(const char *str) + +static int _add(const char* str) { for (;; ++pt, --gsize) { @@ -37,11 +38,10 @@ _add(const char *str) } } -static int -_conv(int n, int digits, char pad) +static int _conv(int n, int digits, char pad) { static char buf[10]; - char *p; + char* p; for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits) *p-- = n % 10 + '0'; @@ -50,16 +50,14 @@ _conv(int n, int digits, char pad) return _add(++p); } -static size_t -_fmt(const char *format, const struct tm *t) +static size_t _fmt(const char* format, const struct tm* t) { for (; *format; ++format) { if (*format == '%') { - if (*(format+1) == '#' ) {format++;} + if (*(format+1) == '#') {format++;} - switch(*++format) - { + switch(*++format) { case '\0': --format; break; @@ -113,8 +111,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'I': - if (!_conv(t->tm_hour % 12 ? - t->tm_hour % 12 : 12, 2, '0')) + if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0')) return 0; continue; case 'j': @@ -126,8 +123,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'l': - if (!_conv(t->tm_hour % 12 ? - t->tm_hour % 12 : 12, 2, ' ')) + if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' ')) return 0; continue; case 'M': @@ -168,14 +164,11 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'U': - if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, - 2, '0')) + if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, 2, '0')) return 0; continue; case 'W': - if (!_conv((t->tm_yday + 7 - - (t->tm_wday ? (t->tm_wday - 1) : 6)) - / 7, 2, '0')) + if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0')) return 0; continue; case 'w': @@ -187,8 +180,7 @@ _fmt(const char *format, const struct tm *t) return 0; continue; case 'y': - if (!_conv((t->tm_year + TM_YEAR_BASE) - % 100, 2, '0')) + if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0')) return 0; continue; case 'Y': @@ -230,32 +222,30 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *t) return 0; } -size_t -wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *t) +size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* t) { - char *x; - char *f; + char* x; + char* f; int i,j; x = malloc(maxsize); j = wcslen(format); f = malloc(j+1); - for(i=0;i +#include -double wcstod(const wchar_t *s, wchar_t **sret) +double wcstod(const wchar_t* s, wchar_t** sret) { long double r; /* result */ int e; /* exponent */ diff --git a/reactos/lib/crtdll/wchar/wcstol.c b/reactos/lib/crtdll/wchar/wcstol.c index 5a5ae97df77..fa95e967a6a 100644 --- a/reactos/lib/crtdll/wchar/wcstol.c +++ b/reactos/lib/crtdll/wchar/wcstol.c @@ -1,12 +1,12 @@ -#include +#include -long wcstol(const wchar_t *cp,wchar_t **endp,int base) +long wcstol(const wchar_t* cp, wchar_t** endp, int base) { - long result = 0,value; + long result = 0, value; int sign = 1; - if ( *cp == L'-' ) { + if (*cp == L'-') { sign = -1; cp++; } @@ -28,14 +28,13 @@ long wcstol(const wchar_t *cp,wchar_t **endp,int base) cp++; } if (endp) - *endp = (wchar_t *)cp; + *endp = (wchar_t*)cp; return result * sign; } - -unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,int base) +unsigned long wcstoul(const wchar_t* cp, wchar_t** endp, int base) { - unsigned long result = 0,value; + unsigned long result = 0, value; if (!base) { base = 10; @@ -54,7 +53,6 @@ unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,int base) cp++; } if (endp) - *endp = (wchar_t *)cp; + *endp = (wchar_t*)cp; return result; } - diff --git a/reactos/lib/crtdll/wchar/wcstombs.c b/reactos/lib/crtdll/wchar/wcstombs.c index f660411840d..7479632b225 100644 --- a/reactos/lib/crtdll/wchar/wcstombs.c +++ b/reactos/lib/crtdll/wchar/wcstombs.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include size_t wcstombs( char *dst, const wchar_t *src, size_t len ) { diff --git a/reactos/lib/crtdll/wchar/wtoi.c b/reactos/lib/crtdll/wchar/wtoi.c index 6aeb3d16772..721f979a4ee 100644 --- a/reactos/lib/crtdll/wchar/wtoi.c +++ b/reactos/lib/crtdll/wchar/wtoi.c @@ -1,11 +1,12 @@ -#include +#include -int _wtoi( const wchar_t *str ) + +int _wtoi(const wchar_t* str) { return (int)wcstol(str, 0, 10); } -long _wtol( const wchar_t *str ) +long _wtol(const wchar_t* str) { return (int)wcstol(str, 0, 10); }