more msvc compile fixes by Brezenbak and I
Modified: trunk/reactos/lib/crt/float/logb.c
Modified: trunk/reactos/lib/crt/include/float.h
Modified: trunk/reactos/lib/crt/include/internal/file.h
Modified: trunk/reactos/lib/crt/include/internal/mbstring.h
Modified: trunk/reactos/lib/crt/io/access.c
Modified: trunk/reactos/lib/crt/io/chmod.c
Modified: trunk/reactos/lib/crt/io/tell.c
Modified: trunk/reactos/lib/crt/io/wutime.c
Modified: trunk/reactos/lib/crt/precomp.h
Modified: trunk/reactos/lib/crt/process/dll.c
Modified: trunk/reactos/lib/crt/signal/signal.c
Modified: trunk/reactos/lib/crt/stdio/fopen.c
Modified: trunk/reactos/lib/crt/stdio/fputc.c
Modified: trunk/reactos/lib/crt/stdio/freopen.c
Modified: trunk/reactos/lib/crt/stdio/fsopen.c
Modified: trunk/reactos/lib/crt/stdio/vfprintf.c
Modified: trunk/reactos/lib/crt/stdio/vfwprint.c
Modified: trunk/reactos/lib/crt/stdlib/senv.c
Modified: trunk/reactos/lib/crt/stdlib/strtoull.c
Modified: trunk/reactos/lib/crt/sys_stat/fstat.c
Modified: trunk/reactos/lib/crt/time/difftime.c

Modified: trunk/reactos/lib/crt/float/logb.c
--- trunk/reactos/lib/crt/float/logb.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/float/logb.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -22,13 +22,13 @@
 
 double _logb (double __x)
 {
-  register double __value;
+  register double __val;
 #ifdef __GNUC__
   register double __junk;
   __asm __volatile__
     ("fxtract\n\t"
-     : "=t" (__junk), "=u" (__value) : "0" (__x));
+     : "=t" (__junk), "=u" (__val) : "0" (__x));
 #else
 #endif /*__GNUC__*/
-  return __value;
+  return __val;
 }

Modified: trunk/reactos/lib/crt/include/float.h
--- trunk/reactos/lib/crt/include/float.h	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/include/float.h	2005-11-24 06:07:04 UTC (rev 19515)
@@ -15,15 +15,16 @@
  *       here.
  *
  */
-
-#include_next<float.h>
-
+#ifdef __GNUC__
+   #include_next <float.h>
+#endif
 #ifndef _MINGW_FLOAT_H_
 #define _MINGW_FLOAT_H_
 
 /* All the headers include this file. */
-#include <_mingw.h>
-
+#ifdef __GNUC__
+   #include <_mingw.h>
+#endif
 /*
  * Functions and definitions for controlling the FPU.
  */
@@ -90,12 +91,24 @@
 #define _FPE_STACKUNDERFLOW	0x8b
 #define _FPE_EXPLICITGEN	0x8c    /* raise( SIGFPE ); */
 
+#define DBL_MAX_10_EXP  308  
+#define S_IFIFO			-1
+#define UINT64_MAX	0xffffffffffffffff
+
 #ifndef RC_INVOKED
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
+#ifndef _CRTIMP
+#ifdef  _DLL
+#define _CRTIMP __declspec(dllimport)
+#else   
+#define _CRTIMP
+#endif  /* _DLL */
+#endif 
+
 /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
  * i.e. change the bits in unMask to have the values they have in unNew,
  * leaving other bits unchanged. */

Modified: trunk/reactos/lib/crt/include/internal/file.h
--- trunk/reactos/lib/crt/include/internal/file.h	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/include/internal/file.h	2005-11-24 06:07:04 UTC (rev 19515)
@@ -16,7 +16,9 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdarg.h>
+#include <time.h>
 
+
 #include <windef.h>
 #include <winbase.h>
 #include <winnt.h>

Modified: trunk/reactos/lib/crt/include/internal/mbstring.h
--- trunk/reactos/lib/crt/include/internal/mbstring.h	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/include/internal/mbstring.h	2005-11-24 06:07:04 UTC (rev 19515)
@@ -18,5 +18,20 @@
 #endif
 #define _P2     (_P_|__2)
 
+#if defined (_MSC_VER)
 
