=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: msvcrt: Add tmpfile_s implementation .
Alexandre Julliard
julliard at winehq.org
Wed Jul 18 12:44:40 CDT 2012
Module: wine
Branch: master
Commit: f09a40a215ef6994734aa0c66c9cb10969000df5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f09a40a215ef6994734aa0c66c9cb10969000df5
Author: André Hentschel <nerv at dawncrow.de>
Date: Tue Jul 17 21:49:09 2012 +0200
msvcrt: Add tmpfile_s implementation.
---
dlls/msvcr100/msvcr100.spec | 2 +-
dlls/msvcr80/msvcr80.spec | 2 +-
dlls/msvcr90/msvcr90.spec | 2 +-
dlls/msvcr90/tests/msvcr90.c | 15 +++++++++++++++
dlls/msvcrt/file.c | 12 ++++++++++++
dlls/msvcrt/msvcrt.spec | 2 +-
6 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec
index 70bcbd0..090e82c 100644
--- a/dlls/msvcr100/msvcr100.spec
+++ b/dlls/msvcr100/msvcr100.spec
@@ -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
diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec
index d758176..3644345 100644
--- a/dlls/msvcr80/msvcr80.spec
+++ b/dlls/msvcr80/msvcr80.spec
@@ -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
diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec
index 5c27fca..d10c78e 100644
--- a/dlls/msvcr90/msvcr90.spec
+++ b/dlls/msvcr90/msvcr90.spec
@@ -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
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index 92945ae..c746400 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -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();
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index df2c7cd..fe8f8b6 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -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);
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 934c247..c84ecba 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -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
More information about the wine-cvs
mailing list