cleaned up some warnings.

svn path=/trunk/; revision=3791
This commit is contained in:
Robert Dickenson 2002-11-25 17:41:40 +00:00
parent 8a0cebc9b6
commit a38f0cad21
9 changed files with 131 additions and 143 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.26 2002/11/24 18:42:20 robd Exp $
# $Id: Makefile,v 1.27 2002/11/25 17:41:39 robd Exp $
PATH_TO_TOP = ../..
@ -391,6 +391,7 @@ STDLIB_OBJECTS = \
stdlib/wfulpath.o \
stdlib/witoa.o \
stdlib/witow.o \
stdlib/wputenv.o \
stdlib/wsenv.o \
stdlib/wsplitp.o \
stdlib/wmakpath.o \

View file

@ -3,18 +3,14 @@
#include <msvcrt/internal/file.h>
BOOL STDCALL SetFilePointerEx(
HANDLE hFile, // handle to file
LARGE_INTEGER liDistanceToMove, // bytes to move pointer
PLARGE_INTEGER lpNewFilePointer, // new file pointer
DWORD dwMoveMethod // starting point
);
//#define SETFILEPOINTEREX_AVAILABLE
__int64 _lseeki64(int _fildes, __int64 _offset, int _whence)
{
#if 0
__int64 new_pos;
LARGE_INTEGER offset = _offset;
#ifdef SETFILEPOINTEREX_AVAILABLE
LARGE_INTEGER new_pos;
LARGE_INTEGER offset;
offset.QuadPart = _offset;
// if (invalid_filehnd(_fildes)) {
// errno = EBADF;
@ -25,29 +21,19 @@ __int64 _lseeki64(int _fildes, __int64 _offset, int _whence)
//errno = EINVAL;
return -1L;
}
return new_pos;
return new_pos.QuadPart;
#else
ULONG lo_pos, hi_pos;
//DWORD lo_pos;
//ULONG lo_pos;
//DWORD hi_pos = 0; // must equal 0 or -1 if supplied, -1 for negative 32 seek value
//lo_pos = SetFilePointer((HANDLE)filehnd(_fildes), _offset, &hi_pos, _whence);
//return((((__int64)hi_pos) << 32) + lo_pos);
lo_pos = SetFilePointer((HANDLE)filehnd(_fildes), _offset, &hi_pos, _whence);
return((((__int64)hi_pos) << 32) + lo_pos);
#endif
LARGE_INTEGER offset;
offset.QuadPart = _offset;
offset.u.LowPart = SetFilePointer((HANDLE)filehnd(_fildes),
offset.u.LowPart, &offset.u.HighPart, _whence);
return ((((__int64)offset.u.HighPart) << 32) + offset.u.LowPart);
#endif /*SETFILEPOINTEREX_AVAILABLE*/
}
/*
long _lseek ( int handle, long offset, int origin );
__int64 _lseeki64( int handle, __int64 offset, int origin );
BOOL SetFilePointerEx(
HANDLE hFile, // handle to file
LARGE_INTEGER liDistanceToMove, // bytes to move pointer
PLARGE_INTEGER lpNewFilePointer, // new file pointer
DWORD dwMoveMethod // starting point
);
DWORD SetFilePointer(
HANDLE hFile, // handle to file
LONG lDistanceToMove, // bytes to move pointer
PLONG lpDistanceToMoveHigh, // bytes to move pointer
DWORD dwMoveMethod // starting point
);
*/

View file

