Commit 821f4775 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

- Prefix many more functions, types, structs, etc. with MSVCRT_.

- Correct prototypes for _memccpy()/_memicmp(). - "define before use" reordering in file.c. - Use the new math.h/float.h.
parent 5feedfdc
......@@ -36,18 +36,17 @@
#include "msvcrt/errno.h"
#include "wine/unicode.h"
#include "msvcrt/direct.h"
#include "msvcrt/dos.h"
#include "msvcrt/io.h"
#include "msvcrt/stdlib.h"
#include "msvcrt/string.h"
#include "msvcrt/dos.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/* INTERNAL: Translate WIN32_FIND_DATAA to finddata_t */
static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct _finddata_t* ft)
static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata_t* ft)
{
DWORD dw;
......@@ -67,7 +66,7 @@ static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct _finddata_t* ft)
}
/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata_t */
static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct _wfinddata_t* ft)
static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata_t* ft)
{
DWORD dw;
......@@ -87,7 +86,7 @@ static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct _wfinddata_t* ft)
}
/* INTERNAL: Translate WIN32_FIND_DATAA to finddatai64_t */
static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct _finddatai64_t* ft)
static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddatai64_t* ft)
{
DWORD dw;
......@@ -107,7 +106,7 @@ static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct _finddatai64_t*
}
/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddatai64_t */
static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct _wfinddatai64_t* ft)
static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddatai64_t* ft)
{
DWORD dw;
......@@ -239,7 +238,7 @@ int _findclose(long hand)
* NOTES
* See FindFirstFileA.
*/
long _findfirst(const char * fspec, struct _finddata_t* ft)
long MSVCRT__findfirst(const char * fspec, struct MSVCRT__finddata_t* ft)
{
WIN32_FIND_DATAA find_data;
HANDLE hfind;
......@@ -260,7 +259,7 @@ long _findfirst(const char * fspec, struct _finddata_t* ft)
*
* Unicode version of _findfirst.
*/
long _wfindfirst(const MSVCRT_wchar_t * fspec, struct _wfinddata_t* ft)
long MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddata_t* ft)
{
WIN32_FIND_DATAW find_data;
HANDLE hfind;
......@@ -281,7 +280,7 @@ long _wfindfirst(const MSVCRT_wchar_t * fspec, struct _wfinddata_t* ft)
*
* 64-bit version of _findfirst.
*/
long _findfirsti64(const char * fspec, struct _finddatai64_t* ft)
long MSVCRT__findfirsti64(const char * fspec, struct MSVCRT__finddatai64_t* ft)
{
WIN32_FIND_DATAA find_data;
HANDLE hfind;
......@@ -302,7 +301,7 @@ long _findfirsti64(const char * fspec, struct _finddatai64_t* ft)
*
* Unicode version of _findfirsti64.
*/
long _wfindfirsti64(const MSVCRT_wchar_t * fspec, struct _wfinddatai64_t* ft)
long MSVCRT__wfindfirsti64(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddatai64_t* ft)
{
WIN32_FIND_DATAW find_data;
HANDLE hfind;
......@@ -334,7 +333,7 @@ long _wfindfirsti64(const MSVCRT_wchar_t * fspec, struct _wfinddatai64_t* ft)
* NOTES
* See FindNextFileA.
*/
int _findnext(long hand, struct _finddata_t * ft)
int MSVCRT__findnext(long hand, struct MSVCRT__finddata_t * ft)
{
WIN32_FIND_DATAA find_data;
......@@ -353,7 +352,7 @@ int _findnext(long hand, struct _finddata_t * ft)
*
* Unicode version of _findnext.
*/
int _wfindnext(long hand, struct _wfinddata_t * ft)
int MSVCRT__wfindnext(long hand, struct MSVCRT__wfinddata_t * ft)
{
WIN32_FIND_DATAW find_data;
......@@ -372,7 +371,7 @@ int _wfindnext(long hand, struct _wfinddata_t * ft)
*
* 64-bit version of _findnext.
*/
int _findnexti64(long hand, struct _finddatai64_t * ft)
int MSVCRT__findnexti64(long hand, struct MSVCRT__finddatai64_t * ft)
{
WIN32_FIND_DATAA find_data;
......@@ -391,7 +390,7 @@ int _findnexti64(long hand, struct _finddatai64_t * ft)
*
* Unicode version of _findnexti64.
*/
int _wfindnexti64(long hand, struct _wfinddatai64_t * ft)
int MSVCRT__wfindnexti64(long hand, struct MSVCRT__wfinddatai64_t * ft)
{
WIN32_FIND_DATAW find_data;
......@@ -600,7 +599,7 @@ MSVCRT_wchar_t* _wgetdcwd(int drive, MSVCRT_wchar_t * buf, int size)
* NOTES
* See GetLastError().
*/
unsigned int _getdiskfree(unsigned int disk, struct _diskfree_t* d)
unsigned int MSVCRT__getdiskfree(unsigned int disk, struct MSVCRT(_diskfree_t)* d)
{
WCHAR drivespec[4] = {'@', ':', '\\', 0};
DWORD ret[4];
......
......@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
void MSVCRT__set_errno(int err)
{
int *errno = MSVCRT__errno();
unsigned long *doserrno = __doserrno();
unsigned long *doserrno = MSVCRT___doserrno();
*doserrno = err;
......@@ -99,15 +99,15 @@ void MSVCRT__set_errno(int err)
*/
int* MSVCRT__errno(void)
{
return &msvcrt_get_thread_data()->errno;
return &msvcrt_get_thread_data()->thread_errno;
}
/*********************************************************************
* __doserrno (MSVCRT.@)
*/
unsigned long* __doserrno(void)
unsigned long* MSVCRT___doserrno(void)
{
return &msvcrt_get_thread_data()->doserrno;
return &msvcrt_get_thread_data()->thread_doserrno;
}
/*********************************************************************
......@@ -124,7 +124,7 @@ char* MSVCRT_strerror(int err)
char* _strerror(const char* err)
{
static char strerrbuff[256]; /* FIXME: Per thread, nprintf */
sprintf(strerrbuff,"%s: %s\n",err,MSVCRT_strerror(msvcrt_get_thread_data()->errno));
sprintf(strerrbuff,"%s: %s\n",err,MSVCRT_strerror(msvcrt_get_thread_data()->thread_errno));
return strerrbuff;
}
......@@ -133,7 +133,7 @@ char* _strerror(const char* err)
*/
void MSVCRT_perror(const char* str)
{
_cprintf("%s: %s\n",str,MSVCRT_strerror(msvcrt_get_thread_data()->errno));
_cprintf("%s: %s\n",str,MSVCRT_strerror(msvcrt_get_thread_data()->thread_errno));
}
/******************************************************************************
......
......@@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define LOCK_EXIT _mlock(_EXIT_LOCK1)
#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
static _onexit_t *MSVCRT_atexit_table = NULL;
static MSVCRT__onexit_t *MSVCRT_atexit_table = NULL;
static int MSVCRT_atexit_table_size = 0;
static int MSVCRT_atexit_registered = 0; /* Points to free slot */
......@@ -63,9 +63,9 @@ void __MSVCRT__call_atexit(void)
/*********************************************************************
* __dllonexit (MSVCRT.@)
*/
_onexit_t __dllonexit(_onexit_t func, _onexit_t **start, _onexit_t **end)
MSVCRT__onexit_t __dllonexit(MSVCRT__onexit_t func, MSVCRT__onexit_t **start, MSVCRT__onexit_t **end)
{
_onexit_t *tmp;
MSVCRT__onexit_t *tmp;
int len;
TRACE("(%p,%p,%p)\n", func, start, end);
......@@ -83,7 +83,7 @@ _onexit_t __dllonexit(_onexit_t func, _onexit_t **start, _onexit_t **end)
if (++len <= 0)
return NULL;
tmp = (_onexit_t *)MSVCRT_realloc(*start, len * sizeof(tmp));
tmp = (MSVCRT__onexit_t *)MSVCRT_realloc(*start, len * sizeof(tmp));
if (!tmp)
return NULL;
*start = tmp;
......@@ -200,7 +200,7 @@ void MSVCRT__cexit(void)
/*********************************************************************
* _onexit (MSVCRT.@)
*/
_onexit_t _onexit(_onexit_t func)
MSVCRT__onexit_t MSVCRT__onexit(MSVCRT__onexit_t func)
{
TRACE("(%p)\n",func);
......@@ -210,7 +210,7 @@ _onexit_t _onexit(_onexit_t func)
LOCK_EXIT;
if (MSVCRT_atexit_registered > MSVCRT_atexit_table_size - 1)
{
_onexit_t *newtable;
MSVCRT__onexit_t *newtable;
TRACE("expanding table\n");
newtable = MSVCRT_calloc(sizeof(void *),MSVCRT_atexit_table_size + 32);
if (!newtable)
......@@ -249,7 +249,7 @@ void MSVCRT_exit(int exitcode)
int MSVCRT_atexit(void (*func)(void))
{
TRACE("(%p)\n", func);
return _onexit((_onexit_t)func) == (_onexit_t)func ? 0 : -1;
return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1;
}
......
......@@ -39,7 +39,6 @@
#include "msvcrt/errno.h"
#include "wine/unicode.h"
#include "msvcrt/direct.h"
#include "msvcrt/fcntl.h"
#include "msvcrt/io.h"
#include "msvcrt/sys/locking.h"
......@@ -51,6 +50,7 @@
#include "msvcrt/time.h"
#include "msvcrt/share.h"
#include "msvcrt/wctype.h"
#include "msvcrt/direct.h"
#include "wine/debug.h"
......@@ -98,7 +98,7 @@ extern CRITICAL_SECTION MSVCRT_file_cs;
#define LOCK_FILES EnterCriticalSection(&MSVCRT_file_cs)
#define UNLOCK_FILES LeaveCriticalSection(&MSVCRT_file_cs)
static void msvcrt_cp_from_stati64(const struct _stati64 *bufi64, struct _stat *buf)
static void msvcrt_cp_from_stati64(const struct MSVCRT__stati64 *bufi64, struct MSVCRT__stat *buf)
{
buf->st_dev = bufi64->st_dev;
buf->st_ino = bufi64->st_ino;
......@@ -120,7 +120,7 @@ static HANDLE msvcrt_fdtoh(int fd)
MSVCRT_handles[fd] == INVALID_HANDLE_VALUE)
{
WARN(":fd (%d) - no handle!\n",fd);
*__doserrno() = 0;
*MSVCRT___doserrno() = 0;
*MSVCRT__errno() = MSVCRT_EBADF;
return INVALID_HANDLE_VALUE;
}
......@@ -178,7 +178,7 @@ static MSVCRT_FILE* msvcrt_alloc_fp(int fd)
MSVCRT_handles[fd] == INVALID_HANDLE_VALUE)
{
WARN(":invalid fd %d\n",fd);
*__doserrno() = 0;
*MSVCRT___doserrno() = 0;
*MSVCRT__errno() = MSVCRT_EBADF;
return NULL;
}
......@@ -223,15 +223,6 @@ void msvcrt_init_io(void)
}
}
/* free everything on process exit */
void msvcrt_free_io(void)
{
_fcloseall();
_close(0);
_close(1);
_close(2);
}
/* INTERNAL: Flush stdio file buffer */
static int msvcrt_flush_buffer(MSVCRT_FILE* file)
{
......@@ -428,6 +419,49 @@ int _wunlink(const MSVCRT_wchar_t *path)
return -1;
}
/* _flushall calls MSVCRT_fflush which calls _flushall */
int MSVCRT_fflush(MSVCRT_FILE* file);
/*********************************************************************
* _flushall (MSVCRT.@)
*/
int _flushall(void)
{
int i, num_flushed = 0;
for (i = 3; i < MSVCRT_fdend; i++)
if (MSVCRT_handles[i] != INVALID_HANDLE_VALUE)
{
#if 0
/* FIXME: flush, do not commit */
if (_commit(i) == -1)
if (MSVCRT_files[i])
MSVCRT_files[i]->_flag |= MSVCRT__IOERR;
#endif
if(MSVCRT_files[i] && MSVCRT_files[i]->_flag & MSVCRT__IOWRT) {
MSVCRT_fflush(MSVCRT_files[i]);
num_flushed++;
}
}
TRACE(":flushed (%d) handles\n",num_flushed);
return num_flushed;
}
/*********************************************************************
* fflush (MSVCRT.@)
*/
int MSVCRT_fflush(MSVCRT_FILE* file)
{
if(!file) {
_flushall();
return 0;
} else {
int res=msvcrt_flush_buffer(file);
return res;
}
}
/*********************************************************************
* _close (MSVCRT.@)
*/
......@@ -532,7 +566,7 @@ int _eof(int fd)
/*********************************************************************
* _fcloseall (MSVCRT.@)
*/
int _fcloseall(void)
int MSVCRT__fcloseall(void)
{
int num_closed = 0, i;
......@@ -547,6 +581,15 @@ int _fcloseall(void)
return num_closed;
}
/* free everything on process exit */
void msvcrt_free_io(void)
{
MSVCRT__fcloseall();
_close(0);
_close(1);
_close(2);
}
/*********************************************************************
* _lseeki64 (MSVCRT.@)
*/
......@@ -646,7 +689,7 @@ int _locking(int fd, int mode, LONG nbytes)
{
ret = LockFile(hand, cur_locn, 0L, nbytes, 0L);
if (ret) break;
sleep (1);
_sleep (1);
}
}
else if (mode == _LK_UNLCK)
......@@ -658,6 +701,37 @@ int _locking(int fd, int mode, LONG nbytes)
}
/*********************************************************************
* fseek (MSVCRT.@)
*/
int MSVCRT_fseek(MSVCRT_FILE* file, long offset, int whence)
{
/* Flush output if needed */
if(file->_flag & MSVCRT__IOWRT)
msvcrt_flush_buffer(file);
if(whence == SEEK_CUR && file->_flag & MSVCRT__IOREAD ) {
offset -= file->_cnt;
}
/* Discard buffered input */
file->_cnt = 0;
file->_ptr = file->_base;
/* Reset direction of i/o */
if(file->_flag & MSVCRT__IORW) {
file->_flag &= ~(MSVCRT__IOREAD|MSVCRT__IOWRT);
}
return (_lseek(file->_file,offset,whence) == -1)?-1:0;
}
/*********************************************************************
* clearerr (MSVCRT.@)
*/
void MSVCRT_clearerr(MSVCRT_FILE* file)
{
TRACE(":file (%p) fd (%d)\n",file,file->_file);
file->_flag &= ~(MSVCRT__IOERR | MSVCRT__IOEOF);
}
/*********************************************************************
* rewind (MSVCRT.@)
*/
void MSVCRT_rewind(MSVCRT_FILE* file)
......@@ -670,7 +744,7 @@ void MSVCRT_rewind(MSVCRT_FILE* file)
/*********************************************************************
* _fdopen (MSVCRT.@)
*/
MSVCRT_FILE* _fdopen(int fd, const char *mode)
MSVCRT_FILE* MSVCRT__fdopen(int fd, const char *mode)
{
MSVCRT_FILE* file = msvcrt_alloc_fp(fd);
......@@ -682,7 +756,7 @@ MSVCRT_FILE* _fdopen(int fd, const char *mode)
/*********************************************************************
* _wfdopen (MSVCRT.@)
*/
MSVCRT_FILE* _wfdopen(int fd, const MSVCRT_wchar_t *mode)
MSVCRT_FILE* MSVCRT__wfdopen(int fd, const MSVCRT_wchar_t *mode)
{
MSVCRT_FILE* file = msvcrt_alloc_fp(fd);
......@@ -734,42 +808,16 @@ __int64 _filelengthi64(int fd)
/*********************************************************************
* _fileno (MSVCRT.@)
*/
int _fileno(MSVCRT_FILE* file)
int MSVCRT__fileno(MSVCRT_FILE* file)
{
TRACE(":FILE* (%p) fd (%d)\n",file,file->_file);
return file->_file;
}
/*********************************************************************
* _flushall (MSVCRT.@)
*/
int _flushall(void)
{
int i, num_flushed = 0;
for (i = 3; i < MSVCRT_fdend; i++)
if (MSVCRT_handles[i] != INVALID_HANDLE_VALUE)
{
#if 0
/* FIXME: flush, do not commit */
if (_commit(i) == -1)
if (MSVCRT_files[i])
MSVCRT_files[i]->_flag |= MSVCRT__IOERR;
#endif
if(MSVCRT_files[i] && MSVCRT_files[i]->_flag & MSVCRT__IOWRT) {
MSVCRT_fflush(MSVCRT_files[i]);
num_flushed++;
}
}
TRACE(":flushed (%d) handles\n",num_flushed);
return num_flushed;
}
/*********************************************************************
* _fstati64 (MSVCRT.@)
*/
int _fstati64(int fd, struct _stati64* buf)
int MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf)
{
DWORD dw;
BY_HANDLE_FILE_INFORMATION hfi;
......@@ -787,7 +835,7 @@ int _fstati64(int fd, struct _stati64* buf)
}
memset(&hfi, 0, sizeof(hfi));
memset(buf, 0, sizeof(struct _stati64));
memset(buf, 0, sizeof(struct MSVCRT__stati64));
if (!GetFileInformationByHandle(hand, &hfi))
{
WARN(":failed-last error (%ld)\n",GetLastError());
......@@ -807,11 +855,11 @@ int _fstati64(int fd, struct _stati64* buf)
/*********************************************************************
* _fstat (MSVCRT.@)
*/
int MSVCRT__fstat(int fd, struct _stat* buf)
int MSVCRT__fstat(int fd, struct MSVCRT__stat* buf)
{ int ret;
struct _stati64 bufi64;
struct MSVCRT__stati64 bufi64;
ret = _fstati64(fd, &bufi64);
ret = MSVCRT__fstati64(fd, &bufi64);
if (!ret)
msvcrt_cp_from_stati64(&bufi64, buf);
return ret;
......@@ -1283,7 +1331,7 @@ int _read(int fd, void *buf, unsigned int count)
/*********************************************************************
* _getw (MSVCRT.@)
*/
int _getw(MSVCRT_FILE* file)
int MSVCRT__getw(MSVCRT_FILE* file)
{
int i;
if (_read(file->_file, &i, sizeof(int)) != 1)
......@@ -1307,7 +1355,7 @@ int _setmode(int fd,int mode)
/*********************************************************************
* _stati64 (MSVCRT.@)
*/
int _stati64(const char* path, struct _stati64 * buf)
int MSVCRT__stati64(const char* path, struct MSVCRT__stati64 * buf)
{
DWORD dw;
WIN32_FILE_ATTRIBUTE_DATA hfi;
......@@ -1323,7 +1371,7 @@ int _stati64(const char* path, struct _stati64 * buf)
return -1;
}
memset(buf,0,sizeof(struct _stati64));
memset(buf,0,sizeof(struct MSVCRT__stati64));
/* FIXME: rdev isn't drive num, despite what the docs say-what is it?
Bon 011120: This FIXME seems incorrect
......@@ -1373,11 +1421,11 @@ int _stati64(const char* path, struct _stati64 * buf)
/*********************************************************************
* _stat (MSVCRT.@)
*/
int MSVCRT__stat(const char* path, struct _stat * buf)
int MSVCRT__stat(const char* path, struct MSVCRT__stat * buf)
{ int ret;
struct _stati64 bufi64;
struct MSVCRT__stati64 bufi64;
ret = _stati64( path, &bufi64);
ret = MSVCRT__stati64( path, &bufi64);
if (!ret)
msvcrt_cp_from_stati64(&bufi64, buf);
return ret;
......@@ -1386,7 +1434,7 @@ int MSVCRT__stat(const char* path, struct _stat * buf)
/*********************************************************************
* _wstati64 (MSVCRT.@)
*/
int _wstati64(const MSVCRT_wchar_t* path, struct _stati64 * buf)
int MSVCRT__wstati64(const MSVCRT_wchar_t* path, struct MSVCRT__stati64 * buf)
{
DWORD dw;
WIN32_FILE_ATTRIBUTE_DATA hfi;
......@@ -1402,7 +1450,7 @@ int _wstati64(const MSVCRT_wchar_t* path, struct _stati64 * buf)
return -1;
}
memset(buf,0,sizeof(struct _stat));
memset(buf,0,sizeof(struct MSVCRT__stat));
/* FIXME: rdev isn't drive num, despite what the docs says-what is it? */
if (MSVCRT_iswalpha(*path))
......@@ -1448,12 +1496,12 @@ int _wstati64(const MSVCRT_wchar_t* path, struct _stati64 * buf)
/*********************************************************************
* _wstat (MSVCRT.@)
*/
int _wstat(const MSVCRT_wchar_t* path, struct _stat * buf)
int MSVCRT__wstat(const MSVCRT_wchar_t* path, struct MSVCRT__stat * buf)
{
int ret;
struct _stati64 bufi64;
struct MSVCRT__stati64 bufi64;
ret = _wstati64( path, &bufi64 );
ret = MSVCRT__wstati64( path, &bufi64 );
if (!ret) msvcrt_cp_from_stati64(&bufi64, buf);
return ret;
}
......@@ -1650,21 +1698,12 @@ int _write(int fd, const void* buf, unsigned int count)
/*********************************************************************
* _putw (MSVCRT.@)
*/
int _putw(int val, MSVCRT_FILE* file)
int MSVCRT__putw(int val, MSVCRT_FILE* file)
{
return _write(file->_file, &val, sizeof(val)) == 1? val : MSVCRT_EOF;
}
/*********************************************************************
* clearerr (MSVCRT.@)
*/
void MSVCRT_clearerr(MSVCRT_FILE* file)
{
TRACE(":file (%p) fd (%d)\n",file,file->_file);
file->_flag &= ~(MSVCRT__IOERR | MSVCRT__IOEOF);
}
/*********************************************************************
* fclose (MSVCRT.@)
*/
int MSVCRT_fclose(MSVCRT_FILE* file)
......@@ -1693,44 +1732,9 @@ int MSVCRT_ferror(MSVCRT_FILE* file)
}
/*********************************************************************
* fflush (MSVCRT.@)
*/
int MSVCRT_fflush(MSVCRT_FILE* file)
{
if(!file) {
_flushall();
return 0;
} else {
int res=msvcrt_flush_buffer(file);
return res;
}
}
/*********************************************************************
* fgetc (MSVCRT.@)
*/
int MSVCRT_fgetc(MSVCRT_FILE* file)
{
if (file->_cnt>0) {
file->_cnt--;
return *(unsigned char *)file->_ptr++;
} else {
return _filbuf(file);
}
}
/*********************************************************************
* _fgetchar (MSVCRT.@)
*/
int _fgetchar(void)
{
return MSVCRT_fgetc(MSVCRT_stdin);
}
/*********************************************************************
* _filbuf (MSVCRT.@)
*/
int _filbuf(MSVCRT_FILE* file)
int MSVCRT__filbuf(MSVCRT_FILE* file)
{
/* Allocate buffer if needed */
......@@ -1765,12 +1769,24 @@ int _filbuf(MSVCRT_FILE* file)
}
/*********************************************************************
* fgetpos (MSVCRT.@)
* fgetc (MSVCRT.@)
*/
int MSVCRT_fgetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
int MSVCRT_fgetc(MSVCRT_FILE* file)
{
*pos = MSVCRT_ftell(file);
return (*pos == -1? -1 : 0);
if (file->_cnt>0) {
file->_cnt--;
return *(unsigned char *)file->_ptr++;
} else {
return MSVCRT__filbuf(file);
}
}
/*********************************************************************
* _fgetchar (MSVCRT.@)
*/
int _fgetchar(void)
{
return MSVCRT_fgetc(MSVCRT_stdin);
}
/*********************************************************************
......@@ -1881,6 +1897,40 @@ MSVCRT_wchar_t *MSVCRT_fgetws(MSVCRT_wchar_t *s, int size, MSVCRT_FILE* file)
return buf_start;
}
/*********************************************************************
* fwrite (MSVCRT.@)
*/
MSVCRT_size_t MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
{
MSVCRT_size_t wrcnt=size * nmemb;
int written = 0;
if (size == 0)
return 0;
if(file->_cnt) {
int pcnt=(file->_cnt>wrcnt)? wrcnt: file->_cnt;
memcpy(file->_ptr, ptr, pcnt);
file->_cnt -= pcnt;
file->_ptr += pcnt;
written = pcnt;
wrcnt -= pcnt;
ptr = (char*)ptr + pcnt;
} else if(!(file->_flag & MSVCRT__IOWRT)) {
if(file->_flag & MSVCRT__IORW) {
file->_flag |= MSVCRT__IOWRT;
} else
return 0;
}
if(wrcnt) {
/* Flush buffer */
int res=msvcrt_flush_buffer(file);
if(!res) {
int pwritten = _write(file->_file, ptr, wrcnt);
if (pwritten <= 0) pwritten=0;
written += pwritten;
}
}
return written / size;
}
/*********************************************************************
* fputwc (MSVCRT.@)
......@@ -1965,7 +2015,7 @@ MSVCRT_FILE* MSVCRT_fopen(const char *path, const char *mode)
/*********************************************************************
* _wfopen (MSVCRT.@)
*/
MSVCRT_FILE *_wfopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode)
MSVCRT_FILE *MSVCRT__wfopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode)
{
const unsigned int plen = strlenW(path), mlen = strlenW(mode);
char *patha = MSVCRT_calloc(plen + 1, 1);
......@@ -1999,13 +2049,16 @@ MSVCRT_FILE* _fsopen(const char *path, const char *mode, int share)
/*********************************************************************
* _wfsopen (MSVCRT.@)
*/
MSVCRT_FILE* _wfsopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode, int share)
MSVCRT_FILE* MSVCRT__wfsopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode, int share)
{
FIXME(":(%s,%s,%d),ignoring share mode!\n",
debugstr_w(path),debugstr_w(mode),share);
return _wfopen(path,mode);
return MSVCRT__wfopen(path,mode);
}
/* MSVCRT_fputc calls MSVCRT__flsbuf which calls MSVCRT_fputc */
int MSVCRT__flsbuf(int c, MSVCRT_FILE* file);
/*********************************************************************
* fputc (MSVCRT.@)
*/
......@@ -2016,14 +2069,14 @@ int MSVCRT_fputc(int c, MSVCRT_FILE* file)
file->_cnt--;
return c;
} else {
return _flsbuf(c, file);
return MSVCRT__flsbuf(c, file);
}
}
/*********************************************************************
* _flsbuf (MSVCRT.@)
*/
int _flsbuf(int c, MSVCRT_FILE* file)
int MSVCRT__flsbuf(int c, MSVCRT_FILE* file)
{
/* Flush output buffer */
if(file->_bufsiz == 0 && !(file->_flag & MSVCRT__IONBF)) {
......@@ -2147,28 +2200,6 @@ int MSVCRT_fsetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
}
/*********************************************************************
* fseek (MSVCRT.@)
*/
int MSVCRT_fseek(MSVCRT_FILE* file, long offset, int whence)
{
/* Flush output if needed */
if(file->_flag & MSVCRT__IOWRT)
msvcrt_flush_buffer(file);
if(whence == SEEK_CUR && file->_flag & MSVCRT__IOREAD ) {
offset -= file->_cnt;
}
/* Discard buffered input */
file->_cnt = 0;
file->_ptr = file->_base;
/* Reset direction of i/o */
if(file->_flag & MSVCRT__IORW) {
file->_flag &= ~(MSVCRT__IOREAD|MSVCRT__IOWRT);
}
return (_lseek(file->_file,offset,whence) == -1)?-1:0;
}
/*********************************************************************
* ftell (MSVCRT.@)
*/
LONG MSVCRT_ftell(MSVCRT_FILE* file)
......@@ -2188,38 +2219,12 @@ LONG MSVCRT_ftell(MSVCRT_FILE* file)
}
/*********************************************************************
* fwrite (MSVCRT.@)
* fgetpos (MSVCRT.@)
*/
MSVCRT_size_t MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
int MSVCRT_fgetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
{
MSVCRT_size_t wrcnt=size * nmemb;
int written = 0;
if (size == 0)
return 0;
if(file->_cnt) {
int pcnt=(file->_cnt>wrcnt)? wrcnt: file->_cnt;
memcpy(file->_ptr, ptr, pcnt);
file->_cnt -= pcnt;
file->_ptr += pcnt;
written = pcnt;
wrcnt -= pcnt;
ptr = (char*)ptr + pcnt;
} else if(!(file->_flag & MSVCRT__IOWRT)) {
if(file->_flag & MSVCRT__IORW) {
file->_flag |= MSVCRT__IOWRT;
} else
return 0;
}
if(wrcnt) {
/* Flush buffer */
int res=msvcrt_flush_buffer(file);
if(!res) {
int pwritten = _write(file->_file, ptr, wrcnt);
if (pwritten <= 0) pwritten=0;
written += pwritten;
}
}
return written / size;
*pos = MSVCRT_ftell(file);
return (*pos == -1? -1 : 0);
}
/*********************************************************************
......
......@@ -18,8 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "msvcrt.h"
#include "msvcrt/errno.h"
#include <stdio.h>
#define __USE_ISOC9X 1
......@@ -29,7 +27,11 @@
#include <ieeefp.h>
#endif
#include "msvcrt.h"
#include "msvcrt/errno.h"
#include "msvcrt/stdlib.h"
#include "msvcrt/math.h"
#include "msvcrt/float.h"
#include "wine/debug.h"
......@@ -49,70 +51,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define signbit(x) 0
#endif
/* fpclass constants */
#define _FPCLASS_SNAN 1
#define _FPCLASS_QNAN 2
#define _FPCLASS_NINF 4
#define _FPCLASS_NN 8
#define _FPCLASS_ND 16
#define _FPCLASS_NZ 32
#define _FPCLASS_PZ 64
#define _FPCLASS_PD 128
#define _FPCLASS_PN 256
#define _FPCLASS_PINF 512
/* _statusfp bit flags */
#define _SW_INEXACT 0x1
#define _SW_UNDERFLOW 0x2
#define _SW_OVERFLOW 0x4
#define _SW_ZERODIVIDE 0x8
#define _SW_INVALID 0x10
#define _SW_DENORMAL 0x80000
/* _controlfp masks and bitflags - x86 only so far*/
#ifdef __i386__
#define _MCW_EM 0x8001f
#define _EM_INEXACT 0x1
#define _EM_UNDERFLOW 0x2
#define _EM_OVERFLOW 0x4
#define _EM_ZERODIVIDE 0x8
#define _EM_INVALID 0x10
#define _MCW_RC 0x300
#define _RC_NEAR 0x0
#define _RC_DOWN 0x100
#define _RC_UP 0x200
#define _RC_CHOP 0x300
#define _MCW_PC 0x30000
#define _PC_64 0x0
#define _PC_53 0x10000
#define _PC_24 0x20000
#define _MCW_IC 0x40000
#define _IC_AFFINE 0x40000
#define _IC_PROJECTIVE 0x0
#define _EM_DENORMAL 0x80000
#endif
typedef struct __MSVCRT_complex
{
double real;
double imaginary;
} MSVCRT_complex;
typedef struct __MSVCRT_exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
} MSVCRT_exception;
typedef int (*MSVCRT_matherr_func)(MSVCRT_exception *);
typedef int (*MSVCRT_matherr_func)(struct MSVCRT__exception *);
static MSVCRT_matherr_func MSVCRT_default_matherr_func = NULL;
......@@ -409,7 +348,7 @@ double _scalb(double num, long power)
/*********************************************************************
* _matherr (MSVCRT.@)
*/
int _matherr(MSVCRT_exception *e)
int MSVCRT__matherr(struct MSVCRT__exception *e)
{
if (e)
TRACE("(%p = %d, %s, %g %g %g)\n",e, e->type, e->name, e->arg1, e->arg2,
......@@ -492,9 +431,9 @@ double MSVCRT_ldexp(double num, long exp)
/*********************************************************************
* _cabs (MSVCRT.@)
*/
double _cabs(MSVCRT_complex num)
double MSVCRT__cabs(struct MSVCRT__complex num)
{
return sqrt(num.real * num.real + num.imaginary * num.imaginary);
return sqrt(num.x * num.x + num.y * num.y);
}
/*********************************************************************
......
......@@ -36,8 +36,8 @@ extern DWORD MSVCRT_tls_index;
typedef struct __MSVCRT_thread_data
{
int errno;
unsigned long doserrno;
int thread_errno;
unsigned long thread_doserrno;
char *mbstok_next; /* next ptr for mbstok() */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
int fpecode;
......
......@@ -88,7 +88,7 @@
@ stub __crtGetLocaleInfoW
@ cdecl __crtLCMapStringA(long long str long ptr long long long)
@ cdecl __dllonexit(ptr ptr ptr)
@ cdecl __doserrno()
@ cdecl __doserrno() MSVCRT___doserrno
@ cdecl __fpecode()
@ cdecl __getmainargs(ptr ptr ptr long ptr)
@ extern __initenv MSVCRT___initenv
......@@ -170,7 +170,7 @@
@ cdecl _beginthread (ptr long ptr)
@ cdecl _beginthreadex (ptr long ptr ptr long ptr)
@ cdecl _c_exit() MSVCRT__c_exit
@ cdecl _cabs(long)
@ cdecl _cabs(long) MSVCRT__cabs
@ cdecl _callnewh(long)
@ cdecl _cexit() MSVCRT__cexit
@ cdecl _cgets(str)
......@@ -215,23 +215,23 @@
@ cdecl _execvpe(str str str)
@ cdecl _exit(long) MSVCRT__exit
@ cdecl _expand(ptr long)
@ cdecl _fcloseall()
@ cdecl _fcloseall() MSVCRT__fcloseall
@ cdecl _fcvt(double long ptr ptr)
@ cdecl _fdopen(long str)
@ cdecl _fdopen(long str) MSVCRT__fdopen
@ cdecl _fgetchar()
@ cdecl _fgetwchar()
@ cdecl _filbuf(ptr)
@ cdecl _filbuf(ptr) MSVCRT__filbuf
@ stub _fileinfo
@ cdecl _filelength(long)
@ cdecl -ret64 _filelengthi64(long)
@ cdecl _fileno(ptr)
@ cdecl _fileno(ptr) MSVCRT__fileno
@ cdecl _findclose(long)
@ cdecl _findfirst(str ptr)
@ cdecl _findfirsti64(str ptr)
@ cdecl _findnext(long ptr)
@ cdecl _findnexti64(long ptr)
@ cdecl _findfirst(str ptr) MSVCRT__findfirst
@ cdecl _findfirsti64(str ptr) MSVCRT__findfirsti64
@ cdecl _findnext(long ptr) MSVCRT__findnext
@ cdecl _findnexti64(long ptr) MSVCRT__findnexti64
@ cdecl _finite( double )
@ cdecl _flsbuf(long ptr)
@ cdecl _flsbuf(long ptr) MSVCRT__flsbuf
@ cdecl _flushall()
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double)
......@@ -241,7 +241,7 @@
@ cdecl _fputwchar(long)
@ cdecl _fsopen(str str long)
@ cdecl _fstat(long ptr) MSVCRT__fstat
@ cdecl _fstati64(long ptr)
@ cdecl _fstati64(long ptr) MSVCRT__fstati64
@ cdecl _ftime(ptr)
@ cdecl -ret64 _ftol() ntdll._ftol
@ cdecl _fullpath(ptr str long)
......@@ -253,7 +253,7 @@
@ cdecl _getche()
@ cdecl _getcwd(str long)
@ cdecl _getdcwd(long str long)
@ cdecl _getdiskfree(long ptr)
@ cdecl _getdiskfree(long ptr) MSVCRT__getdiskfree
@ cdecl _getdllprocaddr(long str long)
@ cdecl _getdrive()
@ cdecl _getdrives() kernel32.GetLogicalDrives
......@@ -261,7 +261,7 @@
@ cdecl _getmbcp()
@ cdecl _getpid() kernel32.GetCurrentProcessId
@ stub _getsystime #(ptr)
@ cdecl _getw(ptr)
@ cdecl _getw(ptr) MSVCRT__getw
@ cdecl _getws(ptr) MSVCRT__getws
@ cdecl _global_unwind2(ptr)
@ cdecl _heapadd (ptr long)
......@@ -331,7 +331,7 @@
@ cdecl _ltoa(long ptr long) ntdll._ltoa
@ cdecl _ltow(long ptr long) ntdll._ltow
@ cdecl _makepath(str str str str str)
@ cdecl _matherr(ptr)
@ cdecl _matherr(ptr) MSVCRT__matherr
@ cdecl _mbbtombc(long)
@ stub _mbbtype #(long long)
@ stub _mbcasemap
......@@ -393,22 +393,22 @@
@ cdecl _mktemp(str)
@ cdecl _msize(ptr)
@ cdecl _nextafter(double double)
@ cdecl _onexit(ptr)
@ cdecl _onexit(ptr) MSVCRT__onexit
@ varargs _open(str long)
@ cdecl _open_osfhandle(long long)
@ extern _osver MSVCRT__osver
@ stub _outp #(long long)
@ stub _outpd #(long long)
@ stub _outpw #(long long)
@ cdecl _pclose (ptr)
@ cdecl _pclose (ptr) MSVCRT__pclose
@ extern _pctype MSVCRT__pctype
@ extern _pgmptr MSVCRT__pgmptr
@ stub _pipe #(ptr long long)
@ cdecl _popen (str str)
@ cdecl _popen (str str) MSVCRT__popen
@ cdecl _purecall()
@ cdecl _putch(long)
@ cdecl _putenv(str)
@ cdecl _putw(long ptr)
@ cdecl _putw(long ptr) MSVCRT__putw
@ cdecl _putws(wstr)
@ stub _pwctype
@ cdecl _read(long ptr long)
......@@ -446,7 +446,7 @@
@ cdecl _spawnvpe(long str ptr ptr)
@ cdecl _splitpath(str ptr ptr ptr ptr) ntdll._splitpath
@ cdecl _stat(str ptr) MSVCRT__stat
@ cdecl _stati64(str ptr)
@ cdecl _stati64(str ptr) MSVCRT__stati64
@ cdecl _statusfp()
@ cdecl _strcmpi(str str) strcasecmp
@ cdecl _strdate(ptr)
......@@ -463,7 +463,7 @@
@ cdecl _strset(str long)
@ cdecl _strtime(ptr)
@ cdecl _strupr(str) ntdll._strupr
@ cdecl _swab(str str long)
@ cdecl _swab(str str long) MSVCRT__swab
@ extern _sys_errlist MSVCRT__sys_errlist
@ extern _sys_nerr MSVCRT__sys_nerr
@ cdecl _tell(long)
......@@ -487,7 +487,7 @@
@ cdecl _vsnprintf(ptr long ptr ptr) vsnprintf
@ cdecl _vsnwprintf(ptr long wstr long)
@ cdecl _waccess(wstr long)
@ stub _wasctime #(ptr)
@ stub _wasctime #(ptr) MSVCRT__wasctime
@ cdecl _wchdir(wstr)
@ cdecl _wchmod(wstr long)
@ extern _wcmdln MSVCRT__wcmdln
......@@ -513,14 +513,14 @@
@ stub _wexecve #(wstr ptr ptr)
@ stub _wexecvp #(wstr ptr)
@ stub _wexecvpe #(wstr ptr ptr)
@ cdecl _wfdopen(long wstr)
@ cdecl _wfindfirst(wstr ptr)
@ cdecl _wfindfirsti64(wstr ptr)
@ cdecl _wfindnext(long ptr)
@ cdecl _wfindnexti64(long ptr)
@ cdecl _wfopen(wstr wstr)
@ stub _wfreopen #(wstr wstr ptr)
@ cdecl _wfsopen(wstr wstr long)
@ cdecl _wfdopen(long wstr) MSVCRT__wfdopen
@ cdecl _wfindfirst(wstr ptr) MSVCRT__wfindfirst
@ cdecl _wfindfirsti64(wstr ptr) MSVCRT__wfindfirsti64
@ cdecl _wfindnext(long ptr) MSVCRT__wfindnext
@ cdecl _wfindnexti64(long ptr) MSVCRT__wfindnexti64
@ cdecl _wfopen(wstr wstr) MSVCRT__wfopen
@ stub _wfreopen #(wstr wstr ptr) MSVCRT__wfreopen
@ cdecl _wfsopen(wstr wstr long) MSVCRT__wfsopen
@ cdecl _wfullpath(ptr wstr long)
@ cdecl _wgetcwd(wstr long)
@ cdecl _wgetdcwd(long wstr long)
......@@ -534,7 +534,7 @@
@ varargs _wopen(wstr long)
@ stub _wperror #(wstr)
@ extern _wpgmptr MSVCRT__wpgmptr
@ cdecl _wpopen (wstr wstr)
@ cdecl _wpopen (wstr wstr) MSVCRT__wpopen
@ cdecl _wputenv(wstr)
@ cdecl _wremove(wstr)
@ cdecl _wrename(wstr wstr)
......@@ -552,8 +552,8 @@
@ stub _wspawnvp #(long wstr ptr)
@ stub _wspawnvpe #(long wstr ptr ptr)
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr)
@ cdecl _wstat(wstr ptr)
@ cdecl _wstati64(wstr ptr)
@ cdecl _wstat(wstr ptr) MSVCRT__wstat
@ cdecl _wstati64(wstr ptr) MSVCRT__wstati64
@ stub _wstrdate #(ptr)
@ stub _wstrtime #(ptr)
@ stub _wsystem #(wstr)
......@@ -744,7 +744,7 @@
@ cdecl wcscoll(wstr wstr) MSVCRT_wcscoll
@ cdecl wcscpy(ptr wstr) ntdll.wcscpy
@ cdecl wcscspn(wstr wstr) ntdll.wcscspn
@ stub wcsftime #(ptr long wstr ptr)
@ stub wcsftime #(ptr long wstr ptr) MSVCRT_wcsftime
@ cdecl wcslen(wstr) ntdll.wcslen
@ cdecl wcsncat(wstr wstr long) ntdll.wcsncat
@ cdecl wcsncmp(wstr wstr long) ntdll.wcsncmp
......
......@@ -215,7 +215,7 @@ int _cwait(int *status, int pid, int action)
if (doserrno == ERROR_INVALID_HANDLE)
{
*MSVCRT__errno() = MSVCRT_ECHILD;
*__doserrno() = doserrno;
*MSVCRT___doserrno() = doserrno;
}
else
MSVCRT__set_errno(doserrno);
......@@ -469,7 +469,7 @@ int _spawnvp(int flags, const char* name, const char* const* argv)
/*********************************************************************
* _popen (MSVCRT.@)
*/
MSVCRT_FILE* _popen(const char* command, const char* mode)
MSVCRT_FILE* MSVCRT__popen(const char* command, const char* mode)
{
FIXME("(command=%s, mode=%s): stub\n", debugstr_a(command), debugstr_a(mode));
return NULL;
......@@ -478,7 +478,7 @@ MSVCRT_FILE* _popen(const char* command, const char* mode)
/*********************************************************************
* _wpopen (MSVCRT.@)
*/
MSVCRT_FILE* _wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wchar_t* mode)
MSVCRT_FILE* MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wchar_t* mode)
{
FIXME("(command=%s, mode=%s): stub\n", debugstr_w(command), debugstr_w(mode));
return NULL;
......@@ -487,7 +487,7 @@ MSVCRT_FILE* _wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wchar_t* mode)
/*********************************************************************
* _pclose (MSVCRT.@)
*/
int _pclose(MSVCRT_FILE* file)
int MSVCRT__pclose(MSVCRT_FILE* file)
{
FIXME("(file=%p): stub\n", file);
return 0;
......
......@@ -102,7 +102,7 @@ char* _strset(char* str, int value)
/*********************************************************************
* _swab (MSVCRT.@)
*/
void _swab(char* src, char* dst, int len)
void MSVCRT__swab(char* src, char* dst, int len)
{
if (len > 1)
{
......
......@@ -37,7 +37,7 @@ typedef unsigned int MSVCRT(size_t);
#ifndef MSVCRT_DISKFREE_T_DEFINED
#define MSVCRT_DISKFREE_T_DEFINED
struct _diskfree_t {
struct MSVCRT(_diskfree_t) {
unsigned int total_clusters;
unsigned int avail_clusters;
unsigned int sectors_per_cluster;
......
......@@ -22,7 +22,7 @@
#ifndef MSVCRT_DISKFREE_T_DEFINED
#define MSVCRT_DISKFREE_T_DEFINED
struct _diskfree_t {
struct MSVCRT(_diskfree_t) {
unsigned int total_clusters;
unsigned int avail_clusters;
unsigned int sectors_per_cluster;
......@@ -35,7 +35,7 @@ struct _diskfree_t {
extern "C" {
#endif
unsigned int _getdiskfree(unsigned int, struct _diskfree_t *);
unsigned int MSVCRT(_getdiskfree)(unsigned int, struct MSVCRT(_diskfree_t) *);
#ifdef __cplusplus
}
......@@ -43,7 +43,7 @@ unsigned int _getdiskfree(unsigned int, struct _diskfree_t *);
#ifndef USE_MSVCRT_PREFIX
#define diskfree_t _diskfree_t
#define MSVCRT(diskfree_t) MSVCRT(_diskfree_t)
#endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_DOS_H */
......@@ -47,23 +47,23 @@ typedef long MSVCRT(time_t);
#endif
#ifndef MSVCRT_FSIZE_T_DEFINED
typedef unsigned long _fsize_t;
typedef unsigned long MSVCRT(_fsize_t);
#define MSVCRT_FSIZE_T_DEFINED
#endif
#ifndef MSVCRT_FINDDATA_T_DEFINED
#define MSVCRT_FINDDATA_T_DEFINED
struct _finddata_t
struct MSVCRT(_finddata_t)
{
unsigned attrib;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
_fsize_t size;
char name[260];
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
MSVCRT(_fsize_t) size;
char name[260];
};
struct _finddatai64_t
struct MSVCRT(_finddatai64_t)
{
unsigned attrib;
MSVCRT(time_t) time_create;
......@@ -76,21 +76,21 @@ struct _finddatai64_t
#ifndef MSVCRT_WFINDDATA_T_DEFINED
#define MSVCRT_WFINDDATA_T_DEFINED
struct _wfinddata_t {
struct MSVCRT(_wfinddata_t) {
unsigned attrib;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
_fsize_t size;
MSVCRT(wchar_t) name[260];
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
MSVCRT(_fsize_t) size;
MSVCRT(wchar_t) name[260];
};
struct _wfinddatai64_t {
struct MSVCRT(_wfinddatai64_t) {
unsigned attrib;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
__int64 size;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
__int64 size;
MSVCRT(wchar_t) name[260];
};
#endif /* MSVCRT_WFINDDATA_T_DEFINED */
......@@ -111,10 +111,10 @@ int _eof(int);
__int64 _filelengthi64(int);
long _filelength(int);
int _findclose(long);
long _findfirst(const char*,struct _finddata_t*);
long _findfirsti64(const char*, struct _finddatai64_t*);
int _findnext(long,struct _finddata_t*);
int _findnexti64(long, struct _finddatai64_t*);
long MSVCRT(_findfirst)(const char*,struct MSVCRT(_finddata_t)*);
long MSVCRT(_findfirsti64)(const char*, struct MSVCRT(_finddatai64_t)*);
int MSVCRT(_findnext)(long,struct MSVCRT(_finddata_t)*);
int MSVCRT(_findnexti64)(long, struct MSVCRT(_finddatai64_t)*);
long _get_osfhandle(int);
int _isatty(int);
int _locking(int,int,long);
......@@ -141,10 +141,10 @@ int MSVCRT(rename)(const char*,const char*);
int _waccess(const MSVCRT(wchar_t)*,int);
int _wchmod(const MSVCRT(wchar_t)*,int);
int _wcreat(const MSVCRT(wchar_t)*,int);
long _wfindfirst(const MSVCRT(wchar_t)*,struct _wfinddata_t*);
long _wfindfirsti64(const MSVCRT(wchar_t)*, struct _wfinddatai64_t*);
int _wfindnext(long,struct _wfinddata_t*);
int _wfindnexti64(long, struct _wfinddatai64_t*);
long MSVCRT(_wfindfirst)(const MSVCRT(wchar_t)*,struct MSVCRT(_wfinddata_t)*);
long MSVCRT(_wfindfirsti64)(const MSVCRT(wchar_t)*, struct MSVCRT(_wfinddatai64_t)*);
int MSVCRT(_wfindnext)(long,struct MSVCRT(_wfinddata_t)*);
int MSVCRT(_wfindnexti64)(long, struct MSVCRT(_wfinddatai64_t)*);
MSVCRT(wchar_t)*_wmktemp(MSVCRT(wchar_t)*);
int _wopen(const MSVCRT(wchar_t)*,int,...);
int _wrename(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
......
......@@ -156,20 +156,20 @@ MSVCRT(FILE)* MSVCRT(__p__iob)(void);
#ifndef MSVCRT_STDIO_DEFINED
#define MSVCRT_STDIO_DEFINED
int _fcloseall(void);
MSVCRT(FILE)* _fdopen(int,const char*);
int MSVCRT(_fcloseall)(void);
MSVCRT(FILE)* MSVCRT(_fdopen)(int,const char*);
int _fgetchar(void);
int _filbuf(MSVCRT(FILE*));
int _fileno(MSVCRT(FILE)*);
int _flsbuf(int,MSVCRT(FILE)*);
int MSVCRT(_filbuf)(MSVCRT(FILE*));
int MSVCRT(_fileno)(MSVCRT(FILE)*);
int MSVCRT(_flsbuf)(int,MSVCRT(FILE)*);
int _flushall(void);
int _fputchar(int);
MSVCRT(FILE)* _fsopen(const char*,const char*,int);
int _getmaxstdio(void);
int _getw(MSVCRT(FILE)*);
int _pclose(MSVCRT(FILE)*);
MSVCRT(FILE)* _popen(const char*,const char*);
int _putw(int,MSVCRT(FILE)*);
int MSVCRT(_getw)(MSVCRT(FILE)*);
int MSVCRT(_pclose)(MSVCRT(FILE)*);
MSVCRT(FILE)* MSVCRT(_popen)(const char*,const char*);
int MSVCRT(_putw)(int,MSVCRT(FILE)*);
int _rmtmp(void);
int _setmaxstdio(int);
int _snprintf(char*,MSVCRT(size_t),const char*,...);
......@@ -227,12 +227,12 @@ MSVCRT(wchar_t)*_getws(MSVCRT(wchar_t)*);
int _putws(const MSVCRT(wchar_t)*);
int _snwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,...);
int _vsnwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,va_list);
MSVCRT(FILE)* _wfdopen(int,const MSVCRT(wchar_t)*);
MSVCRT(FILE)* _wfopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
MSVCRT(FILE)* _wfreopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
MSVCRT(FILE)* _wfsopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
MSVCRT(FILE)* MSVCRT(_wfdopen)(int,const MSVCRT(wchar_t)*);
MSVCRT(FILE)* MSVCRT(_wfopen)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
MSVCRT(FILE)* MSVCRT(_wfreopen)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
MSVCRT(FILE)* MSVCRT(_wfsopen)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
void _wperror(const MSVCRT(wchar_t)*);
MSVCRT(FILE)* _wpopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
MSVCRT(FILE)* MSVCRT(_wpopen)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
int _wremove(const MSVCRT(wchar_t)*);
MSVCRT(wchar_t)*_wtempnam(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
MSVCRT(wchar_t)*_wtmpnam(MSVCRT(wchar_t)*);
......
......@@ -105,7 +105,7 @@ extern MSVCRT(wchar_t)*** __p___wargv(void);
extern char*** __p__environ(void);
extern MSVCRT(wchar_t)*** __p__wenviron(void);
extern int* __p___mb_cur_max(void);
extern unsigned long* __doserrno(void);
extern unsigned long* MSVCRT(__doserrno)(void);
extern unsigned int* __p__fmode(void);
/* FIXME: We need functions to access these:
* int _sys_nerr;
......@@ -131,7 +131,7 @@ extern int* MSVCRT(_errno)(void);
#endif
typedef int (*_onexit_t)(void);
typedef int (*MSVCRT(_onexit_t))(void);
__int64 _atoi64(const char*);
......@@ -148,7 +148,7 @@ unsigned long _lrotl(unsigned long,int);
unsigned long _lrotr(unsigned long,int);
void _makepath(char*,const char*,const char*,const char*,const char*);
MSVCRT(size_t) _mbstrlen(const char*);
_onexit_t _onexit(_onexit_t);
MSVCRT(_onexit_t) MSVCRT(_onexit)(MSVCRT(_onexit_t));
int _putenv(const char*);
unsigned int _rotl(unsigned int,int);
unsigned int _rotr(unsigned int,int);
......@@ -158,7 +158,7 @@ void _seterrormode(int);
void _sleep(unsigned long);
void _splitpath(const char*,char*,char*,char*,char*);
long double _strtold(const char*,char**);
void _swab(char*,char*,int);
void MSVCRT(_swab)(char*,char*,int);
char* _ui64toa(unsigned __int64,char*,int);
char* _ultoa(unsigned long,char*,int);
......
......@@ -48,8 +48,8 @@ typedef unsigned int MSVCRT(size_t);
extern "C" {
#endif
void* _memccpy(void*,const void*,int,MSVCRT(size_t));
int _memicmp(const void*,const void*,MSVCRT(size_t));
void* _memccpy(void*,const void*,int,unsigned int);
int _memicmp(const void*,const void*,unsigned int);
int _strcmpi(const char*,const char*);
char* _strdup(const char*);
char* _strerror(const char*);
......
......@@ -35,12 +35,12 @@ typedef unsigned short MSVCRT(wchar_t);
#endif
#ifndef MSVCRT_DEV_T_DEFINED
typedef unsigned int _dev_t;
typedef unsigned int MSVCRT(_dev_t);
#define MSVCRT_DEV_T_DEFINED
#endif
#ifndef MSVCRT_INO_T_DEFINED
typedef unsigned short _ino_t;
typedef unsigned short MSVCRT(_ino_t);
#define MSVCRT_INO_T_DEFINED
#endif
......@@ -71,14 +71,14 @@ typedef int MSVCRT(_off_t);
#ifndef MSVCRT_STAT_DEFINED
#define MSVCRT_STAT_DEFINED
struct _stat {
_dev_t st_dev;
_ino_t st_ino;
struct MSVCRT(_stat) {
MSVCRT(_dev_t) st_dev;
MSVCRT(_ino_t) st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
MSVCRT(_dev_t) st_rdev;
MSVCRT(_off_t) st_size;
MSVCRT(time_t) st_atime;
MSVCRT(time_t) st_mtime;
......@@ -86,27 +86,27 @@ struct _stat {
};
struct MSVCRT(stat) {
_dev_t st_dev;
_ino_t st_ino;
MSVCRT(_dev_t) st_dev;
MSVCRT(_ino_t) st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
MSVCRT(_dev_t) st_rdev;
MSVCRT(_off_t) st_size;
MSVCRT(time_t) st_atime;
MSVCRT(time_t) st_mtime;
MSVCRT(time_t) st_ctime;
};
struct _stati64 {
_dev_t st_dev;
_ino_t st_ino;
struct MSVCRT(_stati64) {
MSVCRT(_dev_t) st_dev;
MSVCRT(_ino_t) st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
MSVCRT(_dev_t) st_rdev;
__int64 st_size;
MSVCRT(time_t) st_atime;
MSVCRT(time_t) st_mtime;
......@@ -118,16 +118,16 @@ struct _stati64 {
extern "C" {
#endif
int MSVCRT(_fstat)(int,struct _stat*);
int MSVCRT(_stat)(const char*,struct _stat*);
int _fstati64(int,struct _stati64*);
int _stati64(const char*,struct _stati64*);
int MSVCRT(_fstat)(int,struct MSVCRT(_stat)*);
int MSVCRT(_stat)(const char*,struct MSVCRT(_stat)*);
int MSVCRT(_fstati64)(int,struct MSVCRT(_stati64)*);
int MSVCRT(_stati64)(const char*,struct MSVCRT(_stati64)*);
int _umask(int);
#ifndef MSVCRT_WSTAT_DEFINED
#define MSVCRT_WSTAT_DEFINED
int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
int MSVCRT(_wstat)(const MSVCRT(wchar_t)*,struct MSVCRT(_stat)*);
int MSVCRT(_wstati64)(const MSVCRT(wchar_t)*,struct MSVCRT(_stati64)*);
#endif /* MSVCRT_WSTAT_DEFINED */
#ifdef __cplusplus
......
......@@ -105,8 +105,8 @@ MSVCRT(time_t) MSVCRT(time)(MSVCRT(time_t)*);
#ifndef MSVCRT_WTIME_DEFINED
#define MSVCRT_WTIME_DEFINED
MSVCRT(wchar_t)*_wasctime(const struct MSVCRT(tm)*);
MSVCRT(size_t) wcsftime(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,const struct MSVCRT(tm)*);
MSVCRT(wchar_t)* MSVCRT(_wasctime)(const struct MSVCRT(tm)*);
MSVCRT(size_t) MSVCRT(wcsftime)(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,const struct MSVCRT(tm)*);
MSVCRT(wchar_t)*_wctime(const MSVCRT(time_t)*);
MSVCRT(wchar_t)*_wstrdate(MSVCRT(wchar_t)*);
MSVCRT(wchar_t)*_wstrtime(MSVCRT(wchar_t)*);
......
......@@ -130,16 +130,16 @@ typedef struct MSVCRT(_iobuf)
#ifndef MSVCRT_WFINDDATA_T_DEFINED
#define MSVCRT_WFINDDATA_T_DEFINED
struct _wfinddata_t {
struct MSVCRT(_wfinddata_t) {
unsigned attrib;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
MSVCRT(time_t) time_write;
_fsize_t size;
MSVCRT(_fsize_t) size;
MSVCRT(wchar_t) name[260];
};
struct _wfinddatai64_t {
struct MSVCRT(_wfinddatai64_t) {
unsigned attrib;
MSVCRT(time_t) time_create;
MSVCRT(time_t) time_access;
......@@ -153,28 +153,28 @@ struct _wfinddatai64_t {
#ifndef MSVCRT_STAT_DEFINED
#define MSVCRT_STAT_DEFINED
struct _stat {
_dev_t st_dev;
_ino_t st_ino;
struct MSVCRT(_stat) {
MSVCRT(_dev_t) st_dev;
MSVCRT(_ino_t) st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
MSVCRT(_dev_t) st_rdev;
MSVCRT(_off_t) st_size;
MSVCRT(time_t) st_atime;
MSVCRT(time_t) st_mtime;
MSVCRT(time_t) st_ctime;
};
struct _stati64 {
_dev_t st_dev;
_ino_t st_ino;
struct MSVCRT(_stati64) {
MSVCRT(_dev_t) st_dev;
MSVCRT(_ino_t) st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
MSVCRT(_dev_t) st_rdev;
__int64 st_size;
MSVCRT(time_t) st_atime;
MSVCRT(time_t) st_mtime;
......@@ -268,8 +268,8 @@ int _wsystem(const MSVCRT(wchar_t)*);
#ifndef MSVCRT_WSTAT_DEFINED
#define MSVCRT_WSTAT_DEFINED
int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
int _wstat(const MSVCRT(wchar_t)*,struct MSVCRT(_stat)*);
int _wstati64(const MSVCRT(wchar_t)*,struct MSVCRT(_stati64)*);
#endif /* MSVCRT_WSTAT_DEFINED */
#ifndef MSVCRT_WSTDIO_DEFINED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment