[1/2] msvcrt: Implement asctime_s

André Hentschel nerv at dawncrow.de
Tue Nov 29 19:51:28 CST 2011


http://bugs.winehq.org/show_bug.cgi?id=28256
---
 dlls/msvcr100/msvcr100.spec |    2 +-
 dlls/msvcr80/msvcr80.spec   |    2 +-
 dlls/msvcr90/msvcr90.spec   |    2 +-
 dlls/msvcrt/msvcrt.spec     |    2 +-
 dlls/msvcrt/time.c          |   25 +++++++++++++++++++++++++
 5 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec
index 16c8486..b7106b7 100644
--- a/dlls/msvcr100/msvcr100.spec
+++ b/dlls/msvcr100/msvcr100.spec
@@ -1424,7 +1424,7 @@
 @ cdecl abs(long) msvcrt.abs
 @ cdecl acos(double) msvcrt.acos
 @ cdecl asctime(ptr) msvcrt.asctime
-@ stub asctime_s
+@ cdecl asctime_s(ptr long ptr) msvcrt.asctime_s
 @ cdecl asin(double) msvcrt.asin
 @ cdecl atan(double) msvcrt.atan
 @ cdecl atan2(double double) msvcrt.atan2
diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec
index 240b9f2..0313947 100644
--- a/dlls/msvcr80/msvcr80.spec
+++ b/dlls/msvcr80/msvcr80.spec
@@ -1280,7 +1280,7 @@
 @ cdecl abs(long) msvcrt.abs
 @ cdecl acos(double) msvcrt.acos
 @ cdecl asctime(ptr) msvcrt.asctime
-@ stub asctime_s
+@ cdecl asctime_s(ptr long ptr) msvcrt.asctime_s
 @ cdecl asin(double) msvcrt.asin
 @ cdecl atan(double) msvcrt.atan
 @ cdecl atan2(double double) msvcrt.atan2
diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec
index f1fa88a..6856d17 100644
--- a/dlls/msvcr90/msvcr90.spec
+++ b/dlls/msvcr90/msvcr90.spec
@@ -1272,7 +1272,7 @@
 @ cdecl acos(double) msvcrt.acos
 @ cdecl -arch=x86_64 acosf(float) msvcrt.acosf
 @ cdecl asctime(ptr) msvcrt.asctime
-@ stub asctime_s
+@ cdecl asctime_s(ptr long ptr) msvcrt.asctime_s
 @ cdecl asin(double) msvcrt.asin
 @ cdecl atan(double) msvcrt.atan
 @ cdecl atan2(double double) msvcrt.atan2
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 2687fd6..2b6dda2 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -1214,7 +1214,7 @@
 @ cdecl acos(double) MSVCRT_acos
 @ cdecl -arch=x86_64 acosf(float) MSVCRT_acosf
 @ cdecl asctime(ptr) MSVCRT_asctime
-# stub asctime_s(ptr long ptr)
+@ cdecl asctime_s(ptr long ptr) MSVCRT_asctime_s
 @ cdecl asin(double) MSVCRT_asin
 @ cdecl atan(double) MSVCRT_atan
 @ cdecl atan2(double double) MSVCRT_atan2
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index bf87711..adf6a1d 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -903,6 +903,31 @@ char * CDECL MSVCRT_asctime(const struct MSVCRT_tm *mstm)
 }
 
 /*********************************************************************
+ *      asctime_s (MSVCRT.@)
+ */
+int CDECL MSVCRT_asctime_s(char* time, MSVCRT_size_t size, const struct MSVCRT_tm *mstm)
+{
+    char* asc;
+    unsigned int len;
+
+    if (!MSVCRT_CHECK_PMT(time != NULL) || !MSVCRT_CHECK_PMT(mstm != NULL)) {
+        *MSVCRT__errno() = MSVCRT_EINVAL;
+        return MSVCRT_EINVAL;
+    }
+
+    asc = MSVCRT_asctime(mstm);
+    len = strlen(asc) + 1;
+
+    if(!MSVCRT_CHECK_PMT(size >= len)) {
+        *MSVCRT__errno() = MSVCRT_ERANGE;
+        return MSVCRT_ERANGE;
+    }
+
+    strcpy(time, asc);
+    return 0;
+}
+
+/*********************************************************************
  *		_wasctime (MSVCRT.@)
  */
 MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm)
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list