msvcrt/tests: Rename a variable.
This commit is contained in:
parent
2649f769a5
commit
5fd1409c6a
|
@ -23,7 +23,7 @@
|
||||||
#include "msvcrt.h"
|
#include "msvcrt.h"
|
||||||
|
|
||||||
static int (__cdecl *prand_s)(unsigned int *);
|
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 int (__cdecl *pI10_OUTPUT)(long double, int, int, void*);
|
||||||
|
|
||||||
static void init(void)
|
static void init(void)
|
||||||
|
@ -31,7 +31,7 @@ static void init(void)
|
||||||
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
|
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
|
||||||
|
|
||||||
prand_s = (void *)GetProcAddress(hmod, "rand_s");
|
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");
|
pI10_OUTPUT = (void*)GetProcAddress(hmod, "$I10_OUTPUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,46 +61,46 @@ static void test_memcpy_s(void)
|
||||||
static char dest[32];
|
static char dest[32];
|
||||||
int ret;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
ret = memcpy_s(NULL, 0, NULL, 0);
|
ret = pmemcpy_s(NULL, 0, NULL, 0);
|
||||||
ok(ret == 0, "ret = %x\n", ret);
|
ok(ret == 0, "ret = %x\n", ret);
|
||||||
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
dest[0] = 'x';
|
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(ret == 0, "ret = %x\n", ret);
|
||||||
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
||||||
ok(dest[0] == 'x', "dest[0] != \'x\'\n");
|
ok(dest[0] == 'x', "dest[0] != \'x\'\n");
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
ret = memcpy_s(NULL, 10, data, 10);
|
ret = pmemcpy_s(NULL, 10, data, 10);
|
||||||
ok(ret == EINVAL, "ret = %x\n", ret);
|
ok(ret == EINVAL, "ret = %x\n", ret);
|
||||||
ok(errno == EINVAL, "errno = %x\n", errno);
|
ok(errno == EINVAL, "errno = %x\n", errno);
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
dest[7] = 'x';
|
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(ret == 0, "ret = %x\n", ret);
|
||||||
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
||||||
ok(memcmp(dest, data, 10), "All data copied\n");
|
ok(memcmp(dest, data, 10), "All data copied\n");
|
||||||
ok(!memcmp(dest, data, 5), "First five bytes are different\n");
|
ok(!memcmp(dest, data, 5), "First five bytes are different\n");
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
ret = memcpy_s(data, 10, data, 10);
|
ret = pmemcpy_s(data, 10, data, 10);
|
||||||
ok(ret == 0, "ret = %x\n", ret);
|
ok(ret == 0, "ret = %x\n", ret);
|
||||||
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
|
||||||
ok(!memcmp(dest, data, 5), "data was destroyed during overwritting\n");
|
ok(!memcmp(dest, data, 5), "data was destroyed during overwritting\n");
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
dest[0] = 'x';
|
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(ret == ERANGE, "ret = %x\n", ret);
|
||||||
ok(errno == ERANGE, "errno = %x\n", errno);
|
ok(errno == ERANGE, "errno = %x\n", errno);
|
||||||
ok(dest[0] == '\0', "dest[0] != \'\\0\'\n");
|
ok(dest[0] == '\0', "dest[0] != \'\\0\'\n");
|
||||||
|
|
Loading…
Reference in New Issue