@ -1,4 +1,4 @@
/* $Id: crtmain.c,v 1.1 2002/11/24 18:42:23 robd Exp $
/* $Id: crtmain.c,v 1.2 2002/11/25 17:41:39 robd Exp $
*
* ReactOS MSVCRT.DLL Compatibility Library
*/
@ -13,70 +13,11 @@
/* GLOBAL VARIABLES *******************************************************/
int _fltused;
//int _allmul;
/* FUNCTIONS **************************************************************/
int __cdecl _allmul(void)
{
return 0;
}
int __cdecl _allshl(void)
{
return 0;
}
#if 1
void __cdecl _chkesp(int value1, int value2)
{
}
#else
int __cdecl _chkesp(int value)
{
return value;
}
#endif
int __cdecl _alloca_probe(void)
{
return 0;
}
/*
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved);
int STDCALL _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
BOOL result;
//__fileno_init();
//result = DllMain(hInst, ul_reason_for_call, lpReserved);
result = DllMain(hInst, DLL_PROCESS_ATTACH, lpReserved);
return (result ? 1 : 0);
}
*/
/*
int
STDCALL
_abnormal_termination(void)
{
return 0;
}
int
STDCALL
_setjmp(void)
{
return 0;
}
*/
int
STDCALL
@ -110,4 +51,51 @@ _spawnlp(int a, const char* b, const char* args, ...)
#endif /*__GNUC__*/
/*
int __cdecl _allmul(void)
{
return 0;
}
int __cdecl _allshl(void)
{
return 0;
}
void __cdecl _chkesp(int value1, int value2)
{
}
int __cdecl _alloca_probe(void)
{
return 0;
}
int STDCALL _abnormal_termination(void)
{
return 0;
}
int STDCALL _setjmp(void)
{
return 0;
}
*/
/*
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved);
int STDCALL _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
BOOL result;
//__fileno_init();
//result = DllMain(hInst, ul_reason_for_call, lpReserved);
result = DllMain(hInst, DLL_PROCESS_ATTACH, lpReserved);
return (result ? 1 : 0);
}
*/
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: _system.c,v 1.5 2002/11/24 18:42:23 robd Exp $
/* $Id: _system.c,v 1.6 2002/11/25 17:41:39 robd Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -13,6 +13,7 @@
#include <msvcrt/string.h>
#include <msvcrt/process.h>
#include <msvcrt/errno.h>
#include <msvcrt/internal/file.h>
int system(const char *command)
{

View file

@ -33,7 +33,7 @@ int fflush(FILE *f)
__set_errno(0);
_fwalk((void (*)(FILE *))fflush);
if (_errno)
if (errno)
return EOF;
__set_errno(e);
return 0;

View file

@ -150,8 +150,8 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
/* Integral holding variables. */
union
{
LONGLONG int q;
ULONGLONG int uq;
LONGLONG q;
ULONGLONG uq;
long int l;
unsigned long int ul;
} num;
@ -782,19 +782,19 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
if (! number_signed)
{
if (flags & LONGDBL) {
*ARG (ULONGLONG int *) = num.uq;
*ARG (ULONGLONG*) = num.uq;
}
else if (flags & LONG)
*ARG (unsigned long int *) = num.ul;
*ARG (unsigned long int*) = num.ul;
else if (flags & SHORT)
*ARG (unsigned short int *) = (unsigned short int) num.ul;
*ARG (unsigned short int*) = (unsigned short int) num.ul;
else
*ARG (unsigned int *) = (unsigned int) num.ul;
*ARG (unsigned int*) = (unsigned int) num.ul;
}
else
{
if (flags & LONGDBL) {
*ARG (LONGLONG int *) = num.q;
*ARG (LONGLONG *) = num.q;
}
else if (flags & LONG)
*ARG (long int *) = num.l;

View file

@ -8,44 +8,24 @@
extern int BlockEnvToEnviron(); // defined in misc/dllmain.c
int _putenv(const char *val)
int _putenv(const char* val)
{
char *buffer;
char *epos;
int res;
char* buffer;
char* epos;
int res;
DPRINT("_putenv('%s')\n", val);
epos = strchr(val, '=');
if ( epos == NULL )
return -1;
buffer = (char*)malloc(epos - val + 1);
if (buffer == NULL)
return -1;
strncpy(buffer, val, epos - val);
buffer[epos - val] = 0;
res = SetEnvironmentVariableA(buffer,epos+1);
free(buffer);
if (BlockEnvToEnviron()) return 0;
return res;
}
int _wputenv(const wchar_t *val)
{
wchar_t *buffer;
wchar_t *epos;
int res;
DPRINT("_wputenv('%S')\n", val);
epos = wcsrchr(val, L'=');
if ( epos == NULL )
return -1;
buffer = (char*)malloc((epos - val + 1) * sizeof (wchar_t));
if (buffer == NULL)
return -1;
wcsncpy(buffer, val, epos - val);
buffer[epos - val] = 0;
res = SetEnvironmentVariableW(buffer,epos+1);
free(buffer);
if (BlockEnvToEnviron() ) return 0;
return res;
DPRINT("_putenv('%s')\n", val);
epos = strchr(val, '=');
if ( epos == NULL )
return -1;
buffer = (char*)malloc(epos - val + 1);
if (buffer == NULL)
return -1;
strncpy(buffer, val, epos - val);
buffer[epos - val] = 0;
res = SetEnvironmentVariableA(buffer, epos+1);
free(buffer);
if (BlockEnvToEnviron())
return 0;
return res;
}

View file

@ -0,0 +1,31 @@
#include <windows.h>
#include <msvcrt/stdlib.h>
#include <msvcrt/string.h>
#define NDEBUG
#include <msvcrt/msvcrtdbg.h>
extern int BlockEnvToEnviron(); // defined in misc/dllmain.c
int _wputenv(const wchar_t* val)
{
wchar_t* buffer;
wchar_t* epos;
int res;
DPRINT("_wputenv('%S')\n", val);
epos = wcsrchr(val, L'=');
if (epos == NULL)
return -1;
buffer = (char*)malloc((epos - val + 1) * sizeof(wchar_t));
if (buffer == NULL)
return -1;
wcsncpy(buffer, val, epos - val);
buffer[epos - val] = 0;
res = SetEnvironmentVariableW(buffer, epos+1);
free(buffer);
if (BlockEnvToEnviron())
return 0;
return res;
}

View file

@ -1,11 +1,12 @@
#include <msvcrt/ctype.h>
#include <msvcrt/string.h>
wchar_t *_wcsupr(wchar_t *x)
{
wchar_t *y=x;
wchar_t *y = x;
while (*y) {
*y=towupper(*y);
*y = towupper(*y);
y++;
}
return x;