msvcrt: Add tmpfile_s implementation.

oldstable
André Hentschel 2012-07-17 21:49:09 +02:00 committed by Alexandre Julliard
parent b3d91ea3b6
commit f09a40a215
6 changed files with 31 additions and 4 deletions

View File

@ -1609,7 +1609,7 @@
@ cdecl tan(double) msvcrt.tan
@ cdecl tanh(double) msvcrt.tanh
@ cdecl tmpfile() msvcrt.tmpfile
@ stub tmpfile_s
@ cdecl tmpfile_s(ptr) msvcrt.tmpfile_s
@ cdecl tmpnam(ptr) msvcrt.tmpnam
@ stub tmpnam_s
@ cdecl tolower(long) msvcrt.tolower

View File

@ -1463,7 +1463,7 @@
@ cdecl tan(double) msvcrt.tan
@ cdecl tanh(double) msvcrt.tanh
@ cdecl tmpfile() msvcrt.tmpfile
@ stub tmpfile_s
@ cdecl tmpfile_s(ptr) msvcrt.tmpfile_s
@ cdecl tmpnam(ptr) msvcrt.tmpnam
@ stub tmpnam_s
@ cdecl tolower(long) msvcrt.tolower

View File

@ -1474,7 +1474,7 @@
@ cdecl tanh(double) msvcrt.tanh
@ cdecl -arch=x86_64 tanhf(float) msvcrt.tanhf
@ cdecl tmpfile() msvcrt.tmpfile
@ stub tmpfile_s
@ cdecl tmpfile_s(ptr) msvcrt.tmpfile_s
@ cdecl tmpnam(ptr) msvcrt.tmpnam
@ stub tmpnam_s
@ cdecl tolower(long) msvcrt.tolower

View File

@ -75,6 +75,7 @@ static void (__cdecl *p_qsort_s)(void *, size_t, size_t, int (__cdecl *)(void *,
static void* (__cdecl *p_bsearch_s)(const void *, const void *, size_t, size_t,
int (__cdecl *compare)(void *, const void *, const void *), void *);
static int (__cdecl *p_controlfp_s)(unsigned int *, unsigned int, unsigned int);
static int (__cdecl *p_tmpfile_s)(FILE**);
static int (__cdecl *p_atoflt)(_CRT_FLOAT *, char *);
static unsigned int (__cdecl *p_set_abort_behavior)(unsigned int, unsigned int);
static int (__cdecl *p_sopen_s)(int*, const char*, int, int, int);
@ -255,6 +256,7 @@ static BOOL init(void)
SET(p_qsort_s, "qsort_s");
SET(p_bsearch_s, "bsearch_s");
SET(p_controlfp_s, "_controlfp_s");
SET(p_tmpfile_s, "tmpfile_s");
SET(p_atoflt, "_atoflt");
SET(p_set_abort_behavior, "_set_abort_behavior");
SET(p_sopen_s, "_sopen_s");
@ -833,6 +835,18 @@ static void test_controlfp_s(void)
ok( cur != 0xdeadbeef, "value not set\n" );
}
static void test_tmpfile_s( void )
{
int ret;
errno = 0xdeadbeef;
SET_EXPECT(invalid_parameter_handler);
ret = p_tmpfile_s(NULL);
ok(ret == EINVAL, "Expected tmpfile_s to return EINVAL, got %i\n", ret);
CHECK_CALLED(invalid_parameter_handler);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
}
typedef struct
{
const char *str;
@ -1211,6 +1225,7 @@ START_TEST(msvcr90)
test_qsort_s();
test_bsearch_s();
test_controlfp_s();
test_tmpfile_s();
test__atoflt();
test__set_abort_behavior();
test__sopen_s();

View File

@ -3792,6 +3792,18 @@ MSVCRT_FILE* CDECL MSVCRT_tmpfile(void)
return file;
}
/*********************************************************************
* tmpfile_s (MSVCRT.@)
*/
int CDECL MSVCRT_tmpfile_s(MSVCRT_FILE** file)
{
if (!MSVCRT_CHECK_PMT(file != NULL))
return MSVCRT_EINVAL;
*file = MSVCRT_tmpfile();
return 0;
}
static int puts_clbk_file_a(void *file, int len, const char *str)
{
return MSVCRT_fwrite(str, sizeof(char), len, file);

View File

@ -1422,7 +1422,7 @@
@ cdecl -arch=x86_64 tanhf(float) MSVCRT_tanhf
@ cdecl time(ptr) MSVCRT_time
@ cdecl tmpfile() MSVCRT_tmpfile
# stub tmpfile_s(ptr)
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
# stub tmpnam_s(ptr long)
@ cdecl tolower(long) MSVCRT_tolower