[NTFS]
[reactos.git] / rostests / apitests / crt / mbstowcs_s.c
index e78ac10..ba65a98 100644 (file)
@@ -4,10 +4,11 @@
  * PURPOSE:         Test for mbstowcs_s
  */
 
+#include <apitest.h>
+
 #define WIN32_NO_STATUS
 #include <stdio.h>
 #include <stdlib.h>
-#include <wine/test.h>
 #include <specstrings.h>
 
 #define ok_errno(x) ok_hex(errno, (x))
@@ -53,7 +54,7 @@ START_TEST(mbstowcs_s)
     size_t cchConverted;
     wchar_t widechar[10];
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[5] = 0xFF;
     ret = mbstowcs_s(&cchConverted, widechar, 6, "hallo", 5);
@@ -63,7 +64,7 @@ START_TEST(mbstowcs_s)
     ok_wstr(widechar, L"hallo");
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[0] = 0xFF;
     ret = mbstowcs_s(&cchConverted, widechar, 1, "", 0);
@@ -72,7 +73,7 @@ START_TEST(mbstowcs_s)
     ok_wchar(widechar[0], 0);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[0] = 0xFF;
     widechar[1] = 0xFF;
@@ -91,7 +92,7 @@ START_TEST(mbstowcs_s)
     ok_wchar(widechar[0], 0);
     ok_errno(ERANGE);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[0] = 0xFF;
     widechar[1] = 0xFF;
@@ -110,64 +111,64 @@ START_TEST(mbstowcs_s)
     ok_wchar(widechar[0], 0);
     ok_errno(ERANGE);
 
-    _set_errno(0);
+    *_errno() = 0;
     ret = mbstowcs_s(0, 0, 0, 0, 0);
     ok_long(ret, EINVAL);
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, 0, 0, 0, 0);
     ok_long(ret, EINVAL);
     ok_size_t(cchConverted, 0);
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     widechar[0] = L'x';
     ret = mbstowcs_s(0, widechar, 0, 0, 0);
     ok_long(ret, EINVAL);
     ok_wchar(widechar[0], L'x');
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     ret = mbstowcs_s(0, widechar, 10, "hallo", 5);
     ok_long(ret, 0);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     ret = mbstowcs_s(0, widechar, 0, "hallo", 5);
     ok_long(ret, EINVAL);
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, 0, 10, "hallo", 5);
     ok_long(ret, EINVAL);
     ok_size_t(cchConverted, 0xf00bac);
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, 0, 0, "hallo", 5);
     ok_long(ret, 0);
     ok_size_t(cchConverted, 6);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, widechar, 10, 0, 5);
     ok_long(ret, EINVAL);
     ok_size_t(cchConverted, 0);
     ok_errno(EINVAL);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, widechar, 10, "hallo", 0);
     ok_long(ret, 0);
     ok_size_t(cchConverted, 1);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[0] = 0xABCD;
     widechar[1] = 0xABCD;
@@ -186,28 +187,28 @@ START_TEST(mbstowcs_s)
     ok_wchar(widechar[0], L'h');
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, widechar, 10, 0, 0);
     ok_long(ret, 0);
     ok_size_t(cchConverted, 1);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, widechar, 10, "hallo", 7);
     ok_long(ret, 0);
     ok_size_t(cchConverted, 6);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, 0, 0, "hallo", 7);
     ok_long(ret, 0);
     ok_size_t(cchConverted, 6);
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     widechar[0] = 0xABCD;
     widechar[1] = 0xABCD;
@@ -226,7 +227,7 @@ START_TEST(mbstowcs_s)
     ok_wchar(widechar[0], L'h');
     ok_errno(0);
 
-    _set_errno(0);
+    *_errno() = 0;
     cchConverted = 0xf00bac;
     ret = mbstowcs_s(&cchConverted, widechar, 10, "hallo", -1);
     ok_long(ret, 0);