+#undef _ismbbkana
+#undef _ismbbkpunct
+#undef _ismbbalpha
+#undef _ismbbalnum
+#undef _ismbbgraph
+#undef _ismbbkalnum
+#undef _ismbblead
+#undef _ismbbprint
+#undef _ismbbpunct
+#undef _ismbbtrail
+
 #endif
+
+
+#endif

Modified: trunk/reactos/lib/crt/io/access.c
--- trunk/reactos/lib/crt/io/access.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/io/access.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -20,7 +20,7 @@
 int _taccess( const _TCHAR *_path, int _amode )
 {
     DWORD Attributes = GetFileAttributes(_path);
-    DPRINT(MK_STR(_taccess)"('%"_TS"', %x)\n", _path, _amode);
+    DPRINT(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode);
 
     if (Attributes == (DWORD)-1) {
     	_dosmaperr(GetLastError());
@@ -44,7 +44,7 @@
 int access_dirT(const _TCHAR *_path)
 {
     DWORD Attributes = GetFileAttributes(_path);
-    DPRINT(MK_STR(is_dirT)"('%"_TS"')\n", _path);
+    DPRINT(MK_STR(is_dirT)"('%"sT"')\n", _path);
 
     if (Attributes == (DWORD)-1) {
          _dosmaperr(GetLastError());

Modified: trunk/reactos/lib/crt/io/chmod.c
--- trunk/reactos/lib/crt/io/chmod.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/io/chmod.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -20,7 +20,7 @@
     DWORD FileAttributes = 0;
     BOOLEAN Set = FALSE;
 
-    DPRINT(#_tchmod"('%"sT"', %x)\n", filename, mode);
+    DPRINT(MK_STR(_tchmod)"('%"sT"', %x)\n", filename, mode);
 
     FileAttributes = GetFileAttributes(filename);
     if ( FileAttributes == (DWORD)-1 ) {

Modified: trunk/reactos/lib/crt/io/tell.c
--- trunk/reactos/lib/crt/io/tell.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/io/tell.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -2,8 +2,8 @@
 #include <errno.h>
 #include <io.h>
 #include <stdio.h>
+#include <sys/types.h>
 
-
 /*
  * @implemented
  */

Modified: trunk/reactos/lib/crt/io/wutime.c
--- trunk/reactos/lib/crt/io/wutime.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/io/wutime.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -1,3 +1,4 @@
+#include "precomp.h"
 #include <stdio.h>
 #include <io.h>
 #include <errno.h>
@@ -4,7 +5,6 @@
 #include <sys/utime.h>
 #include <internal/file.h>
 
-
 /*
  * @implemented
  */
@@ -23,3 +23,4 @@
         return -1;
     return ret;
 }
+

Modified: trunk/reactos/lib/crt/precomp.h
--- trunk/reactos/lib/crt/precomp.h	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/precomp.h	2005-11-24 06:07:04 UTC (rev 19515)
@@ -1,4 +1,7 @@
 #define CRT_SECURE_NO_DEPRECATE
+#define _INC_WTIME_INL
+#define _INC_UTIME_INL
+#define _INC_TIME_INL
 
 #define WIN32_NO_STATUS
 #include <windows.h>

Modified: trunk/reactos/lib/crt/process/dll.c
--- trunk/reactos/lib/crt/process/dll.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/process/dll.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -9,7 +9,6 @@
  */
 
 #include "precomp.h"
-#include <process.h>
 
 /*
  * @implemented

Modified: trunk/reactos/lib/crt/signal/signal.c
--- trunk/reactos/lib/crt/signal/signal.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/signal/signal.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -8,7 +8,7 @@
 
 void _default_handler(int signal);
 
-//typedef void (*_p_sig_fn_t)(int);
+typedef void (*__p_sig_fn_t)(int);
 
 
 typedef struct _sig_element

Modified: trunk/reactos/lib/crt/stdio/fopen.c
--- trunk/reactos/lib/crt/stdio/fopen.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/fopen.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -29,6 +29,7 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <io.h>
 #include <fcntl.h>

Modified: trunk/reactos/lib/crt/stdio/fputc.c
--- trunk/reactos/lib/crt/stdio/fputc.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/fputc.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -23,3 +23,4 @@
   return putwc(c,fp);
 }
 
+

Modified: trunk/reactos/lib/crt/stdio/freopen.c
--- trunk/reactos/lib/crt/stdio/freopen.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/freopen.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -4,6 +4,7 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <io.h>
 #include <tchar.h>

Modified: trunk/reactos/lib/crt/stdio/fsopen.c
--- trunk/reactos/lib/crt/stdio/fsopen.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/fsopen.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -14,6 +14,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <io.h>
 #include <fcntl.h>
 #include <share.h>

Modified: trunk/reactos/lib/crt/stdio/vfprintf.c
--- trunk/reactos/lib/crt/stdio/vfprintf.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/vfprintf.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -450,6 +450,7 @@
 static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int precision, int flags)
 {
 	int i, done = 0;
+	char * mb;
 	if (sw == NULL)
 	{
 		sw = L"<NULL>";
@@ -476,10 +477,11 @@
 				return -1;
 			done++;
 		}
+	mb = malloc(MB_CUR_MAX * sizeof(char));
+	if(!mb)
+		return -1;
 	for (i = 0; i < len; ++i)
 	{
-//#define MB_CUR_MAX 1
-		char mb[MB_CUR_MAX];
 		int mbcount, j;
 		mbcount = wctomb(mb, *sw++);
 		if (mbcount <= 0)
@@ -489,16 +491,23 @@
 		for (j = 0; j < mbcount; j++)
 		{
 			if (putc(mb[j], f) == EOF)
+			{
+				free(mb);
 				return -1;
+			}
 			done++;
 		}
 	}
 	while (len < field_width--)
 	{
 		if (putc(' ', f) == EOF)
+		{
+			free(mb);
 			return -1;
+		}
 		done++;
 	}
+	free(mb);
 	return done;
 }
 

Modified: trunk/reactos/lib/crt/stdio/vfwprint.c
--- trunk/reactos/lib/crt/stdio/vfwprint.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdio/vfwprint.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -7,7 +7,7 @@
 #include <malloc.h>
 #include <internal/file.h>
 
-#include <ntdef.h>
+#include <winnt.h>
 
 int _isnanl(double x);
 int _isinfl(double x);

Modified: trunk/reactos/lib/crt/stdlib/senv.c
--- trunk/reactos/lib/crt/stdlib/senv.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdlib/senv.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -17,7 +17,7 @@
     _TCHAR* y;
     _TCHAR* FilePart;
 
-    DPRINT(#_tsearchenv"()\n");
+    DPRINT(MK_STR(_tsearchenv)"()\n");
 
     x = _tcschr(env,'=');
     if ( x != NULL ) {

Modified: trunk/reactos/lib/crt/stdlib/strtoull.c
--- trunk/reactos/lib/crt/stdlib/strtoull.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/stdlib/strtoull.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -8,19 +8,23 @@
 #include <stdlib.h>
 #include <internal/file.h>
 
+#if defined (_MSC_VER)
+#define UINT64_MAX	0xffffffffffffffff
+#endif
+
 /*
  * Convert a string to an unsigned long integer.
  *
  * Ignores `locale' stuff.  Assumes that the upper and lower case
  * alphabets and digits are each contiguous.
  */
-uint64_t
+UINT64
 strtoull(const char *nptr, char **endptr, int base)
 {
   const char *s = nptr;
-  uint64_t acc;
+  UINT64 acc;
   int c;
-  uint64_t cutoff;
+  UINT64 cutoff;
   int neg = 0, any, cutlim;
 
   /*

Modified: trunk/reactos/lib/crt/sys_stat/fstat.c
--- trunk/reactos/lib/crt/sys_stat/fstat.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/sys_stat/fstat.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -73,7 +73,7 @@
   else if (dwFileType == FILE_TYPE_PIPE)
   {
     statbuf->st_dev = fd;
-    statbuf->st_mode = S_IFIFO;
+    statbuf->st_mode = -1; //S_IFIFO;
   }
   else
   {

Modified: trunk/reactos/lib/crt/time/difftime.c
--- trunk/reactos/lib/crt/time/difftime.c	2005-11-24 01:49:36 UTC (rev 19514)
+++ trunk/reactos/lib/crt/time/difftime.c	2005-11-24 06:07:04 UTC (rev 19515)
@@ -1,4 +1,5 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include "precomp.h"
 #include <time.h>
 
 /*