Commit 5fd1409c authored by Alexander Scott-Johns's avatar Alexander Scott-Johns Committed by Alexandre Julliard

msvcrt/tests: Rename a variable.

parent 2649f769
......@@ -23,7 +23,7 @@
#include "msvcrt.h"
static int (__cdecl *prand_s)(unsigned int *);
static int (__cdecl *memcpy_s)(void *, MSVCRT_size_t, void*, MSVCRT_size_t);
static int (__cdecl *pmemcpy_s)(void *, MSVCRT_size_t, void*, MSVCRT_size_t);
static int (__cdecl *pI10_OUTPUT)(long double, int, int, void*);
static void init(void)
......@@ -31,7 +31,7 @@ static void init(void)
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
prand_s = (void *)GetProcAddress(hmod, "rand_s");
memcpy_s = (void*)GetProcAddress(hmod, "memcpy_s");
pmemcpy_s = (void*)GetProcAddress(hmod, "memcpy_s");
pI10_OUTPUT = (void*)GetProcAddress(hmod, "$I10_OUTPUT");
}
......@@ -61,46 +61,46 @@ static void test_memcpy_s(void)
static char dest[32];
int ret;
if(!memcpy_s)
if(!pmemcpy_s)
{
win_skip("memcpy_s in not available\n");
win_skip("memcpy_s is not available\n");
return;
}
errno = 0xdeadbeef;
ret = memcpy_s(NULL, 0, NULL, 0);
ret = pmemcpy_s(NULL, 0, NULL, 0);
ok(ret == 0, "ret = %x\n", ret);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
errno = 0xdeadbeef;
dest[0] = 'x';
ret = memcpy_s(dest, 10, NULL, 0);
ret = pmemcpy_s(dest, 10, NULL, 0);
ok(ret == 0, "ret = %x\n", ret);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
ok(dest[0] == 'x', "dest[0] != \'x\'\n");
errno = 0xdeadbeef;
ret = memcpy_s(NULL, 10, data, 10);
ret = pmemcpy_s(NULL, 10, data, 10);
ok(ret == EINVAL, "ret = %x\n", ret);
ok(errno == EINVAL, "errno = %x\n", errno);
errno = 0xdeadbeef;
dest[7] = 'x';
ret = memcpy_s(dest, 10, data, 5);
ret = pmemcpy_s(dest, 10, data, 5);
ok(ret == 0, "ret = %x\n", ret);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
ok(memcmp(dest, data, 10), "All data copied\n");
ok(!memcmp(dest, data, 5), "First five bytes are different\n");
errno = 0xdeadbeef;
ret = memcpy_s(data, 10, data, 10);
ret = pmemcpy_s(data, 10, data, 10);
ok(ret == 0, "ret = %x\n", ret);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
ok(!memcmp(dest, data, 5), "data was destroyed during overwritting\n");
errno = 0xdeadbeef;
dest[0] = 'x';
ret = memcpy_s(dest, 5, data, 10);
ret = pmemcpy_s(dest, 5, data, 10);
ok(ret == ERANGE, "ret = %x\n", ret);
ok(errno == ERANGE, "errno = %x\n", errno);
ok(dest[0] == '\0', "dest[0] != \'\\0\'\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment