sync msvcrt_winetest with wine 1.1.23

svn path=/trunk/; revision=41331
This commit is contained in:
Christoph von Wittich 2009-06-07 11:27:20 +00:00
parent 2fca9b58ec
commit b5b8395b7d
7 changed files with 65 additions and 114 deletions

View file

@ -55,10 +55,10 @@ typedef struct __type_info
/* Function pointers. We need to use these to call these funcs as __thiscall */
static HMODULE hMsvcrt;
static void* (*poperator_new)(unsigned int);
static void (*poperator_delete)(void*);
static void* (*pmalloc)(unsigned int);
static void (*pfree)(void*);
static void* (__cdecl *poperator_new)(unsigned int);
static void (__cdecl *poperator_delete)(void*);
static void* (__cdecl *pmalloc)(unsigned int);
static void (__cdecl *pfree)(void*);
/* exception */
static void (WINAPI *pexception_ctor)(exception*,LPCSTR*);
@ -113,12 +113,12 @@ static int (WINAPI *ptype_info_opequals_equals)(type_info*,type_info*);
static int (WINAPI *ptype_info_opnot_equals)(type_info*,type_info*);
/* RTTI */
static type_info* (*p__RTtypeid)(void*);
static void* (*p__RTCastToVoid)(void*);
static void* (*p__RTDynamicCast)(void*,int,void*,void*,int);
static type_info* (__cdecl *p__RTtypeid)(void*);
static void* (__cdecl *p__RTCastToVoid)(void*);
static void* (__cdecl *p__RTDynamicCast)(void*,int,void*,void*,int);
/*Demangle*/
static char* (*p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
static char* (__cdecl *p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
/* _very_ early native versions have serious RTTI bugs, so we check */

View file

@ -31,12 +31,12 @@
#include <process.h>
#include <errno.h>
typedef void (*_INITTERMFUN)(void);
static void (*p_initterm)(_INITTERMFUN *start, _INITTERMFUN *end);
typedef void (__cdecl *_INITTERMFUN)(void);
static void (__cdecl *p_initterm)(_INITTERMFUN *start, _INITTERMFUN *end);
static int callbacked;
static void initcallback(void)
static void __cdecl initcallback(void)
{
callbacked++;
}

View file

@ -179,7 +179,7 @@ static void test_readmode( BOOL ascii_mode )
const int *ip;
int i, j, m, ao, pl;
unsigned int fp;
long l;
LONG l;
fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE);
/* an internal buffer of BUFSIZ is maintained, so make a file big
@ -212,7 +212,7 @@ static void test_readmode( BOOL ascii_mode )
ok(fgets(buffer,2*BUFSIZ+256,file) !=0,"padding line fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
pl = 2*BUFSIZ-2;
ok(l == pl,"padding line ftell got %ld should be %d in %s\n", l, pl, IOMODE);
ok(l == pl,"padding line ftell got %d should be %d in %s\n", l, pl, IOMODE);
ok(lstrlenA(buffer) == pl+ao,"padding line fgets got size %d should be %d in %s\n",
lstrlenA(buffer), pl+ao, IOMODE);
for (fp=0; fp<strlen(outbuffer); fp++)
@ -220,23 +220,23 @@ static void test_readmode( BOOL ascii_mode )
fp++;
ok(fgets(buffer,256,file) !=0,"line 1 fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
ok(l == pl+fp,"line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == fp+ao,"line 1 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), fp+ao, IOMODE);
/* test a seek back across the buffer boundary */
l = pl;
ok(fseek(file,l,SEEK_SET)==0,"seek failure in %s\n", IOMODE);
l = ftell(file);
ok(l == pl,"ftell after seek got %ld should be %d in %s\n", l, pl, IOMODE);
ok(l == pl,"ftell after seek got %d should be %d in %s\n", l, pl, IOMODE);
ok(fgets(buffer,256,file) !=0,"second read of line 1 fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
ok(l == pl+fp,"second read of line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"second read of line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == fp+ao,"second read of line 1 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), fp+ao, IOMODE);
ok(fgets(buffer,256,file) !=0,"line 2 fgets failed unexpected in %s\n", IOMODE);
fp += 2;
l = ftell(file);
ok(l == pl+fp,"line 2 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"line 2 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == 2+ao,"line 2 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), 2+ao, IOMODE);
@ -248,7 +248,7 @@ static void test_readmode( BOOL ascii_mode )
i=fread(buffer,1,BUFSIZ+strlen(outbuffer),file);
ok(i==BUFSIZ+j,"fread failed, expected %d got %d in %s\n", BUFSIZ+j, i, IOMODE);
l = ftell(file);
ok(l == pl+j-(ao*4)-5,"ftell after fread got %ld should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE);
ok(l == pl+j-(ao*4)-5,"ftell after fread got %d should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE);
for (m=0; m<3; m++)
ok(buffer[m]==padbuffer[m+(BUFSIZ-4)%strlen(padbuffer)],"expected %c got %c\n", padbuffer[m], buffer[m]);
m+=BUFSIZ+2+ao;
@ -531,7 +531,7 @@ static void test_fgetwc( void )
BOOL diff_found = FALSE;
int j;
unsigned int i;
long l;
LONG l;
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"wb");
@ -550,10 +550,10 @@ static void test_fgetwc( void )
tempfh = fopen(tempf,"rt"); /* open in TEXT mode */
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
ok(l==BUFSIZ-2, "ftell expected %d got %ld\n", BUFSIZ-2, l);
ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l);
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %ld\n", BUFSIZ-2+lstrlen(mytext), l);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %d\n", BUFSIZ-2+lstrlen(mytext), l);
mytextW = AtoW (mytext);
aptr = mytextW;
wptr = wtextW;
@ -586,25 +586,25 @@ static void test_fgetwc( void )
fgetws(wtextW,j,tempfh);
l=ftell(tempfh);
j=(j-1)*sizeof(WCHAR);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
i=fgetc(tempfh);
ok(i=='a', "fgetc expected %d got %d\n", 0x61, i);
l=ftell(tempfh);
j++;
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
fgetws(wtextW,3,tempfh);
ok(wtextW[0]=='\r',"expected carriage return got %04hx\n", wtextW[0]);
ok(wtextW[1]=='\n',"expected newline got %04hx\n", wtextW[1]);
l=ftell(tempfh);
j += 4;
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
for(i=0; i<strlen(mytext); i++)
wtextW[i] = 0;
/* the first time we get the string, it should be entirely within the local buffer */
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
j += (strlen(mytext)-1)*sizeof(WCHAR);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
diff_found = FALSE;
aptr = mytextW;
wptr = wtextW;
@ -643,7 +643,7 @@ static void test_ctrlz( void )
static const char mytext[]= "This is test_ctrlz";
char buffer[256];
int i, j;
long l;
LONG l;
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"wb");
@ -664,7 +664,7 @@ static void test_ctrlz( void )
ok(i==j, "returned string length expected %d got %d\n", j, i);
j+=4; /* ftell should indicate the true end of file */
l=ftell(tempfh);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
ok(feof(tempfh), "did not get EOF\n");
fclose(tempfh);
@ -674,7 +674,7 @@ static void test_ctrlz( void )
j=strlen(mytext)+3; /* should get through newline */
ok(i==j, "returned string length expected %d got %d\n", j, i);
l=ftell(tempfh);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
ok(fgets(buffer,256,tempfh) != 0,"fgets failed unexpected\n");
i=strlen(buffer);
ok(i==1, "returned string length expected %d got %d\n", 1, i);
@ -785,7 +785,7 @@ static void test_file_write_read( void )
memset(btext, 0, LLEN);
tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */
ok(tell(tempfd) == 0, "bad position %lu expecting 0\n", tell(tempfd));
ok(tell(tempfd) == 0, "bad position %u expecting 0\n", tell(tempfd));
ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext), "_read _O_APPEND got bad length\n");
ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND _read\n");
_close(tempfd);
@ -801,7 +801,7 @@ static void test_file_write_read( void )
_lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,2);
ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret);
ok(tell(tempfd) == 42, "bad position %lu expecting 42\n", tell(tempfd));
ok(tell(tempfd) == 42, "bad position %u expecting 42\n", tell(tempfd));
_close(tempfd);
ret = unlink(tempf);
@ -872,7 +872,7 @@ static void test_file_inherit( const char* selfname )
arg_v[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v);
ok(tell(fd) == 8, "bad position %lu expecting 8\n", tell(fd));
ok(tell(fd) == 8, "bad position %u expecting 8\n", tell(fd));
lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n");
close (fd);
@ -886,7 +886,7 @@ static void test_file_inherit( const char* selfname )
arg_v[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v);
ok(tell(fd) == 0, "bad position %lu expecting 0\n", tell(fd));
ok(tell(fd) == 0, "bad position %u expecting 0\n", tell(fd));
ok(read(fd, buffer, sizeof (buffer)) == 0, "Found unexpected data (%s)\n", buffer);
close (fd);
ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n");
@ -914,7 +914,7 @@ static void test_tmpnam( void )
static void test_chsize( void )
{
int fd;
long cur, pos, count;
LONG cur, pos, count;
char temptext[] = "012345678";
char *tempfile = _tempnam( ".", "tst" );
@ -933,14 +933,14 @@ static void test_chsize( void )
ok( _chsize( fd, sizeof(temptext) / 2 ) == 0, "_chsize() failed\n" );
pos = _lseek( fd, 0, SEEK_CUR );
ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos );
ok( _filelength( fd ) == sizeof(temptext) / 2, "Wrong file size\n" );
/* enlarge the file */
ok( _chsize( fd, sizeof(temptext) * 2 ) == 0, "_chsize() failed\n" );
pos = _lseek( fd, 0, SEEK_CUR );
ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos );
ok( _filelength( fd ) == sizeof(temptext) * 2, "Wrong file size\n" );
_close( fd );

