=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: kernel32: Use BOOL type where appropriate.

Alexandre Julliard julliard at winehq.org
Thu Oct 24 13:18:56 CDT 2013


Module: wine
Branch: master
Commit: 7ab78b4e03c5263ab4f3d258f419f66b5eb875d0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7ab78b4e03c5263ab4f3d258f419f66b5eb875d0

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Thu Oct 24 00:40:22 2013 +0200

kernel32: Use BOOL type where appropriate.

---

 dlls/kernel32/console.c |   26 +++++++++++++-------------
 dlls/kernel32/environ.c |    4 ++--
 dlls/kernel32/except.c  |    2 +-
 dlls/kernel32/sync.c    |    4 ++--
 dlls/kernel32/time.c    |    4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 9f2f528..4f0ed09 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -2272,7 +2272,7 @@ static int CONSOLE_WriteChars(HANDLE hCon, LPCWSTR lpBuffer, int nc, COORD* pos)
  * WriteConsoleOutput helper: handles passing to next line (+scrolling if necessary)
  *
  */
-static int	next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
+static BOOL next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
 {
     SMALL_RECT	src;
     CHAR_INFO	ci;
@@ -2281,7 +2281,7 @@ static int	next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
     csbi->dwCursorPosition.X = 0;
     csbi->dwCursorPosition.Y++;
 
-    if (csbi->dwCursorPosition.Y < csbi->dwSize.Y) return 1;
+    if (csbi->dwCursorPosition.Y < csbi->dwSize.Y) return TRUE;
 
     src.Top    = 1;
     src.Bottom = csbi->dwSize.Y - 1;
@@ -2296,8 +2296,8 @@ static int	next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
 
     csbi->dwCursorPosition.Y--;
     if (!ScrollConsoleScreenBufferW(hCon, &src, NULL, dst, &ci))
-	return 0;
-    return 1;
+        return FALSE;
+    return TRUE;
 }
 
 /******************************************************************
@@ -2308,13 +2308,13 @@ static int	next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
  * handled
  *
  */
-static int     	write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,
-			    DWORD mode, LPCWSTR ptr, int len)
+static BOOL write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,
+                        DWORD mode, LPCWSTR ptr, int len)
 {
     int	blk;	/* number of chars to write on current line */
     int done;   /* number of chars already written */
 
-    if (len <= 0) return 1;
+    if (len <= 0) return TRUE;
 
     if (mode & ENABLE_WRAP_AT_EOL_OUTPUT) /* writes remaining on next line */
     {
@@ -2323,9 +2323,9 @@ static int     	write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,
             blk = min(len - done, csbi->dwSize.X - csbi->dwCursorPosition.X);
 
             if (CONSOLE_WriteChars(hCon, ptr + done, blk, &csbi->dwCursorPosition) != blk)
-                return 0;
+                return FALSE;
             if (csbi->dwCursorPosition.X == csbi->dwSize.X && !next_line(hCon, csbi))
-                return 0;
+                return FALSE;
         }
     }
     else
@@ -2342,11 +2342,11 @@ static int     	write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,
 
             csbi->dwCursorPosition.X = pos;
             if (CONSOLE_WriteChars(hCon, ptr + done, blk, &csbi->dwCursorPosition) != blk)
-                return 0;
+                return FALSE;
         }
     }
 
-    return 1;
+    return TRUE;
 }
 
 /***********************************************************************
@@ -2491,7 +2491,7 @@ BOOL WINAPI WriteConsoleA(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
 
     if (lpNumberOfCharsWritten) *lpNumberOfCharsWritten = 0;
     xstring = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR));
-    if (!xstring) return 0;
+    if (!xstring) return FALSE;
 
     MultiByteToWideChar(GetConsoleOutputCP(), 0, lpBuffer, nNumberOfCharsToWrite, xstring, n);
 
@@ -3009,7 +3009,7 @@ unsigned CONSOLE_GetNumHistoryEntries(void)
  */
 BOOL CONSOLE_GetEditionMode(HANDLE hConIn, int* mode)
 {
-    unsigned ret = FALSE;
+    unsigned ret = 0;
     SERVER_START_REQ(get_console_input_info)
     {
         req->handle = console_handle_unmap(hConIn);
diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c
index e6634a2..b6b3124 100644
--- a/dlls/kernel32/environ.c
+++ b/dlls/kernel32/environ.c
@@ -247,7 +247,7 @@ BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value )
     if (!name)
     {
         SetLastError(ERROR_ENVVAR_NOT_FOUND);
-        return 0;
+        return FALSE;
     }
 
     RtlCreateUnicodeStringFromAsciiz( &us_name, name );
@@ -280,7 +280,7 @@ BOOL WINAPI SetEnvironmentVariableW( LPCWSTR name, LPCWSTR value )
     if (!name)
     {
         SetLastError(ERROR_ENVVAR_NOT_FOUND);
-        return 0;
+        return FALSE;
     }
 
     RtlInitUnicodeString(&us_name, name);
diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c
index 49e5c25..77ec91d 100644
--- a/dlls/kernel32/except.c
+++ b/dlls/kernel32/except.c
@@ -346,7 +346,7 @@ EXIT:
  *
  * returns TRUE for the two first conditions, FALSE for the last
  */
-static	int	start_debugger_atomic(PEXCEPTION_POINTERS epointers)
+static BOOL start_debugger_atomic(PEXCEPTION_POINTERS epointers)
 {
     static HANDLE	hRunOnce /* = 0 */;
 
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index a0ccbb6..5b7f810 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -50,7 +50,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(sync);
 
 /* check if current version is NT or Win95 */
-static inline int is_version_nt(void)
+static inline BOOL is_version_nt(void)
 {
     return !(GetVersion() & 0x80000000);
 }
@@ -1467,7 +1467,7 @@ BOOL WINAPI WaitNamedPipeA (LPCSTR name, DWORD nTimeOut)
     if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
     {
         SetLastError( ERROR_FILENAME_EXCED_RANGE );
-        return 0;
+        return FALSE;
     }
     return WaitNamedPipeW( buffer, nTimeOut );
 }
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index a1875f4..77c71cb 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -67,9 +67,9 @@ static const int MonthLengths[2][12] =
 	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
 };
 
-static inline int IsLeapYear(int Year)
+static inline BOOL IsLeapYear(int Year)
 {
-	return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
+    return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0);
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list