diff --git a/rostests/winetests/msvcrt/cpp.c b/rostests/winetests/msvcrt/cpp.c index ef80cac2c4f..9c9158df9e2 100644 --- a/rostests/winetests/msvcrt/cpp.c +++ b/rostests/winetests/msvcrt/cpp.c @@ -157,20 +157,20 @@ static inline void* do_call_func2(void *func, void *_this, const void* arg) #else static void* do_call_func1(void *func, void *_this) { - void* ret; - __asm__ __volatile__ ("call *%1" - : "=a" (ret) - : "g" (func), "c" (_this) - : "memory" ); + void *ret, *dummy; + __asm__ __volatile__ ("call *%2" + : "=a" (ret), "=c" (dummy) + : "g" (func), "1" (_this) + : "edx", "memory" ); return ret; } static void* do_call_func2(void *func, void *_this, const void* arg) { - void* ret; - __asm__ __volatile__ ("pushl %2\n\tcall *%1" - : "=a" (ret) - : "r" (func), "g" (arg), "c" (_this) - : "memory" ); + void *ret, *dummy; + __asm__ __volatile__ ("pushl %3\n\tcall *%2" + : "=a" (ret), "=c" (dummy) + : "r" (func), "r" (arg), "1" (_this) + : "edx", "memory" ); return ret; } #endif @@ -301,6 +301,7 @@ static void test_exception(void) /* Operator equals */ memset(&e2, 0, sizeof(e2)); + call_func1(pexception_default_ctor, &e2); pe = call_func2(pexception_opequals, &e2, &e); ok(e2.vtable != NULL, "Null exception vtable for e2\n"); ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n"); @@ -425,6 +426,7 @@ static void test_bad_typeid(void) /* Operator equals */ memset(&e2, 1, sizeof(e2)); + call_func1(pexception_default_ctor, &e2); pe = call_func2(pbad_typeid_opequals, &e2, &e); ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n"); ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n"); @@ -552,6 +554,7 @@ static void test_bad_cast(void) /* Operator equals */ memset(&e2, 1, sizeof(e2)); + call_func1(pexception_default_ctor, &e2); pe = call_func2(pbad_cast_opequals, &e2, &e); ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n"); ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n"); @@ -653,6 +656,7 @@ static void test___non_rtti_object(void) /* Operator equals */ memset(&e2, 1, sizeof(e2)); + call_func1(pexception_default_ctor, &e2); pe = call_func2(p__non_rtti_object_opequals, &e2, &e); ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n"); ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n"); @@ -813,7 +817,11 @@ static void test_rtti(void) bti = p__RTtypeid(&b); casted = p__RTDynamicCast(&b, 0, NULL, ti, 0); - ok (casted == (void*)&b, "failed cast from bad_cast to exception\n"); + if (casted) + { + /* New versions do not allow this conversion due to compiler changes */ + ok (casted == (void*)&b, "failed cast from bad_typeid to exception\n"); + } /* dynamic_cast down */ casted = p__RTDynamicCast(&e, 0, NULL, bti, 0); @@ -873,121 +881,157 @@ static int strcmp_space(const char *s1, const char *s2) static void test_demangle(void) { - static struct {const char* in; const char* out; unsigned int flags;} test[] = { -{"??0bad_alloc@std@@QAE@ABV01@@Z", "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)"}, -{"??0bad_alloc@std@@QAE@PBD@Z", "public: __thiscall std::bad_alloc::bad_alloc(char const *)"}, -{"??0bad_cast@@AAE@PBQBD@Z", "private: __thiscall bad_cast::bad_cast(char const * const *)"}, -{"??0bad_cast@@QAE@ABQBD@Z", "public: __thiscall bad_cast::bad_cast(char const * const &)"}, -{"??0bad_cast@@QAE@ABV0@@Z", "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"}, -{"??0bad_exception@std@@QAE@ABV01@@Z", "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)"}, -{"??0bad_exception@std@@QAE@PBD@Z", "public: __thiscall std::bad_exception::bad_exception(char const *)"}, -{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(class std::basic_filebuf > const &)"}, -{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(struct _iobuf *)"}, -{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum std::_Uninitialized)"}, -{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(class std::basic_filebuf > const &)"}, -{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(struct _iobuf *)"}, -{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z", "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum std::_Uninitialized)"}, -{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_stringstream,class std::allocator > const &)"}, -{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_string,class std::allocator > const &,int)"}, -{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(int)"}, -{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_stringstream,class std::allocator > const &)"}, -{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_string,class std::allocator > const &,int)"}, -{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z", "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(int)"}, -{"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z", "public: __thiscall std::num_get > >::num_get > >(class std::_Locinfo const &,unsigned int)"}, -{"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z", "public: __thiscall std::num_get > >::num_get > >(unsigned int)"}, -{"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z", "public: __thiscall std::num_get > >::num_get > >(class std::_Locinfo const &,unsigned int)"}, -{"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z", "public: __thiscall std::num_get > >::num_get > >(unsigned int)"}, -{"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"}, -{"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"}, -{"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"}, -{"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"}, -{"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"}, -{"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"}, -{"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"}, -{"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"}, -{"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"}, -{"??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get > >::~num_get > >(void)"}, -{"??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get > >::~num_get > >(void)"}, -{"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"}, -{"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"}, -{"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"}, -{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,signed char &)"}, -{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,char &)"}, -{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,unsigned char &)"}, -{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(class std::ios_base & (__cdecl*)(class std::ios_base &))"}, -{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(class std::basic_streambuf > *)"}, -{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(void const *)"}, -{"??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_ostream >'}"}, -{"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_istream >'}"}, -{"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_ostream >'}"}, -{"??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z", "bool __cdecl std::operator!=(char const *,class std::basic_string,class std::allocator > const &)"}, -{"??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z", "bool __cdecl std::operator!=(unsigned short const *,class std::basic_string,class std::allocator > const &)"}, -{"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z", "public: char & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)"}, -{"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z", "public: char const & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)const "}, -{"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z", "public: unsigned short & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)"}, -{"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z", "public: unsigned short const & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)const "}, -{"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex const &)"}, -{"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex const &)"}, -{"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex const &)"}, -{"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class std::basic_istream > std::cin"}, -{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned short &)const "}, -{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned int &)const "}, -{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,long &)const "}, -{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned long &)const "}, -{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,float &)const "}, -{"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"}, -{"?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z", "public: void __thiscall std::ios_base::register_callback(void (__cdecl*)(enum std::ios_base::event,class std::ios_base &,int),int)"}, -{"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(long,enum std::ios_base::seekdir)"}, -{"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(class std::fpos)"}, -{"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(long,enum std::ios_base::seekdir)"}, -{"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(class std::fpos)"}, -{"?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos __thiscall std::basic_filebuf >::seekoff(long,enum std::ios_base::seekdir,int)"}, -{"?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos __thiscall std::basic_filebuf >::seekoff(long,enum std::ios_base::seekdir,int)"}, -{"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"}, -{"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_istringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_istringstream,class std::allocator >::str(void)const "}, -{"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_istringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_istringstream,class std::allocator >::str(void)const "}, -{"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_ostringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_ostringstream,class std::allocator >::str(void)const "}, -{"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_ostringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_ostringstream,class std::allocator >::str(void)const "}, -{"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringbuf,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringbuf,class std::allocator >::str(void)const "}, -{"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringbuf,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringbuf,class std::allocator >::str(void)const "}, -{"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringstream,class std::allocator >::str(void)const "}, -{"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, -{"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringstream,class std::allocator >::str(void)const "}, -{"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"}, -{"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"}, -{"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"}, -{"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base & __thiscall std::_Complex_base::operator*=(float const &)"}, -{"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class std::complex & __cdecl std::operator*=(class std::complex &,class std::complex const &)"}, -{"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"}, -{"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"}, -{"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"}, -{"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"}, -{"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"}, -{"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"}, -{"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"}, -{"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"}, -{"??2?$aaa@AAUbbb@@AAUccc@@AAU2@@ddd@1eee@2@QAEHXZ", "public: int __thiscall eee::eee::ddd::ddd::aaa::operator new(void)"}, -{"?pSW@@3P6GHKPAX0PAU_tagSTACKFRAME@@0P6GH0K0KPAK@ZP6GPAX0K@ZP6GK0K@ZP6GK00PAU_tagADDRESS@@@Z@ZA", "int (__stdcall* pSW)(unsigned long,void *,void *,struct _tagSTACKFRAME *,void *,int (__stdcall*)(void *,unsigned long,void *,unsigned long,unsigned long *),void * (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,void *,struct _tagADDRESS *))"}, -{"?$_aaa@Vbbb@@", "_aaa"}, -{"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa"}, -{ "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo::Foo(char *)"}, -{ "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo::Foo(char *)", 0x880}, -{ "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" }, -{ "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", 0x1800}, -{"?$AAA@$DBAB@", "AAA<`template-parameter257'>"}, -{"?$AAA@?C@", "AAA<`template-parameter-2'>"}, -{"?$AAA@PAUBBB@@", "AAA"}, -{"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", "private: static class bar * __stdcall foo::bb::bar::ccccc(class bar *,class ee *,unsigned int,class aaa * *,class ee *)"}, -{"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"}, -{"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"}, -{"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"}, + static struct {const char* in; const char* out; const char *broken; unsigned int flags;} test[] = { +/* 0 */ {"??0bad_alloc@std@@QAE@ABV01@@Z", + "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)", + "public: __thiscall std::bad_alloc::bad_alloc(class bad_alloc::bad_alloc const &)"}, +/* 1 */ {"??0bad_alloc@std@@QAE@PBD@Z", + "public: __thiscall std::bad_alloc::bad_alloc(char const *)"}, +/* 2 */ {"??0bad_cast@@AAE@PBQBD@Z", + "private: __thiscall bad_cast::bad_cast(char const * const *)"}, +/* 3 */ {"??0bad_cast@@QAE@ABQBD@Z", + "public: __thiscall bad_cast::bad_cast(char const * const &)"}, +/* 4 */ {"??0bad_cast@@QAE@ABV0@@Z", + "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"}, +/* 5 */ {"??0bad_exception@std@@QAE@ABV01@@Z", + "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)", + "public: __thiscall std::bad_exception::bad_exception(class bad_exception::bad_exception const &)"}, +/* 6 */ {"??0bad_exception@std@@QAE@PBD@Z", + "public: __thiscall std::bad_exception::bad_exception(char const *)"}, +/* 7 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(class std::basic_filebuf > const &)", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(class basic_filebuf >::basic_filebuf > const &)"}, +/* 8 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(struct _iobuf *)"}, +/* 9 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum std::_Uninitialized)", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum basic_filebuf >::_Uninitialized)"}, +/* 10 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(class std::basic_filebuf > const &)", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(class basic_filebuf >::basic_filebuf > const &)"}, +/* 11 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(struct _iobuf *)"}, +/* 12 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum std::_Uninitialized)", + "public: __thiscall std::basic_filebuf >::basic_filebuf >(enum basic_filebuf >::_Uninitialized)"}, +/* 13 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_stringstream,class std::allocator > const &)", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator > const &)"}, +/* 14 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_string,class std::allocator > const &,int)", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class basic_stringstream,class std::allocator >::basic_string,class std::allocator > const &,int)"}, +/* 15 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(int)"}, +/* 16 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_stringstream,class std::allocator > const &)", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator > const &)"}, +/* 17 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class std::basic_string,class std::allocator > const &,int)", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(class basic_stringstream,class std::allocator >::basic_string,class std::allocator > const &,int)"}, +/* 18 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z", + "public: __thiscall std::basic_stringstream,class std::allocator >::basic_stringstream,class std::allocator >(int)"}, +/* 19 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z", + "public: __thiscall std::num_get > >::num_get > >(class std::_Locinfo const &,unsigned int)", + "public: __thiscall std::num_get > >::num_get > >(class num_get > >::_Locinfo const &,unsigned int)"}, +/* 20 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z", + "public: __thiscall std::num_get > >::num_get > >(unsigned int)"}, +/* 21 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z", + "public: __thiscall std::num_get > >::num_get > >(class std::_Locinfo const &,unsigned int)", + "public: __thiscall std::num_get > >::num_get > >(class num_get > >::_Locinfo const &,unsigned int)"}, +/* 22 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z", "public: __thiscall std::num_get > >::num_get > >(unsigned int)"}, +/* 23 */ {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"}, +/* 24 */ {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"}, +/* 25 */ {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"}, +/* 26 */ {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"}, +/* 27 */ {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"}, +/* 28 */ {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"}, +/* 29 */ {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"}, +/* 30 */ {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"}, +/* 31 */ {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"}, +/* 32 */ {"??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get > >::~num_get > >(void)"}, +/* 33 */ {"??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get > >::~num_get > >(void)"}, +/* 34 */ {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"}, +/* 35 */ {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"}, +/* 36 */ {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"}, +/* 37 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,signed char &)"}, +/* 38 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,char &)"}, +/* 39 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z", "class std::basic_istream > & __cdecl std::operator>>(class std::basic_istream > &,unsigned char &)"}, +/* 40 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(class std::ios_base & (__cdecl*)(class std::ios_base &))"}, +/* 41 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(class std::basic_streambuf > *)"}, +/* 42 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z", "public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(void const *)"}, +/* 43 */ {"??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_ostream >'}"}, +/* 44 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_istream >'}"}, +/* 45 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream >::`vbtable'{for `std::basic_ostream >'}"}, +/* 46 */ {"??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z", "bool __cdecl std::operator!=(char const *,class std::basic_string,class std::allocator > const &)"}, +/* 47 */ {"??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z", "bool __cdecl std::operator!=(unsigned short const *,class std::basic_string,class std::allocator > const &)"}, +/* 48 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z", "public: char & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)"}, +/* 49 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z", "public: char const & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)const "}, +/* 50 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z", "public: unsigned short & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)"}, +/* 51 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z", "public: unsigned short const & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)const "}, +/* 52 */ {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex const &)"}, +/* 53 */ {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex const &)"}, +/* 54 */ {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex const &)"}, +/* 55 */ {"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class std::basic_istream > std::cin"}, +/* 56 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned short &)const "}, +/* 57 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned int &)const "}, +/* 58 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,long &)const "}, +/* 59 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,unsigned long &)const "}, +/* 60 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z", "protected: virtual class std::istreambuf_iterator > __thiscall std::num_get > >::do_get(class std::istreambuf_iterator >,class std::istreambuf_iterator >,class std::ios_base &,int &,float &)const "}, +/* 61 */ {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"}, +/* 62 */ {"?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z", "public: void __thiscall std::ios_base::register_callback(void (__cdecl*)(enum std::ios_base::event,class std::ios_base &,int),int)"}, +/* 63 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(long,enum std::ios_base::seekdir)"}, +/* 64 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(class std::fpos)"}, +/* 65 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(long,enum std::ios_base::seekdir)"}, +/* 66 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream > & __thiscall std::basic_istream >::seekg(class std::fpos)"}, +/* 67 */ {"?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos __thiscall std::basic_filebuf >::seekoff(long,enum std::ios_base::seekdir,int)"}, +/* 68 */ {"?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos __thiscall std::basic_filebuf >::seekoff(long,enum std::ios_base::seekdir,int)"}, +/* 69 */ {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"}, +/* 70 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_istringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 71 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_istringstream,class std::allocator >::str(void)const "}, +/* 72 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_istringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 73 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_istringstream,class std::allocator >::str(void)const "}, +/* 74 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_ostringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 75 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_ostringstream,class std::allocator >::str(void)const "}, +/* 76 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_ostringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 77 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_ostringstream,class std::allocator >::str(void)const "}, +/* 78 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringbuf,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 79 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringbuf,class std::allocator >::str(void)const "}, +/* 80 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringbuf,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 81 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringbuf,class std::allocator >::str(void)const "}, +/* 82 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 83 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringstream,class std::allocator >::str(void)const "}, +/* 84 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringstream,class std::allocator >::str(class std::basic_string,class std::allocator > const &)"}, +/* 85 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string,class std::allocator > __thiscall std::basic_stringstream,class std::allocator >::str(void)const "}, +/* 86 */ {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"}, +/* 87 */ {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"}, +/* 88 */ {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"}, +/* 89 */ {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base & __thiscall std::_Complex_base::operator*=(float const &)"}, +/* 90 */ {"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class std::complex & __cdecl std::operator*=(class std::complex &,class std::complex const &)"}, +/* 91 */ {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"}, +/* 92 */ {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"}, +/* 93 */ {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"}, +/* 94 */ {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"}, +/* 95 */ {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"}, +/* 96 */ {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"}, +/* 97 */ {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"}, +/* 98 */ {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"}, +/* 99 */ {"??2?$aaa@AAUbbb@@AAUccc@@AAU2@@ddd@1eee@2@QAEHXZ", "public: int __thiscall eee::eee::ddd::ddd::aaa::operator new(void)"}, +/* 100 */ {"?pSW@@3P6GHKPAX0PAU_tagSTACKFRAME@@0P6GH0K0KPAK@ZP6GPAX0K@ZP6GK0K@ZP6GK00PAU_tagADDRESS@@@Z@ZA", "int (__stdcall* pSW)(unsigned long,void *,void *,struct _tagSTACKFRAME *,void *,int (__stdcall*)(void *,unsigned long,void *,unsigned long,unsigned long *),void * (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,void *,struct _tagADDRESS *))"}, +/* 101 */ {"?$_aaa@Vbbb@@", "_aaa"}, +/* 102 */ {"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa"}, +/* 103 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo::Foo(char *)"}, +/* 104 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo::Foo(char *)", NULL, 0x880}, +/* 105 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" }, +/* 106 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", NULL, 0x1800}, +/* 107 */ {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"}, +/* 108 */ {"?$AAA@?C@", "AAA<`template-parameter-2'>"}, +/* 109 */ {"?$AAA@PAUBBB@@", "AAA"}, +/* 110 */ {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", + "private: static class bar * __stdcall foo::bb::bar::ccccc(class bar *,class ee *,unsigned int,class aaa * *,class ee *)", + "??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z"}, +/* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"}, +/* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"}, +/* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"}, }; int i, num_test = (sizeof(test)/sizeof(test[0])); @@ -996,10 +1040,14 @@ static void test_demangle(void) for (i = 0; i < num_test; i++) { name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags); - ok(name != NULL && !strcmp_space(test[i].out, name), - "Got name \"%s\" for %d\n", name, i ); - ok(name != NULL && !strcmp_space(test[i].out, name), - "Expected \"%s\"\n", test[i].out ); + ok(name != NULL, "%u: unDName failed\n", i); + if (!name) continue; + ok( !strcmp_space(test[i].out, name) || + broken(test[i].broken && !strcmp_space(test[i].broken, name)), + "%u: Got name \"%s\"\n", i, name ); + ok( !strcmp_space(test[i].out, name) || + broken(test[i].broken && !strcmp_space(test[i].broken, name)), + "%u: Expected \"%s\"\n", i, test[i].out ); pfree(name); } } diff --git a/rostests/winetests/msvcrt/dir.c b/rostests/winetests/msvcrt/dir.c index 6929a76a5eb..11a982093f2 100644 --- a/rostests/winetests/msvcrt/dir.c +++ b/rostests/winetests/msvcrt/dir.c @@ -31,19 +31,94 @@ #include #include +typedef struct +{ + const char* buffer; + const char* drive; + const char* dir; + const char* file; + const char* ext; + const char* expected; +} makepath_case; + +#define USE_BUFF ((char*)~0ul) +static const makepath_case makepath_cases[] = +{ + { NULL, NULL, NULL, NULL, NULL, "" }, /* 0 */ + { NULL, "c", NULL, NULL, NULL, "c:" }, + { NULL, "c:", NULL, NULL, NULL, "c:" }, + { NULL, "c:\\", NULL, NULL, NULL, "c:" }, + { NULL, NULL, "dir", NULL, NULL, "dir\\" }, + { NULL, NULL, "dir\\", NULL, NULL, "dir\\" }, + { NULL, NULL, "\\dir", NULL, NULL, "\\dir\\" }, + { NULL, NULL, NULL, "file", NULL, "file" }, + { NULL, NULL, NULL, "\\file", NULL, "\\file" }, + { NULL, NULL, NULL, "file", NULL, "file" }, + { NULL, NULL, NULL, NULL, "ext", ".ext" }, /* 10 */ + { NULL, NULL, NULL, NULL, ".ext", ".ext" }, + { "foo", NULL, NULL, NULL, NULL, "" }, + { "foo", USE_BUFF, NULL, NULL, NULL, "f:" }, + { "foo", NULL, USE_BUFF, NULL, NULL, "foo\\" }, + { "foo", NULL, NULL, USE_BUFF, NULL, "foo" }, + { "foo", NULL, USE_BUFF, "file", NULL, "foo\\file" }, + { "foo", NULL, USE_BUFF, "file", "ext", "foo\\file.ext" }, + { "foo", NULL, NULL, USE_BUFF, "ext", "foo.ext" }, + /* remaining combinations of USE_BUFF crash native */ + { NULL, "c", "dir", "file", "ext", "c:dir\\file.ext" }, + { NULL, "c:", "dir", "file", "ext", "c:dir\\file.ext" }, /* 20 */ + { NULL, "c:\\", "dir", "file", "ext", "c:dir\\file.ext" } +}; + static void test_makepath(void) { + WCHAR driveW[MAX_PATH]; + WCHAR dirW[MAX_PATH]; + WCHAR fileW[MAX_PATH]; + WCHAR extW[MAX_PATH]; + WCHAR bufferW[MAX_PATH]; char buffer[MAX_PATH]; - _makepath(buffer, "C", "\\foo", "dummy", "txt"); - ok( strcmp(buffer, "C:\\foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer); - _makepath(buffer, "C:", "\\foo\\", "dummy", ".txt"); - ok( strcmp(buffer, "C:\\foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer); + unsigned int i, n; - /* this works with native and e.g. Freelancer depends on it */ - strcpy(buffer, "foo"); - _makepath(buffer, NULL, buffer, "dummy.txt", NULL); - ok( strcmp(buffer, "foo\\dummy.txt") == 0, "unexpected result: %s\n", buffer); + for (i = 0; i < sizeof(makepath_cases)/sizeof(makepath_cases[0]); ++i) + { + const makepath_case* p = &makepath_cases[i]; + + memset(buffer, 'X', MAX_PATH); + if (p->buffer) + strcpy(buffer, p->buffer); + + /* Ascii */ + _makepath(buffer, + p->drive == USE_BUFF ? buffer : p->drive, + p->dir == USE_BUFF ? buffer : p->dir, + p->file == USE_BUFF? buffer : p->file, + p->ext == USE_BUFF ? buffer : p->ext); + + buffer[MAX_PATH - 1] = '\0'; + ok(!strcmp(p->expected, buffer), "got '%s' for case %d\n", buffer, i); + + /* Unicode */ + if (p->drive != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->drive, -1, driveW, MAX_PATH); + if (p->dir != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->dir, -1, dirW, MAX_PATH); + if (p->file != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->file, -1, fileW, MAX_PATH); + if (p->ext != USE_BUFF) MultiByteToWideChar(CP_ACP, 0, p->ext, -1, extW, MAX_PATH); + + memset(buffer, 0, MAX_PATH); + for (n = 0; n < MAX_PATH; ++n) + bufferW[n] = 'X'; + if (p->buffer) MultiByteToWideChar( CP_ACP, 0, p->buffer, -1, bufferW, MAX_PATH); + + _wmakepath(bufferW, + p->drive == USE_BUFF ? bufferW : p->drive ? driveW : NULL, + p->dir == USE_BUFF ? bufferW : p->dir ? dirW : NULL, + p->file == USE_BUFF? bufferW : p->file ? fileW : NULL, + p->ext == USE_BUFF ? bufferW : p->ext ? extW : NULL); + + bufferW[MAX_PATH - 1] = '\0'; + WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_PATH, NULL, NULL); + ok(!strcmp(p->expected, buffer), "got '%s' for unicode case %d\n", buffer, i); + } } static void test_fullpath(void) diff --git a/rostests/winetests/msvcrt/file.c b/rostests/winetests/msvcrt/file.c index aa58a329c65..36fcc8001b8 100644 --- a/rostests/winetests/msvcrt/file.c +++ b/rostests/winetests/msvcrt/file.c @@ -114,13 +114,13 @@ static void test_fileops( void ) fclose (file); fd = open ("fdopen.tst", O_RDONLY | O_TEXT); file = fdopen (fd, "rt"); /* open in TEXT mode */ - ok(fgetws(wbuffer,sizeof(wbuffer),file) !=0,"fgetws failed unexpected\n"); - ok(fgetws(wbuffer,sizeof(wbuffer),file) ==0,"fgetws didn't signal EOF\n"); + ok(fgetws(wbuffer,sizeof(wbuffer)/sizeof(wbuffer[0]),file) !=0,"fgetws failed unexpected\n"); + ok(fgetws(wbuffer,sizeof(wbuffer)/sizeof(wbuffer[0]),file) ==0,"fgetws didn't signal EOF\n"); ok(feof(file) !=0,"feof doesn't signal EOF\n"); rewind(file); ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected\n"); ok(lstrlenW(wbuffer) == (lstrlenA(outbuffer) -1),"fgetws didn't read right size\n"); - ok(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n"); + ok(fgetws(wbuffer,sizeof(outbuffer)/sizeof(outbuffer[0]),file) !=0,"fgets failed unexpected\n"); ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n"); fclose (file); @@ -334,6 +334,63 @@ static void test_fgetc( void ) unlink(tempf); } +static void test_fputc( void ) +{ + char* tempf; + FILE *tempfh; + int ret; + + tempf=_tempnam(".","wne"); + tempfh = fopen(tempf,"wb"); + ret = fputc(0,tempfh); + ok(0 == ret, "fputc(0,tempfh) expected %x got %x\n", 0, ret); + ret = fputc(0xff,tempfh); + ok(0xff == ret, "fputc(0xff,tempfh) expected %x got %x\n", 0xff, ret); + ret = fputc(0xffffffff,tempfh); + ok(0xff == ret, "fputc(0xffffffff,tempfh) expected %x got %x\n", 0xff, ret); + fclose(tempfh); + + tempfh = fopen(tempf,"rb"); + ret = fputc(0,tempfh); + ok(EOF == ret, "fputc(0,tempfh) on r/o file expected %x got %x\n", EOF, ret); + fclose(tempfh); + + unlink(tempf); +} + +static void test_flsbuf( void ) +{ + char* tempf; + FILE *tempfh; + int ret; + int bufmode; + int bufmodes[] = {_IOFBF,_IONBF}; + + tempf=_tempnam(".","wne"); + for (bufmode=0; bufmode < sizeof(bufmodes)/sizeof(bufmodes[0]); bufmode++) + { + tempfh = fopen(tempf,"wb"); + setvbuf(tempfh,NULL,bufmodes[bufmode],2048); + ret = _flsbuf(0,tempfh); + ok(0 == ret, "_flsbuf(0,tempfh) with bufmode %x expected %x got %x\n", + bufmodes[bufmode], 0, ret); + ret = _flsbuf(0xff,tempfh); + ok(0xff == ret, "_flsbuf(0xff,tempfh) with bufmode %x expected %x got %x\n", + bufmodes[bufmode], 0, ret); + ret = _flsbuf(0xffffffff,tempfh); + ok(0xff == ret, "_flsbuf(0xffffffff,tempfh) with bufmode %x expected %x got %x\n", + bufmodes[bufmode], 0, ret); + fclose(tempfh); + } + + tempfh = fopen(tempf,"rb"); + ret = _flsbuf(0,tempfh); + ok(EOF == ret, "_flsbuf(0,tempfh) on r/o file expected %x got %x\n", EOF, ret); + fclose(tempfh); + + unlink(tempf); +} + static void test_fgetwc( void ) { #define LLEN 512 @@ -783,8 +840,8 @@ static void test_fopen_fclose_fcloseall( void ) ok(stream3 != NULL, "The file '%s' should be opened now\n", fname3 ); errno = 0xfaceabad; stream4 = fopen("", "w+"); - ok(stream4 == NULL && errno == ENOENT, - "filename is empty, errno = %d (expected 2)\n", errno); + ok(stream4 == NULL && (errno == EINVAL || errno == ENOENT), + "filename is empty, errno = %d (expected 2 or 22)\n", errno); errno = 0xfaceabad; stream4 = fopen(NULL, "w+"); ok(stream4 == NULL && (errno == EINVAL || errno == ENOENT), @@ -1028,6 +1085,19 @@ static void test_pipes(const char* selfname) ok(fclose(file) == 0, "unable to close the pipe: %d\n", errno); } +static void test_unlink(void) +{ + FILE* file; + ok(mkdir("test_unlink") == 0, "unable to create test dir\n"); + file = fopen("test_unlink\\empty", "w"); + ok(file != NULL, "unable to create test file\n"); + if(file) + fclose(file); + ok(_unlink("test_unlink") != 0, "unlinking a non-empty directory must fail\n"); + unlink("test_unlink\\empty"); + rmdir("test_unlink"); +} + START_TEST(file) { int arg_c; @@ -1052,6 +1122,7 @@ START_TEST(file) test_file_write_read(); test_chsize(); test_stat(); + test_unlink(); /* testing stream I/O */ test_fdopen(); @@ -1061,6 +1132,8 @@ START_TEST(file) test_readmode(FALSE); /* binary mode */ test_readmode(TRUE); /* ascii mode */ test_fgetc(); + test_fputc(); + test_flsbuf(); test_fgetwc(); test_ctrlz(); test_file_put_get(); diff --git a/rostests/winetests/msvcrt/printf.c b/rostests/winetests/msvcrt/printf.c index 7e07241f9b8..1603893a811 100644 --- a/rostests/winetests/msvcrt/printf.c +++ b/rostests/winetests/msvcrt/printf.c @@ -39,11 +39,24 @@ static void test_sprintf( void ) format = "%+#23.15e"; r = sprintf(buffer,format,pnumber); - todo_wine { - ok(!strcmp(buffer,"+7.894561230000000e+008"),"exponent format incorrect\n"); - } + ok(!strcmp(buffer,"+7.894561230000000e+008"),"+#23.15e failed: '%s'\n", buffer); ok( r==23, "return count wrong\n"); + format = "%-#23.15e"; + r = sprintf(buffer,format,pnumber); + ok(!strcmp(buffer,"7.894561230000000e+008 "),"-#23.15e failed: '%s'\n", buffer); + ok( r==23, "return count wrong\n"); + + format = "%#23.15e"; + r = sprintf(buffer,format,pnumber); + ok(!strcmp(buffer," 7.894561230000000e+008"),"#23.15e failed: '%s'\n", buffer); + ok( r==23, "return count wrong\n"); + + format = "%#1.1g"; + r = sprintf(buffer,format,pnumber); + ok(!strcmp(buffer,"8.e+008"),"#1.1g failed: '%s'\n", buffer); + ok( r==7, "return count wrong\n"); + format = "%I64d"; r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); ok(!strcmp(buffer,"-8589934591"),"Problem with long long\n"); @@ -206,8 +219,11 @@ static void test_sprintf( void ) format = "%lld"; r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff); - ok(!strcmp(buffer, "1"), "Problem with \"ll\" interpretation\n"); - ok( r==1, "return count wrong\n"); + ok( r == 1 || r == 11, "return count wrong %d\n", r); + if (r == 11) /* %ll works on Vista */ + ok(!strcmp(buffer, "-8589934591"), "Problem with \"ll\" interpretation '%s'\n", buffer); + else + ok(!strcmp(buffer, "1"), "Problem with \"ll\" interpretation '%s'\n", buffer); format = "%I"; r = sprintf(buffer,format,1); @@ -221,8 +237,15 @@ static void test_sprintf( void ) format = "%I32d"; r = sprintf(buffer,format,1); - ok(!strcmp(buffer,"1"),"I32d failed\n"); - ok( r==1, "return count wrong\n"); + if (r == 1) + { + ok(!strcmp(buffer,"1"),"I32d failed, got '%s'\n",buffer); + } + else + { + /* Older versions don't grok I32 format */ + ok(r == 4 && !strcmp(buffer,"I32d"),"I32d failed, got '%s',%d\n",buffer,r); + } format = "%I64D"; r = sprintf(buffer,format,(LONGLONG)-1); @@ -367,9 +390,18 @@ static void test_sprintf( void ) format = "asdf%n"; x = 0; r = sprintf(buffer, format, &x ); - ok(x == 4, "should write to x\n"); - ok(!strcmp(buffer,"asdf"), "failed\n"); - ok( r==4, "return count wrong\n"); + if (r == -1) + { + /* %n format is disabled by default on vista */ + /* FIXME: should test with _set_printf_count_output */ + ok(x == 0, "should not write to x: %d\n", x); + } + else + { + ok(x == 4, "should write to x: %d\n", x); + ok(!strcmp(buffer,"asdf"), "failed\n"); + ok( r==4, "return count wrong: %d\n", r); + } format = "%-1d"; r = sprintf(buffer, format,2); @@ -391,12 +423,10 @@ static void test_sprintf( void ) ok(!strcmp(buffer,"1"), "failed\n"); ok( r==1, "return count wrong\n"); - todo_wine { format = "%2.4e"; r = sprintf(buffer, format,8.6); ok(!strcmp(buffer,"8.6000e+000"), "failed\n"); ok( r==11, "return count wrong\n"); - } format = "%2.4g"; r = sprintf(buffer, format,8.6); @@ -497,10 +527,7 @@ static void test_swprintf( void ) const wchar_t hs[] = {'%', 'h', 's', 0}; swprintf(buffer,TwentyThreePoint15e,pnumber); - todo_wine - { - ok(wcsstr(buffer,e008) != 0,"Sprintf different\n"); - } + ok(wcsstr(buffer,e008) != 0,"Sprintf different\n"); swprintf(buffer,I64d,((ULONGLONG)0xffffffff)*0xffffffff); ok(wcslen(buffer) == 11,"Problem with long long\n"); swprintf(buffer,S,string); @@ -509,16 +536,6 @@ static void test_swprintf( void ) ok( wcscmp(string_w,buffer) == 0, "swprintf failed with %%hs\n"); } -static void test_fwprintf( void ) -{ - const char *string="not a wide string"; - todo_wine - { - ok(fwprintf(fopen("nul","r+"),(const wchar_t *)string) == -1, - "Non-wide string should not be printed by fwprintf\n"); - } -} - static void test_snprintf (void) { struct snprintf_test { @@ -648,7 +665,6 @@ START_TEST(printf) { test_sprintf(); test_swprintf(); - test_fwprintf(); test_snprintf(); test_fcvt(); } diff --git a/rostests/winetests/msvcrt/scanf.c b/rostests/winetests/msvcrt/scanf.c index 65bea469036..b152eacfbfd 100644 --- a/rostests/winetests/msvcrt/scanf.c +++ b/rostests/winetests/msvcrt/scanf.c @@ -28,6 +28,7 @@ static void test_sscanf( void ) char format[20]; int result, ret; char c; + void *ptr; float res1= -82.6267f, res2= 27.76f, res11, res12; static const char pname[]=" St. Petersburg, Florida\n"; int hour=21,min=59,sec=20; @@ -39,6 +40,32 @@ static void test_sscanf( void ) ret = sscanf(buffer, "%d", &result); ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF ); + /* check %p */ + ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x46F170,"sscanf reads %p instead of %x\n", ptr, 0x46F170 ); + + ok( sscanf("0046F171", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x46F171,"sscanf reads %p instead of %x\n", ptr, 0x46F171 ); + + ok( sscanf("46F172", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x46F172,"sscanf reads %p instead of %x\n", ptr, 0x46F172 ); + + ok( sscanf("0x46F173", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0,"sscanf reads %p instead of %x\n", ptr, 0 ); + + ok( sscanf("-46F174", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0xFFB90E8C,"sscanf reads %p instead of %x\n", ptr, 0xFFB90E8C ); + + ok( sscanf("+46F175", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x46F175,"sscanf reads %p instead of %x\n", ptr, 0x46F175 ); + + /* check %p with no hex digits */ + ok( sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x1233,"sscanf reads %p instead of %x\n", ptr, 0x1233 ); + + ok( sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" ); + ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 ); + /* check %x */ strcpy(buffer,"0x519"); ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" ); diff --git a/rostests/winetests/msvcrt/string.c b/rostests/winetests/msvcrt/string.c index 4febeea2d27..c4b7e078971 100644 --- a/rostests/winetests/msvcrt/string.c +++ b/rostests/winetests/msvcrt/string.c @@ -26,6 +26,7 @@ #include #include #include +#include size_t _mbstrlen(const char*); @@ -48,6 +49,10 @@ static char *buf_to_string(const unsigned char *bin, int len, int nr) 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); #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y) #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y) @@ -126,8 +131,6 @@ static void test_codepage(int cp) #define test_codepage_todo(cp, todo) test_codepage(cp) -#else - /* RLE-encoded mbctype tables for given codepages */ static int result_cp_932_mbctype[] = { 0x0,65, 0x8,1, 0x18,26, 0x8,6, 0x28,26, 0x8,4, 0x0,1, 0x8,1, 0xc,31, 0x8,1, 0xa,5, 0x9,58, 0xc,29, 0,3 }; @@ -140,7 +143,7 @@ static int result_cp_950_mbctype[] = { 0x0,65, 0x8,1, 0x18,26, 0x8,6, 0x28,26, 0 static int todo_none[] = { -2 }; static int todo_cp_932[] = { 254, -2 }; -#if 0 + void test_cp_table(int cp, int *result, int *todo) { int i; @@ -168,8 +171,9 @@ void test_cp_table(int cp, int *result, int *todo) #define test_codepage(num) test_cp_table(num, result_cp_##num##_mbctype, todo_none); #define test_codepage_todo(num, todo) test_cp_table(num, result_cp_##num##_mbctype, todo); + #endif -#endif + static void test_mbcp(void) { @@ -395,6 +399,215 @@ static void test_strdup(void) free( str ); } +static void test_strcpy_s(void) +{ + char dest[8]; + const char *small = "small"; + const char *big = "atoolongstringforthislittledestination"; + int ret; + + if(!pstrcpy_s) + { + skip("strcpy_s not found\n"); + return; + } + + memset(dest, 'X', sizeof(dest)); + ret = pstrcpy_s(dest, sizeof(dest), small); + ok(ret == 0, "Copying a string into a big enough destination returned %d, expected 0\n", ret); + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 'l' && + dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + ret = pstrcpy_s(dest, 0, big); + ok(ret == EINVAL, "Copying into a destination of size 0 returned %d, expected EINVAL\n", ret); + ok(dest[0] == 'X' && dest[1] == 'X' && dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + ret = pstrcpy_s(dest, 0, NULL); + ok(ret == EINVAL, "Copying into a destination of size 0 returned %d, expected EINVAL\n", ret); + ok(dest[0] == 'X' && dest[1] == 'X' && dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + ret = pstrcpy_s(dest, sizeof(dest), big); + ok(ret == ERANGE, "Copying a big string in a small location returned %d, expected ERANGE\n", ret); + ok(dest[0] == '\0'&& dest[1] == 't' && dest[2] == 'o' && dest[3] == 'o' && + dest[4] == 'l' && dest[5] == 'o' && dest[6] == 'n' && dest[7] == 'g', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + ret = pstrcpy_s(dest, sizeof(dest), NULL); + ok(ret == EINVAL, "Copying from a NULL source string returned %d, expected EINVAL\n", ret); + ok(dest[0] == '\0'&& dest[1] == 'X' && dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + ret = pstrcpy_s(NULL, sizeof(dest), small); + ok(ret == EINVAL, "Copying a big string a NULL dest returned %d, expected EINVAL\n", ret); +} + +static void test_strcat_s(void) +{ + char dest[8]; + const char *small = "sma"; + int ret; + + if(!pstrcat_s) + { + skip("strcat_s not found\n"); + return; + } + + memset(dest, 'X', sizeof(dest)); + dest[0] = '\0'; + ret = pstrcat_s(dest, sizeof(dest), small); + ok(ret == 0, "strcat_s: Copying a string into a big enough destination returned %d, expected 0\n", ret); + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == '\0'&& + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + ret = pstrcat_s(dest, sizeof(dest), small); + ok(ret == 0, "strcat_s: Attaching a string to a big enough destination returned %d, expected 0\n", ret); + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 's' && + dest[4] == 'm' && dest[5] == 'a' && dest[6] == '\0'&& dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + ret = pstrcat_s(dest, sizeof(dest), small); + ok(ret == ERANGE, "strcat_s: Attaching a string to a filled up destination returned %d, expected ERANGE\n", ret); + ok(dest[0] == '\0'&& dest[1] == 'm' && dest[2] == 'a' && dest[3] == 's' && + dest[4] == 'm' && dest[5] == 'a' && dest[6] == 's' && dest[7] == 'm', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + dest[0] = 'a'; + dest[1] = '\0'; + + ret = pstrcat_s(dest, 0, small); + ok(ret == EINVAL, "strcat_s: Source len = 0 returned %d, expected EINVAL\n", ret); + ok(dest[0] == 'a' && dest[1] == '\0'&& dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + ret = pstrcat_s(dest, 0, NULL); + ok(ret == EINVAL, "strcat_s: len = 0 and src = NULL returned %d, expected EINVAL\n", ret); + ok(dest[0] == 'a' && dest[1] == '\0'&& dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + ret = pstrcat_s(dest, sizeof(dest), NULL); + ok(ret == EINVAL, "strcat_s: Sourcing from NULL returned %d, expected EINVAL\n", ret); + ok(dest[0] == '\0'&& dest[1] == '\0'&& dest[2] == 'X' && dest[3] == 'X' && + dest[4] == 'X' && dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from strcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + ret = pstrcat_s(NULL, sizeof(dest), small); + ok(ret == EINVAL, "strcat_s: Writing to a NULL string returned %d, expected EINVAL\n", ret); +} + +static void test__mbsnbcpy_s(void) +{ + unsigned char dest[8]; + const unsigned char big[] = "atoolongstringforthislittledestination"; + const unsigned char small[] = "small"; + int ret; + + if(!p_mbsnbcpy_s) + { + skip("_mbsnbcpy_s not found\n"); + return; + } + + memset(dest, 'X', sizeof(dest)); + ret = p_mbsnbcpy_s(dest, sizeof(dest), small, sizeof(small)); + ok(ret == 0, "_mbsnbcpy_s: Copying a string into a big enough destination returned %d, expected 0\n", ret); + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 'l' && + dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + /* WTF? */ + memset(dest, 'X', sizeof(dest)); + ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, big, sizeof(small)); + ok(ret == ERANGE, "_mbsnbcpy_s: Copying a too long string returned %d, expected ERANGE\n", ret); + ok(dest[0] == '\0'&& dest[1] == 't' && dest[2] == 'o' && dest[3] == 'o' && + dest[4] == 'l' && dest[5] == 'o' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, big, 4); + ok(ret == 0, "_mbsnbcpy_s: Copying a too long string with a count cap returned %d, expected 0\n", ret); + ok(dest[0] == 'a' && dest[1] == 't' && dest[2] == 'o' && dest[3] == 'o' && + dest[4] == '\0'&& dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); + + memset(dest, 'X', sizeof(dest)); + ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, small, sizeof(small) + 10); + ok(ret == 0, "_mbsnbcpy_s: Copying more data than the source string len returned %d, expected 0\n", ret); + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 'l' && + dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7] == 'X', + "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); +} + +static void test_wcscpy_s(void) +{ + static const WCHAR szLongText[] = { 'T','h','i','s','A','L','o','n','g','s','t','r','i','n','g',0 }; + static WCHAR szDest[18]; + static WCHAR szDestShort[8]; + int ret; + + if(!p_wcscpy_s) + { + skip("wcscpy_s not found\n"); + return; + } + + /* Test NULL Dest */ + ret = p_wcscpy_s(NULL, 18, szLongText); + ok(ret == EINVAL, "p_wcscpy_s expect EINVAL got %d\n", ret); + + /* Test NULL Source */ + szDest[0] = 'A'; + ret = p_wcscpy_s(szDest, 18, NULL); + ok(ret == EINVAL, "expected EINVAL got %d\n", ret); + ok(szDest[0] == 0, "szDest[0] not 0\n"); + + /* Test invalid size */ + szDest[0] = 'A'; + ret = p_wcscpy_s(szDest, 0, szLongText); + /* Later versions changed the return value for this case to EINVAL, + * and don't modify the result if the dest size is 0. + */ + ok(ret == ERANGE || ret == EINVAL, "expected ERANGE/EINVAL got %d\n", ret); + ok(szDest[0] == 0 || ret == EINVAL, "szDest[0] not 0\n"); + + /* Copy same buffer size */ + ret = p_wcscpy_s(szDest, 18, szLongText); + ok(ret == 0, "expected 0 got %d\n", ret); + ok(lstrcmpW(szDest, szLongText) == 0, "szDest != szLongText\n"); + + /* Copy smaller buffer size */ + szDest[0] = 'A'; + ret = p_wcscpy_s(szDestShort, 8, szLongText); + ok(ret == ERANGE || ret == EINVAL, "expected ERANGE/EINVAL got %d\n", ret); + ok(szDestShort[0] == 0, "szDestShort[0] not 0\n"); +} + START_TEST(string) { char mem[100]; @@ -407,6 +620,10 @@ START_TEST(string) ok(hMsvcrt != 0, "GetModuleHandleA failed\n"); SET(pmemcpy,"memcpy"); SET(pmemcmp,"memcmp"); + pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" ); + pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" ); + p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" ); + p_wcscpy_s = (void *)GetProcAddress( hMsvcrt,"wcscpy_s" ); /* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ @@ -426,4 +643,9 @@ START_TEST(string) test_mbsspnp(); /* test _strdup */ test_strdup(); + test_strcpy_s(); + test_strcat_s(); + test__mbsnbcpy_s(); + + test_wcscpy_s(); } diff --git a/rostests/winetests/msvcrt/time.c b/rostests/winetests/msvcrt/time.c index 1fe6cbf3340..ac782cab835 100644 --- a/rostests/winetests/msvcrt/time.c +++ b/rostests/winetests/msvcrt/time.c @@ -20,6 +20,7 @@ #include "wine/test.h" #include "winbase.h" +#include "winnls.h" #include "time.h" #include /*setenv*/ @@ -31,9 +32,29 @@ #define MINSPERHOUR 60 #define HOURSPERDAY 24 +static int get_test_year(time_t *start) +{ + time_t now = time(NULL); + struct tm *tm = localtime(&now); + + /* compute start of year in seconds */ + *start = SECSPERDAY * ((tm->tm_year - 70) * 365 + + (tm->tm_year - 69) / 4 - + (tm->tm_year - 1) / 100 + + (tm->tm_year + 299) / 400); + return tm->tm_year; +} + +static void test_ctime(void) +{ + time_t badtime = -1; + char* ret; + ret = ctime(&badtime); + ok(ret == NULL, "expected ctime to return NULL, got %s\n", ret); +} static void test_gmtime(void) { - time_t gmt = (time_t)NULL; + time_t gmt = 0; struct tm* gmt_tm = gmtime(&gmt); if(gmt_tm == 0) { @@ -56,11 +77,21 @@ static void test_mktime(void) struct tm my_tm, sav_tm; time_t nulltime, local_time; char TZ_env[256]; - int secs; + char buffer[64]; + int year; + time_t ref, secs; + + year = get_test_year( &ref ); + ref += SECSPERDAY; ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n"); + WideCharToMultiByte( CP_ACP, 0, tzinfo.StandardName, -1, buffer, sizeof(buffer), NULL, NULL ); + trace( "bias %d std %d dst %d zone %s\n", + tzinfo.Bias, tzinfo.StandardBias, tzinfo.DaylightBias, buffer ); /* Bias may be positive or negative, to use offset of one day */ - secs= SECSPERDAY - tzinfo.Bias * SECSPERMIN; + my_tm = *localtime(&ref); /* retrieve current dst flag */ + secs = SECSPERDAY - tzinfo.Bias * SECSPERMIN; + secs -= (my_tm.tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN; my_tm.tm_mday = 1 + secs/SECSPERDAY; secs = secs % SECSPERDAY; my_tm.tm_hour = secs / SECSPERHOUR; @@ -69,22 +100,21 @@ static void test_mktime(void) secs = secs % SECSPERMIN; my_tm.tm_sec = secs; - my_tm.tm_year = 70; + my_tm.tm_year = year; my_tm.tm_mon = 0; - my_tm.tm_isdst= 0; sav_tm = my_tm; - + local_time = mktime(&my_tm); - ok(((DWORD)local_time == SECSPERDAY), "mktime returned %u, expected %u\n", - (DWORD)local_time, SECSPERDAY); + ok(local_time == ref, "mktime returned %u, expected %u\n", + (DWORD)local_time, (DWORD)ref); /* now test some unnormalized struct tm's */ my_tm = sav_tm; my_tm.tm_sec += 60; my_tm.tm_min -= 1; local_time = mktime(&my_tm); - ok(((DWORD)local_time == SECSPERDAY), "Unnormalized mktime returned %u, expected %u\n", - (DWORD)local_time, SECSPERDAY); + ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n", + (DWORD)local_time, (DWORD)ref); ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon && my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour && my_tm.tm_sec == sav_tm.tm_sec, @@ -97,8 +127,8 @@ static void test_mktime(void) my_tm.tm_min -= 60; my_tm.tm_hour += 1; local_time = mktime(&my_tm); - ok(((DWORD)local_time == SECSPERDAY), "Unnormalized mktime returned %u, expected %u\n", - (DWORD)local_time, SECSPERDAY); + ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n", + (DWORD)local_time, (DWORD)ref); ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon && my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour && my_tm.tm_sec == sav_tm.tm_sec, @@ -111,8 +141,8 @@ static void test_mktime(void) my_tm.tm_mon -= 12; my_tm.tm_year += 1; local_time = mktime(&my_tm); - ok(((DWORD)local_time == SECSPERDAY), "Unnormalized mktime returned %u, expected %u\n", - (DWORD)local_time, SECSPERDAY); + ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n", + (DWORD)local_time, (DWORD)ref); ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon && my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour && my_tm.tm_sec == sav_tm.tm_sec, @@ -125,8 +155,8 @@ static void test_mktime(void) my_tm.tm_mon += 12; my_tm.tm_year -= 1; local_time = mktime(&my_tm); - ok(((DWORD)local_time == SECSPERDAY), "Unnormalized mktime returned %u, expected %u\n", - (DWORD)local_time, SECSPERDAY); + ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n", + (DWORD)local_time, (DWORD)ref); ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon && my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour && my_tm.tm_sec == sav_tm.tm_sec, @@ -137,7 +167,7 @@ static void test_mktime(void) sav_tm.tm_hour,sav_tm.tm_sec); /* now a bad time example */ my_tm = sav_tm; - my_tm.tm_year -= 1; + my_tm.tm_year = 69; local_time = mktime(&my_tm); ok((local_time == -1), "(bad time) mktime returned %d, expected -1\n", (int)local_time); @@ -147,7 +177,7 @@ static void test_mktime(void) _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):"")); putenv("TZ=GMT"); nulltime = mktime(&my_tm); - ok(((DWORD)nulltime == SECSPERDAY),"mktime returned 0x%08x\n",(DWORD)nulltime); + ok(nulltime == ref,"mktime returned 0x%08x\n",(DWORD)nulltime); putenv(TZ_env); } @@ -155,16 +185,21 @@ static void test_localtime(void) { TIME_ZONE_INFORMATION tzinfo; DWORD res = GetTimeZoneInformation(&tzinfo); - time_t gmt = (time_t)(SECSPERDAY + tzinfo.Bias * SECSPERMIN); + time_t gmt, ref; char TZ_env[256]; struct tm* lt; - + int year = get_test_year( &ref ); + int is_leap = !(year % 4) && ((year % 100) || !((year + 300) % 400)); + + gmt = ref + SECSPERDAY + tzinfo.Bias * SECSPERMIN; ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n"); lt = localtime(&gmt); - ok(((lt->tm_year == 70) && (lt->tm_mon == 0) && (lt->tm_yday == 1) && - (lt->tm_mday == 2) && (lt->tm_wday == 5) && (lt->tm_hour == 0) && - (lt->tm_min == 0) && (lt->tm_sec == 0) && (lt->tm_isdst == 0)), + gmt += (lt->tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN; + lt = localtime(&gmt); + ok(((lt->tm_year == year) && (lt->tm_mon == 0) && (lt->tm_yday == 1) && + (lt->tm_mday == 2) && (lt->tm_hour == 0) && + (lt->tm_min == 0) && (lt->tm_sec == 0)), "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n", lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour, lt->tm_min, lt->tm_sec, lt->tm_isdst); @@ -172,21 +207,21 @@ static void test_localtime(void) _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):"")); putenv("TZ=GMT"); lt = localtime(&gmt); - ok(((lt->tm_year == 70) && (lt->tm_mon == 0) && (lt->tm_yday == 1) && - (lt->tm_mday == 2) && (lt->tm_wday == 5) && (lt->tm_hour == 0) && - (lt->tm_min == 0) && (lt->tm_sec == 0) && (lt->tm_isdst == 0)), + ok(((lt->tm_year == year) && (lt->tm_mon == 0) && (lt->tm_yday == 1) && + (lt->tm_mday == 2) && (lt->tm_hour == 0) && + (lt->tm_min == 0) && (lt->tm_sec == 0)), "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n", lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour, lt->tm_min, lt->tm_sec, lt->tm_isdst); putenv(TZ_env); /* June 22 */ - gmt += 201 * SECSPERDAY; + gmt = ref + 202 * SECSPERDAY + tzinfo.Bias * SECSPERMIN; lt = localtime(&gmt); gmt += (lt->tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN; lt = localtime(&gmt); - ok(((lt->tm_year == 70) && (lt->tm_mon == 6) && (lt->tm_yday == 202) && - (lt->tm_mday == 22) && (lt->tm_wday == 3) && (lt->tm_hour == 0) && + ok(((lt->tm_year == year) && (lt->tm_mon == 6) && (lt->tm_yday == 202) && + (lt->tm_mday == 22 - is_leap) && (lt->tm_hour == 0) && (lt->tm_min == 0) && (lt->tm_sec == 0)), "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n", lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour, @@ -249,6 +284,7 @@ static void test_wstrtime(void) START_TEST(time) { + test_ctime(); test_gmtime(); test_mktime(); test_localtime();