View file

@ -87,7 +87,6 @@ static void test_types(void)
CHECK_TYPE(_dev_t);
CHECK_TYPE(_off_t);
CHECK_TYPE(clock_t);
CHECK_TYPE(time_t);
CHECK_TYPE(__time32_t);
CHECK_TYPE(__time64_t);
CHECK_TYPE(fpos_t);
@ -115,11 +114,16 @@ static void test_structs(void)
CHECK_FIELD(tm, tm_wday);
CHECK_FIELD(tm, tm_yday);
CHECK_FIELD(tm, tm_isdst);
CHECK_STRUCT(_timeb);
CHECK_FIELD(_timeb, time);
CHECK_FIELD(_timeb, millitm);
CHECK_FIELD(_timeb, timezone);
CHECK_FIELD(_timeb, dstflag);
CHECK_STRUCT(__timeb32);
CHECK_FIELD(__timeb32, time);
CHECK_FIELD(__timeb32, millitm);
CHECK_FIELD(__timeb32, timezone);
CHECK_FIELD(__timeb32, dstflag);
CHECK_STRUCT(__timeb64);
CHECK_FIELD(__timeb64, time);
CHECK_FIELD(__timeb64, millitm);
CHECK_FIELD(__timeb64, timezone);
CHECK_FIELD(__timeb64, dstflag);
CHECK_STRUCT(_iobuf);
CHECK_FIELD(_iobuf, _ptr);
CHECK_FIELD(_iobuf, _cnt);
@ -214,9 +218,12 @@ static void test_structs(void)
CHECK_FIELD(_wfinddatai64_t, time_write);
CHECK_FIELD(_wfinddatai64_t, size);
CHECK_FIELD(_wfinddatai64_t, name[260]);
CHECK_STRUCT(_utimbuf);
CHECK_FIELD(_utimbuf, actime);
CHECK_FIELD(_utimbuf, modtime);
CHECK_STRUCT(__utimbuf32);
CHECK_FIELD(__utimbuf32, actime);
CHECK_FIELD(__utimbuf32, modtime);
CHECK_STRUCT(__utimbuf64);
CHECK_FIELD(__utimbuf64, actime);
CHECK_FIELD(__utimbuf64, modtime);
CHECK_STRUCT(_stat);
CHECK_FIELD(_stat, st_dev);
CHECK_FIELD(_stat, st_ino);
@ -229,62 +236,6 @@ static void test_structs(void)
CHECK_FIELD(_stat, st_atime);
CHECK_FIELD(_stat, st_mtime);
CHECK_FIELD(_stat, st_ctime);
CHECK_FIELD(_stat, st_dev);
CHECK_FIELD(_stat, st_ino);
CHECK_FIELD(_stat, st_mode);
CHECK_FIELD(_stat, st_nlink);
CHECK_FIELD(_stat, st_uid);
CHECK_FIELD(_stat, st_gid);
CHECK_FIELD(_stat, st_rdev);
CHECK_FIELD(_stat, st_size);
CHECK_FIELD(_stat, st_atime);
CHECK_FIELD(_stat, st_mtime);
CHECK_FIELD(_stat, st_ctime);
CHECK_FIELD(_stat, st_dev);
CHECK_FIELD(_stat, st_ino);
CHECK_FIELD(_stat, st_mode);
CHECK_FIELD(_stat, st_nlink);
CHECK_FIELD(_stat, st_uid);
CHECK_FIELD(_stat, st_gid);
CHECK_FIELD(_stat, st_rdev);
CHECK_FIELD(_stat, st_size);
CHECK_FIELD(_stat, st_atime);
CHECK_FIELD(_stat, st_mtime);
CHECK_FIELD(_stat, st_ctime);
CHECK_STRUCT(stat);
CHECK_FIELD(stat, st_dev);
CHECK_FIELD(stat, st_ino);
CHECK_FIELD(stat, st_mode);
CHECK_FIELD(stat, st_nlink);
CHECK_FIELD(stat, st_uid);
CHECK_FIELD(stat, st_gid);
CHECK_FIELD(stat, st_rdev);
CHECK_FIELD(stat, st_size);
CHECK_FIELD(stat, st_atime);
CHECK_FIELD(stat, st_mtime);
CHECK_FIELD(stat, st_ctime);
CHECK_FIELD(stat, st_dev);
CHECK_FIELD(stat, st_ino);
CHECK_FIELD(stat, st_mode);
CHECK_FIELD(stat, st_nlink);
CHECK_FIELD(stat, st_uid);
CHECK_FIELD(stat, st_gid);
CHECK_FIELD(stat, st_rdev);
CHECK_FIELD(stat, st_size);
CHECK_FIELD(stat, st_atime);
CHECK_FIELD(stat, st_mtime);
CHECK_FIELD(stat, st_ctime);
CHECK_FIELD(stat, st_dev);
CHECK_FIELD(stat, st_ino);
CHECK_FIELD(stat, st_mode);
CHECK_FIELD(stat, st_nlink);
CHECK_FIELD(stat, st_uid);
CHECK_FIELD(stat, st_gid);
CHECK_FIELD(stat, st_rdev);
CHECK_FIELD(stat, st_size);
CHECK_FIELD(stat, st_atime);
CHECK_FIELD(stat, st_mtime);
CHECK_FIELD(stat, st_ctime);
CHECK_STRUCT(_stati64);
CHECK_FIELD(_stati64, st_dev);
CHECK_FIELD(_stati64, st_ino);

