Commit 82f175e9 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Replace long by MSVCRT_long.

parent 580e07e7
......@@ -122,7 +122,7 @@ unsigned int MSVCRT__sys_nerr = sizeof(MSVCRT__sys_errlist)/sizeof(MSVCRT__sys_e
void msvcrt_set_errno(int err)
{
int *errno = MSVCRT__errno();
unsigned long *doserrno = MSVCRT___doserrno();
MSVCRT_ulong *doserrno = MSVCRT___doserrno();
*doserrno = err;
......@@ -189,7 +189,7 @@ int* CDECL MSVCRT__errno(void)
/*********************************************************************
* __doserrno (MSVCRT.@)
*/
unsigned long* CDECL MSVCRT___doserrno(void)
MSVCRT_ulong* CDECL MSVCRT___doserrno(void)
{
return &msvcrt_get_thread_data()->thread_doserrno;
}
......
......@@ -924,7 +924,7 @@ int CDECL MSVCRT__locking(int fd, int mode, LONG nbytes)
/*********************************************************************
* fseek (MSVCRT.@)
*/
int CDECL MSVCRT_fseek(MSVCRT_FILE* file, long offset, int whence)
int CDECL MSVCRT_fseek(MSVCRT_FILE* file, MSVCRT_long offset, int whence)
{
/* Flush output if needed */
if(file->_flag & MSVCRT__IOWRT)
......@@ -956,13 +956,13 @@ int CDECL MSVCRT_fseek(MSVCRT_FILE* file, long offset, int whence)
/*********************************************************************
* _chsize (MSVCRT.@)
*/
int CDECL _chsize(int fd, long size)
int CDECL _chsize(int fd, MSVCRT_long size)
{
LONG cur, pos;
HANDLE handle;
BOOL ret = FALSE;
TRACE("(fd=%d, size=%ld)\n", fd, size);
TRACE("(fd=%d, size=%d)\n", fd, size);
LOCK_FILES();
......@@ -1895,9 +1895,9 @@ int CDECL MSVCRT_stat64(const char* path, struct MSVCRT__stat64 * buf)
buf->st_atime = dw;
RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw);
buf->st_mtime = buf->st_ctime = dw;
TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink,
(long)(buf->st_size >> 32),(long)buf->st_size,
(long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime);
TRACE("%d %d 0x%08x%08x %d %d %d\n", buf->st_mode,buf->st_nlink,
(int)(buf->st_size >> 32),(int)buf->st_size,
(int)buf->st_atime,(int)buf->st_mtime,(int)buf->st_ctime);
return 0;
}
......@@ -1984,9 +1984,9 @@ int CDECL MSVCRT__wstat64(const MSVCRT_wchar_t* path, struct MSVCRT__stat64 * bu
buf->st_atime = dw;
RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw);
buf->st_mtime = buf->st_ctime = dw;
TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink,
(long)(buf->st_size >> 32),(long)buf->st_size,
(long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime);
TRACE("%d %d 0x%08x%08x %d %d %d\n", buf->st_mode,buf->st_nlink,
(int)(buf->st_size >> 32),(int)buf->st_size,
(int)buf->st_atime,(int)buf->st_mtime,(int)buf->st_ctime);
return 0;
}
......@@ -2020,7 +2020,7 @@ int CDECL MSVCRT__wstat(const MSVCRT_wchar_t* path, struct MSVCRT__stat * buf)
/*********************************************************************
* _tell (MSVCRT.@)
*/
long CDECL _tell(int fd)
MSVCRT_long CDECL _tell(int fd)
{
return MSVCRT__lseek(fd, 0, SEEK_CUR);
}
......@@ -2872,7 +2872,7 @@ LONG CDECL MSVCRT_ftell(MSVCRT_FILE* file)
{
/* TODO: just call fgetpos and return lower half of result */
int off=0;
long pos;
MSVCRT_long pos;
pos = _tell(file->_file);
if(pos == -1) return -1;
if(file->_bufsiz) {
......
......@@ -436,7 +436,7 @@ double CDECL _logb(double num)
/*********************************************************************
* _lrotl (MSVCRT.@)
*/
unsigned long CDECL _lrotl(unsigned long num, int shift)
MSVCRT_ulong CDECL _lrotl(MSVCRT_ulong num, int shift)
{
shift &= 0x1f;
return (num << shift) | (num >> (32-shift));
......@@ -445,7 +445,7 @@ unsigned long CDECL _lrotl(unsigned long num, int shift)
/*********************************************************************
* _lrotr (MSVCRT.@)
*/
unsigned long CDECL _lrotr(unsigned long num, int shift)
MSVCRT_ulong CDECL _lrotr(MSVCRT_ulong num, int shift)
{
shift &= 0x1f;
return (num >> shift) | (num << (32-shift));
......@@ -463,7 +463,7 @@ unsigned int CDECL _rotr(unsigned int num, int shift)
/*********************************************************************
* _scalb (MSVCRT.@)
*/
double CDECL _scalb(double num, long power)
double CDECL _scalb(double num, MSVCRT_long power)
{
/* Note - Can't forward directly as libc expects y as double */
double dblpower = (double)power;
......@@ -592,7 +592,7 @@ int * CDECL __fpecode(void)
/*********************************************************************
* ldexp (MSVCRT.@)
*/
double CDECL MSVCRT_ldexp(double num, long exp)
double CDECL MSVCRT_ldexp(double num, MSVCRT_long exp)
{
double z = ldexp(num,exp);
......@@ -1007,10 +1007,10 @@ MSVCRT_div_t CDECL MSVCRT_div(int num, int denom)
* [i386] Windows binary compatible - returns the struct in eax/edx.
*/
#ifdef __i386__
unsigned __int64 CDECL MSVCRT_ldiv(long num, long denom)
unsigned __int64 CDECL MSVCRT_ldiv(MSVCRT_long num, MSVCRT_long denom)
{
ldiv_t ldt = ldiv(num,denom);
return ((unsigned __int64)ldt.rem << 32) | (unsigned long)ldt.quot;
return ((unsigned __int64)ldt.rem << 32) | (MSVCRT_ulong)ldt.quot;
}
#else
/*********************************************************************
......@@ -1018,7 +1018,7 @@ unsigned __int64 CDECL MSVCRT_ldiv(long num, long denom)
* VERSION
* [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
*/
MSVCRT_ldiv_t CDECL MSVCRT_ldiv(long num, long denom)
MSVCRT_ldiv_t CDECL MSVCRT_ldiv(MSVCRT_long num, MSVCRT_long denom)
{
ldiv_t result = ldiv(num,denom);
......
......@@ -63,9 +63,9 @@ int CDECL MSVCRT_rand(void)
/*********************************************************************
* _sleep (MSVCRT.@)
*/
void CDECL MSVCRT__sleep(unsigned long timeout)
void CDECL MSVCRT__sleep(MSVCRT_ulong timeout)
{
TRACE("_sleep for %ld milliseconds\n",timeout);
TRACE("_sleep for %d milliseconds\n",timeout);
Sleep((timeout)?timeout:1);
}
......
......@@ -46,6 +46,8 @@ typedef unsigned short MSVCRT_wint_t;
typedef unsigned short MSVCRT_wctype_t;
typedef unsigned short MSVCRT__ino_t;
typedef unsigned int MSVCRT__fsize_t;
typedef int MSVCRT_long;
typedef unsigned int MSVCRT_ulong;
#ifdef _WIN64
typedef unsigned __int64 MSVCRT_size_t;
typedef __int64 MSVCRT_intptr_t;
......@@ -56,8 +58,8 @@ typedef long MSVCRT_intptr_t;
typedef unsigned long MSVCRT_uintptr_t;
#endif
typedef unsigned int MSVCRT__dev_t;
typedef int MSVCRT__off_t;
typedef long MSVCRT_clock_t;
typedef int MSVCRT__off_t;
typedef int MSVCRT_clock_t;
typedef int MSVCRT___time32_t;
typedef __int64 MSVCRT___time64_t;
typedef __int64 MSVCRT_fpos_t;
......@@ -91,7 +93,7 @@ extern DWORD msvcrt_tls_index;
struct __thread_data {
int thread_errno;
unsigned long thread_doserrno;
MSVCRT_ulong thread_doserrno;
unsigned int random_seed; /* seed for rand() */
char *strtok_next; /* next ptr for strtok() */
unsigned char *mbstok_next; /* next ptr for mbstok() */
......@@ -263,8 +265,8 @@ typedef struct MSVCRT__div_t {
} MSVCRT_div_t;
typedef struct MSVCRT__ldiv_t {
long quot; /* quotient */
long rem; /* remainder */
MSVCRT_long quot; /* quotient */
MSVCRT_long rem; /* remainder */
} MSVCRT_ldiv_t;
struct MSVCRT__heapinfo {
......@@ -715,7 +717,7 @@ MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
void __cdecl MSVCRT__exit(int);
void __cdecl MSVCRT_abort(void);
unsigned long* __cdecl MSVCRT___doserrno(void);
MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
int* __cdecl MSVCRT__errno(void);
char* __cdecl MSVCRT_getenv(const char*);
char* __cdecl MSVCRT_setlocale(int,const char*);
......
......@@ -185,7 +185,7 @@ static MSVCRT_intptr_t msvcrt_spawn(int flags, const MSVCRT_wchar_t* exe, MSVCRT
static MSVCRT_wchar_t* msvcrt_argvtos(const MSVCRT_wchar_t* const* arg, MSVCRT_wchar_t delim)
{
const MSVCRT_wchar_t* const* a;
long size;
int size;
MSVCRT_wchar_t* p;
MSVCRT_wchar_t* ret;
......@@ -230,7 +230,7 @@ static MSVCRT_wchar_t* msvcrt_argvtos(const MSVCRT_wchar_t* const* arg, MSVCRT_w
static MSVCRT_wchar_t *msvcrt_argvtos_aw(const char * const *arg, MSVCRT_wchar_t delim)
{
const char * const *a;
unsigned long len;
unsigned int len;
MSVCRT_wchar_t *p, *ret;
if (!arg)
......
......@@ -179,7 +179,7 @@ static void test_readmode( BOOL ascii_mode )
const int *ip;
int i, j, m, ao, pl;
unsigned int fp;
long l;
LONG l;
fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE);
/* an internal buffer of BUFSIZ is maintained, so make a file big
......@@ -212,7 +212,7 @@ static void test_readmode( BOOL ascii_mode )
ok(fgets(buffer,2*BUFSIZ+256,file) !=0,"padding line fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
pl = 2*BUFSIZ-2;
ok(l == pl,"padding line ftell got %ld should be %d in %s\n", l, pl, IOMODE);
ok(l == pl,"padding line ftell got %d should be %d in %s\n", l, pl, IOMODE);
ok(lstrlenA(buffer) == pl+ao,"padding line fgets got size %d should be %d in %s\n",
lstrlenA(buffer), pl+ao, IOMODE);
for (fp=0; fp<strlen(outbuffer); fp++)
......@@ -220,23 +220,23 @@ static void test_readmode( BOOL ascii_mode )
fp++;
ok(fgets(buffer,256,file) !=0,"line 1 fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
ok(l == pl+fp,"line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == fp+ao,"line 1 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), fp+ao, IOMODE);
/* test a seek back across the buffer boundary */
l = pl;
ok(fseek(file,l,SEEK_SET)==0,"seek failure in %s\n", IOMODE);
l = ftell(file);
ok(l == pl,"ftell after seek got %ld should be %d in %s\n", l, pl, IOMODE);
ok(l == pl,"ftell after seek got %d should be %d in %s\n", l, pl, IOMODE);
ok(fgets(buffer,256,file) !=0,"second read of line 1 fgets failed unexpected in %s\n", IOMODE);
l = ftell(file);
ok(l == pl+fp,"second read of line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"second read of line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == fp+ao,"second read of line 1 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), fp+ao, IOMODE);
ok(fgets(buffer,256,file) !=0,"line 2 fgets failed unexpected in %s\n", IOMODE);
fp += 2;
l = ftell(file);
ok(l == pl+fp,"line 2 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE);
ok(l == pl+fp,"line 2 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE);
ok(lstrlenA(buffer) == 2+ao,"line 2 fgets got size %d should be %d in %s\n",
lstrlenA(buffer), 2+ao, IOMODE);
......@@ -248,7 +248,7 @@ static void test_readmode( BOOL ascii_mode )
i=fread(buffer,1,BUFSIZ+strlen(outbuffer),file);
ok(i==BUFSIZ+j,"fread failed, expected %d got %d in %s\n", BUFSIZ+j, i, IOMODE);
l = ftell(file);
ok(l == pl+j-(ao*4)-5,"ftell after fread got %ld should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE);
ok(l == pl+j-(ao*4)-5,"ftell after fread got %d should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE);
for (m=0; m<3; m++)
ok(buffer[m]==padbuffer[m+(BUFSIZ-4)%strlen(padbuffer)],"expected %c got %c\n", padbuffer[m], buffer[m]);
m+=BUFSIZ+2+ao;
......@@ -531,7 +531,7 @@ static void test_fgetwc( void )
BOOL diff_found = FALSE;
int j;
unsigned int i;
long l;
LONG l;
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"wb");
......@@ -550,10 +550,10 @@ static void test_fgetwc( void )
tempfh = fopen(tempf,"rt"); /* open in TEXT mode */
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
ok(l==BUFSIZ-2, "ftell expected %d got %ld\n", BUFSIZ-2, l);
ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l);
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %ld\n", BUFSIZ-2+lstrlen(mytext), l);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %d\n", BUFSIZ-2+lstrlen(mytext), l);
mytextW = AtoW (mytext);
aptr = mytextW;
wptr = wtextW;
......@@ -586,25 +586,25 @@ static void test_fgetwc( void )
fgetws(wtextW,j,tempfh);
l=ftell(tempfh);
j=(j-1)*sizeof(WCHAR);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
i=fgetc(tempfh);
ok(i=='a', "fgetc expected %d got %d\n", 0x61, i);
l=ftell(tempfh);
j++;
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
fgetws(wtextW,3,tempfh);
ok(wtextW[0]=='\r',"expected carriage return got %04hx\n", wtextW[0]);
ok(wtextW[1]=='\n',"expected newline got %04hx\n", wtextW[1]);
l=ftell(tempfh);
j += 4;
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
for(i=0; i<strlen(mytext); i++)
wtextW[i] = 0;
/* the first time we get the string, it should be entirely within the local buffer */
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
j += (strlen(mytext)-1)*sizeof(WCHAR);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
diff_found = FALSE;
aptr = mytextW;
wptr = wtextW;
......@@ -643,7 +643,7 @@ static void test_ctrlz( void )
static const char mytext[]= "This is test_ctrlz";
char buffer[256];
int i, j;
long l;
LONG l;
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"wb");
......@@ -664,7 +664,7 @@ static void test_ctrlz( void )
ok(i==j, "returned string length expected %d got %d\n", j, i);
j+=4; /* ftell should indicate the true end of file */
l=ftell(tempfh);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
ok(feof(tempfh), "did not get EOF\n");
fclose(tempfh);
......@@ -674,7 +674,7 @@ static void test_ctrlz( void )
j=strlen(mytext)+3; /* should get through newline */
ok(i==j, "returned string length expected %d got %d\n", j, i);
l=ftell(tempfh);
ok(l==j, "ftell expected %d got %ld\n", j, l);
ok(l==j, "ftell expected %d got %d\n", j, l);
ok(fgets(buffer,256,tempfh) != 0,"fgets failed unexpected\n");
i=strlen(buffer);
ok(i==1, "returned string length expected %d got %d\n", 1, i);
......@@ -785,7 +785,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 %lu expecting 0\n", tell(tempfd));
ok(tell(tempfd) == 0, "bad position %u 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);
......@@ -801,7 +801,7 @@ static void test_file_write_read( void )
_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 %lu expecting 42\n", tell(tempfd));
ok(tell(tempfd) == 42, "bad position %u expecting 42\n", tell(tempfd));
_close(tempfd);
ret = unlink(tempf);
......@@ -872,7 +872,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 %lu expecting 8\n", tell(fd));
ok(tell(fd) == 8, "bad position %u 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);
......@@ -886,7 +886,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 %lu expecting 0\n", tell(fd));
ok(tell(fd) == 0, "bad position %u 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");
......@@ -914,7 +914,7 @@ static void test_tmpnam( void )
static void test_chsize( void )
{
int fd;
long cur, pos, count;
LONG cur, pos, count;
char temptext[] = "012345678";
char *tempfile = _tempnam( ".", "tst" );
......@@ -933,14 +933,14 @@ static void test_chsize( void )
ok( _chsize( fd, sizeof(temptext) / 2 ) == 0, "_chsize() failed\n" );
pos = _lseek( fd, 0, SEEK_CUR );
ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos );
ok( _filelength( fd ) == sizeof(temptext) / 2, "Wrong file size\n" );
/* enlarge the file */
ok( _chsize( fd, sizeof(temptext) * 2 ) == 0, "_chsize() failed\n" );
pos = _lseek( fd, 0, SEEK_CUR );
ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos );
ok( _filelength( fd ) == sizeof(temptext) * 2, "Wrong file size\n" );
_close( fd );
......
......@@ -447,12 +447,12 @@ int * CDECL __p__dstbias(void)
/*********************************************************************
* _timezone (MSVCRT.@)
*/
long MSVCRT___timezone = 0;
MSVCRT_long MSVCRT___timezone = 0;
/*********************************************************************
* __p_timezone (MSVCRT.@)
*/
long * CDECL MSVCRT___p__timezone(void)
MSVCRT_long * CDECL MSVCRT___p__timezone(void)
{
return &MSVCRT___timezone;
}
......@@ -490,7 +490,7 @@ void CDECL MSVCRT__tzset(void)
static const time_t seconds_in_year = (365 * 24 + 6) * 3600;
time_t t;
struct tm *tmp;
long zone_january, zone_july;
int zone_january, zone_july;
t = (time(NULL) / seconds_in_year) * seconds_in_year;
tmp = localtime(&t);
......
......@@ -319,7 +319,7 @@ static const char* get_number(struct parsed_symbol* sym)
}
else if (*sym->current >= 'A' && *sym->current <= 'P')
{
long ret = 0;
int ret = 0;
while (*sym->current >= 'A' && *sym->current <= 'P')
{
......@@ -329,7 +329,7 @@ static const char* get_number(struct parsed_symbol* sym)
if (*sym->current != '@') return NULL;
ptr = und_alloc(sym, 17);
sprintf(ptr, "%s%ld", sgn ? "-" : "", ret);
sprintf(ptr, "%s%d", sgn ? "-" : "", ret);
sym->current++;
}
else return NULL;
......
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