ntdll: Use BOOL type where appropriate
Frédéric Delanoy
frederic.delanoy at gmail.com
Sat Nov 2 08:34:13 CDT 2013
---
dlls/ntdll/loader.c | 6 +++---
dlls/ntdll/nt.c | 10 +++++-----
dlls/ntdll/server.c | 18 +++++++++---------
dlls/ntdll/signal_x86_64.c | 4 ++--
dlls/ntdll/virtual.c | 10 +++++-----
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 3a28b41..0455df4 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -57,7 +57,7 @@ WINE_DECLARE_DEBUG_CHANNEL(imports);
typedef DWORD (CALLBACK *DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
-static int process_detaching = 0; /* set on process detach to avoid deadlocks with thread detach */
+static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
static const char * const reason_names[] =
@@ -127,7 +127,7 @@ static inline void *get_rva( HMODULE module, DWORD va )
}
/* check whether the file name contains a path */
-static inline int contains_path( LPCWSTR name )
+static inline BOOL contains_path( LPCWSTR name )
{
return ((*name && (name[1] == ':')) || strchrW(name, '/') || strchrW(name, '\\'));
}
@@ -2391,7 +2391,7 @@ BOOLEAN WINAPI RtlDllShutdownInProgress(void)
void WINAPI LdrShutdownProcess(void)
{
TRACE("()\n");
- process_detaching = 1;
+ process_detaching = TRUE;
process_detach();
}
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 8a53d03..c9499d6 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -850,7 +850,7 @@ static inline void do_cpuid(unsigned int ax, unsigned int *p)
}
/* From xf86info havecpuid.c 1.11 */
-static inline int have_cpuid(void)
+static inline BOOL have_cpuid(void)
{
#ifdef __i386__
unsigned int f1, f2;
@@ -868,16 +868,16 @@ static inline int have_cpuid(void)
: "ir" (0x00200000));
return ((f1^f2) & 0x00200000) != 0;
#elif defined(__x86_64__)
- return 1;
+ return TRUE;
#else
- return 0;
+ return FALSE;
#endif
}
/* Detect if a SSE2 processor is capable of Denormals Are Zero (DAZ) mode.
*
* This function assumes you have already checked for SSE2/FXSAVE support. */
-static inline int have_sse_daz_mode(void)
+static inline BOOL have_sse_daz_mode(void)
{
#ifdef __i386__
typedef struct DECLSPEC_ALIGN(16) _M128A {
@@ -913,7 +913,7 @@ static inline int have_sse_daz_mode(void)
return (state->MxCsr_Mask & (1 << 6)) >> 6;
#else /* all x86_64 processors include SSE2 with DAZ mode */
- return 1;
+ return TRUE;
#endif
}
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 9b3aeef..f396dd5 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -814,7 +814,7 @@ static inline unsigned int handle_to_index( HANDLE handle, unsigned int *entry )
*
* Caller must hold fd_cache_section.
*/
-static int add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
+static BOOL add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
unsigned int access, unsigned int options )
{
unsigned int entry, idx = handle_to_index( handle, &entry );
@@ -823,7 +823,7 @@ static int add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
if (entry >= FD_CACHE_ENTRIES)
{
FIXME( "too many allocated handles, not caching %p\n", handle );
- return 0;
+ return FALSE;
}
if (!fd_cache[entry]) /* do we need to allocate a new block of entries? */
@@ -833,7 +833,7 @@ static int add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
{
void *ptr = wine_anon_mmap( NULL, FD_CACHE_BLOCK_SIZE * sizeof(struct fd_cache_entry),
PROT_READ | PROT_WRITE, 0 );
- if (ptr == MAP_FAILED) return 0;
+ if (ptr == MAP_FAILED) return FALSE;
fd_cache[entry] = ptr;
}
}
@@ -843,7 +843,7 @@ static int add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
fd_cache[entry][idx].access = access;
fd_cache[entry][idx].options = options;
if (prev_fd != -1) close( prev_fd );
- return 1;
+ return TRUE;
}
@@ -1025,12 +1025,12 @@ int server_pipe( int fd[2] )
{
int ret;
#ifdef HAVE_PIPE2
- static int have_pipe2 = 1;
+ static BOOL have_pipe2 = TRUE;
if (have_pipe2)
{
if (!(ret = pipe2( fd, O_CLOEXEC ))) return ret;
- if (errno == ENOSYS || errno == EINVAL) have_pipe2 = 0; /* don't try again */
+ if (errno == ENOSYS || errno == EINVAL) have_pipe2 = FALSE; /* don't try again */
}
#endif
if (!(ret = pipe( fd )))
@@ -1049,7 +1049,7 @@ int server_pipe( int fd[2] )
*/
static void start_server(void)
{
- static int started; /* we only try once */
+ static BOOL started; /* we only try once */
char *argv[3];
static char wineserver[] = "server/wineserver";
static char debug[] = "-d";
@@ -1071,7 +1071,7 @@ static void start_server(void)
status = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
if (status == 2) return; /* server lock held by someone else, will retry later */
if (status) exit(status); /* server failed */
- started = 1;
+ started = TRUE;
}
}
@@ -1428,7 +1428,7 @@ NTSTATUS server_init_process_done(void)
*/
size_t server_init_thread( void *entry_point )
{
- static const int is_win64 = (sizeof(void *) > sizeof(int));
+ static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
const char *arch = getenv( "WINEARCH" );
int ret;
int reply_pipe[2];
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 8bcf71b..b28cb99 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -814,7 +814,7 @@ static const char *dwarf_reg_names[NB_FRAME_REGS] =
/* 33-40 */ "%st0", "%st1", "%st2", "%st3", "%st4", "%st5", "%st6", "%st7"
};
-static int valid_reg( ULONG_PTR reg )
+static BOOL valid_reg( ULONG_PTR reg )
{
if (reg >= NB_FRAME_REGS) FIXME( "unsupported reg %lx\n", reg );
return (reg < NB_FRAME_REGS);
@@ -1383,7 +1383,7 @@ static inline void *get_signal_stack(void)
*
* Check if pointer is inside the signal stack.
*/
-static inline int is_inside_signal_stack( void *ptr )
+static inline BOOL is_inside_signal_stack( void *ptr )
{
return ((char *)ptr >= (char *)get_signal_stack() &&
(char *)ptr < (char *)get_signal_stack() + signal_stack_size);
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index e8a8b50..34d4648 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -135,7 +135,7 @@ static void *user_space_limit;
static void *working_set_limit;
static void *address_space_start = (void *)0x10000;
#endif /* __i386__ */
-static const int is_win64 = (sizeof(void *) > sizeof(int));
+static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
#define ROUND_ADDR(addr,mask) \
((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask)))
@@ -151,8 +151,8 @@ static const int is_win64 = (sizeof(void *) > sizeof(int));
static HANDLE virtual_heap;
static void *preload_reserve_start;
static void *preload_reserve_end;
-static int use_locks;
-static int force_exec_prot; /* whether to force PROT_EXEC on all PROT_READ mmaps */
+static BOOL use_locks = FALSE;
+static BOOL force_exec_prot = FALSE; /* whether to force PROT_EXEC on all PROT_READ mmaps */
/***********************************************************************
@@ -410,7 +410,7 @@ static void remove_reserved_area( void *addr, size_t size )
*
* Check if an address range goes beyond a given limit.
*/
-static inline int is_beyond_limit( const void *addr, size_t size, const void *limit )
+static inline BOOL is_beyond_limit( const void *addr, size_t size, const void *limit )
{
return (addr >= limit || (const char *)addr + size > (const char *)limit);
}
@@ -1452,7 +1452,7 @@ void virtual_init(void)
*/
void virtual_init_threading(void)
{
- use_locks = 1;
+ use_locks = TRUE;
}
--
1.8.4.2
More information about the wine-patches
mailing list