include: Use long type for __msvcrt_long when possible.

Based on patch by Chip Davis.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-04-23 02:32:09 +02:00 committed by Alexandre Julliard
parent 4b7b7a5f4c
commit 22315440fc
5 changed files with 24 additions and 19 deletions

View File

@ -5425,21 +5425,21 @@ static void test_istream(void)
pis = call_func2(p_istream_seekg, &is1, 0);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
ok(_tell(fb1.fd) == 0, "expected 0 got %d\n", _tell(fb1.fd));
ok(_tell(fb1.fd) == 0, "expected 0 got %ld\n", _tell(fb1.fd));
if (0) /* crashes on native */
is1.base_ios.sb = NULL;
pis = call_func2(p_istream_seekg, &is1, -5);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
ok(is1.base_ios.state == IOSTATE_failbit, "expected %d got %d\n", IOSTATE_failbit, is1.base_ios.state);
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
ok(_tell(fb1.fd) == 0, "expected 0 got %d\n", _tell(fb1.fd));
ok(_tell(fb1.fd) == 0, "expected 0 got %ld\n", _tell(fb1.fd));
fb1.base.epptr = fb1.base.ebuf;
pis = call_func2(p_istream_seekg, &is1, 5);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
ok(is1.base_ios.state == IOSTATE_failbit, "expected %d got %d\n", IOSTATE_failbit, is1.base_ios.state);
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
ok(fb1.base.epptr == NULL, "wrong put end, expected %p got %p\n", NULL, fb1.base.epptr);
ok(_tell(fb1.fd) == 5, "expected 5 got %d\n", _tell(fb1.fd));
ok(_tell(fb1.fd) == 5, "expected 5 got %ld\n", _tell(fb1.fd));
is1.base_ios.state = IOSTATE_goodbit;
fd = fb1.fd;
fb1.fd = -1;
@ -5466,7 +5466,7 @@ static void test_istream(void)
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
ok(is1.base_ios.state == IOSTATE_failbit, "expected %d got %d\n", IOSTATE_failbit, is1.base_ios.state);
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
ok(_tell(fb1.fd) == 24, "expected 24 got %d\n", _tell(fb1.fd));
ok(_tell(fb1.fd) == 24, "expected 24 got %ld\n", _tell(fb1.fd));
/* sync */
ret = (int) call_func1(p_istream_sync, &is1);

View File

@ -1185,7 +1185,7 @@ static void test_file_write_read( void )
memset(btext, 0, LLEN);
tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */
ok(tell(tempfd) == 0, "bad position %u expecting 0\n", tell(tempfd));
ok(tell(tempfd) == 0, "bad position %lu expecting 0\n", tell(tempfd));
ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext), "_read _O_APPEND got bad length\n");
ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND _read\n");
_close(tempfd);
@ -1206,15 +1206,15 @@ static void test_file_write_read( void )
_lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,1);
ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret);
ok(tell(tempfd) == 41, "bad position %u expecting 41\n", tell(tempfd));
ok(tell(tempfd) == 41, "bad position %lu expecting 41\n", tell(tempfd));
_lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,2);
ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret);
ok(tell(tempfd) == 42, "bad position %u expecting 42\n", tell(tempfd));
ok(tell(tempfd) == 42, "bad position %lu expecting 42\n", tell(tempfd));
_lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,3);
ok(ret == 2 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret);
ok(tell(tempfd) == 43, "bad position %u expecting 43\n", tell(tempfd));
ok(tell(tempfd) == 43, "bad position %lu expecting 43\n", tell(tempfd));
_close(tempfd);
ret = unlink(tempf);
@ -1469,7 +1469,7 @@ static void test_file_inherit( const char* selfname )
arg_v[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v);
ok(tell(fd) == 8, "bad position %u expecting 8\n", tell(fd));
ok(tell(fd) == 8, "bad position %lu expecting 8\n", tell(fd));
lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n");
close (fd);
@ -1482,7 +1482,7 @@ static void test_file_inherit( const char* selfname )
arg_v[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v);
ok(tell(fd) == 0, "bad position %u expecting 0\n", tell(fd));
ok(tell(fd) == 0, "bad position %lu expecting 0\n", tell(fd));
ok(read(fd, buffer, sizeof (buffer)) == 0, "Found unexpected data (%s)\n", buffer);
close (fd);
ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n");

View File

@ -240,7 +240,7 @@ static void test__get_doserrno(void)
errno = EBADF;
ret = p_get_doserrno(NULL);
ok(ret == EINVAL, "Expected _get_doserrno to return EINVAL, got %d\n", ret);
ok(_doserrno == ERROR_INVALID_CMM, "Expected _doserrno to be ERROR_INVALID_CMM, got %d\n", _doserrno);
ok(_doserrno == ERROR_INVALID_CMM, "Expected _doserrno to be ERROR_INVALID_CMM, got %ld\n", _doserrno);
ok(errno == EBADF, "Expected errno to be EBADF, got %d\n", errno);
_doserrno = ERROR_INVALID_CMM;
@ -287,19 +287,19 @@ static void test__set_doserrno(void)
ret = p_set_doserrno(ERROR_FILE_NOT_FOUND);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == ERROR_FILE_NOT_FOUND,
"Expected _doserrno to be ERROR_FILE_NOT_FOUND, got %d\n", _doserrno);
"Expected _doserrno to be ERROR_FILE_NOT_FOUND, got %ld\n", _doserrno);
_doserrno = ERROR_INVALID_CMM;
ret = p_set_doserrno(-1);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == -1,
"Expected _doserrno to be -1, got %d\n", _doserrno);
"Expected _doserrno to be -1, got %ld\n", _doserrno);
_doserrno = ERROR_INVALID_CMM;
ret = p_set_doserrno(0xdeadbeef);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == 0xdeadbeef,
"Expected _doserrno to be 0xdeadbeef, got %d\n", _doserrno);
"Expected _doserrno to be 0xdeadbeef, got %ld\n", _doserrno);
}
static void test__set_errno(void)

View File

@ -150,21 +150,21 @@ static void test_gmtime(void)
gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt);
ok(gmt == valid, "gmt = %lu\n", gmt);
ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
gmt_tm->tm_isdst = -1;
gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt);
ok(gmt == valid, "gmt = %lu\n", gmt);
ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
gmt_tm->tm_isdst = 1;
gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt);
ok(gmt == valid, "gmt = %lu\n", gmt);
ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
@ -177,13 +177,13 @@ static void test_gmtime(void)
gmt_tm->tm_isdst = -1;
gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt);
ok(gmt == valid, "gmt = %lu\n", gmt);
ok(gmt_tm->tm_wday == 6, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
ok(gmt_tm->tm_yday == 2, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
gmt_tm->tm_isdst = 1;
gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt);
ok(gmt == valid, "gmt = %lu\n", gmt);
if(!p_gmtime32_s) {
win_skip("Skipping _gmtime32_s tests\n");

View File

@ -163,8 +163,13 @@
#ifndef _MSVCRT_LONG_DEFINED
#define _MSVCRT_LONG_DEFINED
/* we need 32-bit longs even on 64-bit */
#ifdef __LP64__
typedef int __msvcrt_long;
typedef unsigned int __msvcrt_ulong;
#else
typedef long __msvcrt_long;
typedef unsigned long __msvcrt_ulong;
#endif
#endif
#ifndef _INTPTR_T_DEFINED