View file

@ -23,11 +23,11 @@
#include <errno.h>
#include "wine/test.h"
static void (*p_aligned_free)(void*) = NULL;
static void * (*p_aligned_malloc)(size_t,size_t) = NULL;
static void * (*p_aligned_offset_malloc)(size_t,size_t,size_t) = NULL;
static void * (*p_aligned_realloc)(void*,size_t,size_t) = NULL;
static void * (*p_aligned_offset_realloc)(void*,size_t,size_t,size_t) = NULL;
static void (__cdecl *p_aligned_free)(void*) = NULL;
static void * (__cdecl *p_aligned_malloc)(size_t,size_t) = NULL;
static void * (__cdecl *p_aligned_offset_malloc)(size_t,size_t,size_t) = NULL;
static void * (__cdecl *p_aligned_realloc)(void*,size_t,size_t) = NULL;
static void * (__cdecl *p_aligned_offset_realloc)(void*,size_t,size_t,size_t) = NULL;
static void test_aligned_malloc(unsigned int size, unsigned int alignment)
{

View file

@ -782,7 +782,7 @@ static void test_xcvt(void)
}
}
static int _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...)
static int __cdecl _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...)
{
int ret;
__ms_va_list valist;
@ -810,8 +810,8 @@ static void test_vsnwprintf(void)
ok( !strcmp(buf, "onetwothree"), "got %s expected 'onetwothree'\n", buf );
}
static int (*p__vscprintf)(const char *format, __ms_va_list valist);
static int (*p__vscwprintf)(const wchar_t *format, __ms_va_list valist);
static int (__cdecl *p__vscprintf)(const char *format, __ms_va_list valist);
static int (__cdecl *p__vscwprintf)(const wchar_t *format, __ms_va_list valist);
static int __cdecl _vscprintf_wrapper(const char *format, ...)
{

View file

@ -45,12 +45,12 @@ static char *buf_to_string(const unsigned char *bin, int len, int nr)
#define expect_eq(expr, value, type, format) { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }
#define expect_bin(buf, value, len) { ok(memcmp((buf), value, len) == 0, "Binary buffer mismatch - expected %s, got %s\n", buf_to_string((unsigned char *)value, len, 1), buf_to_string((buf), len, 0)); }
static void* (*pmemcpy)(void *, const void *, size_t n);
static int* (*pmemcmp)(void *, const void *, size_t n);
static int (*pstrcpy_s)(char *dst, size_t len, const char *src);
static int (*pstrcat_s)(char *dst, size_t len, const char *src);
static int (*p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count);
static int (*p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc);
static void* (__cdecl *pmemcpy)(void *, const void *, size_t n);
static int* (__cdecl *pmemcmp)(void *, const void *, size_t n);
static int (__cdecl *pstrcpy_s)(char *dst, size_t len, const char *src);
static int (__cdecl *pstrcat_s)(char *dst, size_t len, const char *src);
static int (__cdecl *p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count);
static int (__cdecl *p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc);
static int *p__mb_cur_max;
static unsigned char *p_mbctype;