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); pis = call_func2(p_istream_seekg, &is1, 0);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis); 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(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 */ if (0) /* crashes on native */
is1.base_ios.sb = NULL; is1.base_ios.sb = NULL;
pis = call_func2(p_istream_seekg, &is1, -5); pis = call_func2(p_istream_seekg, &is1, -5);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis); 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(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.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; fb1.base.epptr = fb1.base.ebuf;
pis = call_func2(p_istream_seekg, &is1, 5); pis = call_func2(p_istream_seekg, &is1, 5);
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis); 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(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.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(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; is1.base_ios.state = IOSTATE_goodbit;
fd = fb1.fd; fd = fb1.fd;
fb1.fd = -1; 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(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(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.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 */ /* sync */
ret = (int) call_func1(p_istream_sync, &is1); 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); memset(btext, 0, LLEN);
tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */ 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(_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"); ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND _read\n");
_close(tempfd); _close(tempfd);
@ -1206,15 +1206,15 @@ static void test_file_write_read( void )
_lseek(tempfd, -3, FILE_END); _lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,1); ret = _read(tempfd,btext,1);
ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret); 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); _lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,2); ret = _read(tempfd,btext,2);
ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret); 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); _lseek(tempfd, -3, FILE_END);
ret = _read(tempfd,btext,3); ret = _read(tempfd,btext,3);
ok(ret == 2 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret); 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); _close(tempfd);
ret = unlink(tempf); 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[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0; arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v); _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); lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n"); ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n");
close (fd); close (fd);
@ -1482,7 +1482,7 @@ static void test_file_inherit( const char* selfname )
arg_v[3] = buffer; sprintf(buffer, "%d", fd); arg_v[3] = buffer; sprintf(buffer, "%d", fd);
arg_v[4] = 0; arg_v[4] = 0;
_spawnvp(_P_WAIT, selfname, arg_v); _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); ok(read(fd, buffer, sizeof (buffer)) == 0, "Found unexpected data (%s)\n", buffer);
close (fd); close (fd);
ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n"); ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n");

View File

@ -240,7 +240,7 @@ static void test__get_doserrno(void)
errno = EBADF; errno = EBADF;
ret = p_get_doserrno(NULL); ret = p_get_doserrno(NULL);
ok(ret == EINVAL, "Expected _get_doserrno to return EINVAL, got %d\n", ret); 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); ok(errno == EBADF, "Expected errno to be EBADF, got %d\n", errno);
_doserrno = ERROR_INVALID_CMM; _doserrno = ERROR_INVALID_CMM;
@ -287,19 +287,19 @@ static void test__set_doserrno(void)
ret = p_set_doserrno(ERROR_FILE_NOT_FOUND); ret = p_set_doserrno(ERROR_FILE_NOT_FOUND);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret); ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == ERROR_FILE_NOT_FOUND, 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; _doserrno = ERROR_INVALID_CMM;
ret = p_set_doserrno(-1); ret = p_set_doserrno(-1);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret); ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == -1, 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; _doserrno = ERROR_INVALID_CMM;
ret = p_set_doserrno(0xdeadbeef); ret = p_set_doserrno(0xdeadbeef);
ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret); ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
ok(_doserrno == 0xdeadbeef, 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) 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_tm->tm_wday = gmt_tm->tm_yday = 0;
gmt = p_mkgmtime32(gmt_tm); 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_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); 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_wday = gmt_tm->tm_yday = 0;
gmt_tm->tm_isdst = -1; gmt_tm->tm_isdst = -1;
gmt = p_mkgmtime32(gmt_tm); 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_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); 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_wday = gmt_tm->tm_yday = 0;
gmt_tm->tm_isdst = 1; gmt_tm->tm_isdst = 1;
gmt = p_mkgmtime32(gmt_tm); 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_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); 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_tm->tm_isdst = -1;
gmt = p_mkgmtime32(gmt_tm); 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_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); ok(gmt_tm->tm_yday == 2, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
gmt_tm->tm_isdst = 1; gmt_tm->tm_isdst = 1;
gmt = p_mkgmtime32(gmt_tm); gmt = p_mkgmtime32(gmt_tm);
ok(gmt == valid, "gmt = %u\n", gmt); ok(gmt == valid, "gmt = %lu\n", gmt);
if(!p_gmtime32_s) { if(!p_gmtime32_s) {
win_skip("Skipping _gmtime32_s tests\n"); win_skip("Skipping _gmtime32_s tests\n");

View File

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