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

Alexandre Julliard julliard at winehq.org
Thu Dec 12 12:48:08 CST 2013


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

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Wed Dec 11 20:57:15 2013 +0100

krnl386.exe16: Use BOOL type where appropriate.

---

 dlls/krnl386.exe16/dosexe.h |    2 +-
 dlls/krnl386.exe16/int16.c  |    6 ++--
 dlls/krnl386.exe16/int21.c  |   51 ++++++++++++++++++++++---------------------
 3 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/dlls/krnl386.exe16/dosexe.h b/dlls/krnl386.exe16/dosexe.h
index 0b813e1..f9df172 100644
--- a/dlls/krnl386.exe16/dosexe.h
+++ b/dlls/krnl386.exe16/dosexe.h
@@ -404,7 +404,7 @@ extern void WINAPI DOSVM_Int15Handler(CONTEXT*);
 /* int16.c */
 extern void WINAPI DOSVM_Int16Handler(CONTEXT*);
 extern BOOL DOSVM_Int16ReadChar( BYTE *, BYTE *, CONTEXT * );
-extern int DOSVM_Int16AddChar(BYTE ascii,BYTE scan);
+extern BOOL DOSVM_Int16AddChar(BYTE ascii, BYTE scan);
 
 /* int21.c */
 extern void WINAPI DOSVM_Int21Handler(CONTEXT*);
diff --git a/dlls/krnl386.exe16/int16.c b/dlls/krnl386.exe16/int16.c
index 5d84a0b..c731472 100644
--- a/dlls/krnl386.exe16/int16.c
+++ b/dlls/krnl386.exe16/int16.c
@@ -195,7 +195,7 @@ BOOL DOSVM_Int16ReadChar(BYTE *ascii, BYTE *scan, CONTEXT *waitctx)
     return TRUE;
 }
 
-int DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
+BOOL DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
 {
   BIOSDATA *data = DOSVM_BiosData();
   WORD CurOfs = data->FirstKbdCharPtr;
@@ -204,12 +204,12 @@ int DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
   TRACE("(%02x,%02x)\n",ascii,scan);
   if (NextOfs >= data->KbdBufferEnd) NextOfs = data->KbdBufferStart;
   /* check if buffer is full */
-  if (NextOfs == data->NextKbdCharPtr) return 0;
+  if (NextOfs == data->NextKbdCharPtr) return FALSE;
 
   /* okay, insert character in ring buffer */
   ((BYTE*)data)[CurOfs] = ascii;
   ((BYTE*)data)[CurOfs+1] = scan;
 
   data->FirstKbdCharPtr = NextOfs;
-  return 1;
+  return TRUE;
 }
diff --git a/dlls/krnl386.exe16/int21.c b/dlls/krnl386.exe16/int21.c
index 3652054..53b6537 100644
--- a/dlls/krnl386.exe16/int21.c
+++ b/dlls/krnl386.exe16/int21.c
@@ -3437,7 +3437,7 @@ static int INT21_GetDiskSerialNumber( CONTEXT *context )
  *		INT21_SetDiskSerialNumber
  *
  */
-static int INT21_SetDiskSerialNumber( CONTEXT *context )
+static BOOL INT21_SetDiskSerialNumber( CONTEXT *context )
 {
 #if 0
     BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
@@ -3446,15 +3446,15 @@ static int INT21_SetDiskSerialNumber( CONTEXT *context )
     if (!is_valid_drive(drive))
     {
         SetLastError( ERROR_INVALID_DRIVE );
-        return 0;
+        return FALSE;
     }
 
     DRIVE_SetSerialNumber( drive, *(DWORD *)(dataptr + 2) );
-    return 1;
+    return TRUE;
 #else
     FIXME("Setting drive serial number is no longer supported\n");
     SetLastError( ERROR_NOT_SUPPORTED );
-    return 0;
+    return FALSE;
 #endif
 }
 
@@ -3463,7 +3463,7 @@ static int INT21_SetDiskSerialNumber( CONTEXT *context )
  *		INT21_GetFreeDiskSpace
  *
  */
-static int INT21_GetFreeDiskSpace( CONTEXT *context )
+static BOOL INT21_GetFreeDiskSpace( CONTEXT *context )
 {
     DWORD cluster_sectors, sector_bytes, free_clusters, total_clusters;
     WCHAR root[] = {'A',':','\\',0};
@@ -3473,7 +3473,8 @@ static int INT21_GetFreeDiskSpace( CONTEXT *context )
 
     root[0] += INT21_MapDrive(DL_reg(context));
     if (!GetDiskFreeSpaceW( root, &cluster_sectors, &sector_bytes,
-                            &free_clusters, &total_clusters )) return 0;
+                            &free_clusters, &total_clusters ))
+        return FALSE;
 
     /* Some old win31 apps (Lotus SmartSuite 5.1) crap out if there's too
      * much disk space, so Windows XP seems to apply the following limits:
@@ -3530,19 +3531,19 @@ static int INT21_GetFreeDiskSpace( CONTEXT *context )
     SET_BX( context, free_clusters );
     SET_CX( context, sector_bytes );
     SET_DX( context, total_clusters );
-    return 1;
+    return TRUE;
 }
 
 /******************************************************************
  *		INT21_GetDriveAllocInfo
  *
  */
-static int INT21_GetDriveAllocInfo( CONTEXT *context, BYTE drive )
+static BOOL INT21_GetDriveAllocInfo( CONTEXT *context, BYTE drive )
 {
     INT21_DPB  *dpb;
 
     drive = INT21_MapDrive( drive );
-    if (!INT21_FillDrivePB( drive )) return 0;
+    if (!INT21_FillDrivePB( drive )) return FALSE;
     dpb = &(INT21_GetHeapPointer()->misc_dpb_list[drive]);
     SET_AL( context, dpb->cluster_sectors + 1 );
     SET_CX( context, dpb->sector_bytes );
@@ -3550,7 +3551,7 @@ static int INT21_GetDriveAllocInfo( CONTEXT *context, BYTE drive )
 
     context->SegDs = INT21_GetHeapSelector( context );
     SET_BX( context, offsetof( INT21_HEAP, misc_dpb_list[drive].media_ID ) );
-    return 1;
+    return TRUE;
 }
 
 /***********************************************************************
@@ -3800,7 +3801,7 @@ static const WCHAR *INT21_FindPath; /* will point to current dta->fullPath searc
 /******************************************************************
  *		INT21_FindFirst
  */
-static int INT21_FindFirst( CONTEXT *context )
+static BOOL INT21_FindFirst( CONTEXT *context )
 {
     WCHAR *p, *q;
     const char *path;
@@ -3829,7 +3830,7 @@ static int INT21_FindFirst( CONTEXT *context )
         SetLastError( ERROR_FILE_NOT_FOUND );
         SET_AX( context, ERROR_FILE_NOT_FOUND );
         SET_CFLAG(context);
-        return 0;
+        return FALSE;
     }
     WideCharToMultiByte(CP_OEMCP, 0, maskW, 12, dta->mask, sizeof(dta->mask), NULL, NULL);
 
@@ -3842,7 +3843,7 @@ static int INT21_FindFirst( CONTEXT *context )
     dta->drive = toupperW(dta->fullPath[0]) - 'A';
     dta->count = 0;
     dta->search_attr = CL_reg(context);
-    return 1;
+    return TRUE;
 }
 
 /******************************************************************
@@ -3930,14 +3931,14 @@ static unsigned INT21_FindHelper(LPCWSTR fullPath, unsigned drive, unsigned coun
 /******************************************************************
  *		INT21_FindNext
  */
-static int INT21_FindNext( CONTEXT *context )
+static BOOL INT21_FindNext( CONTEXT *context )
 {
     FINDFILE_DTA *dta = (FINDFILE_DTA *)INT21_GetCurrentDTA(context);
     DWORD attr = dta->search_attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
     WIN32_FIND_DATAW entry;
     int n;
 
-    if (!dta->fullPath) return 0;
+    if (!dta->fullPath) return FALSE;
 
     n = INT21_FindHelper(dta->fullPath, dta->drive, dta->count, 
                          dta->mask, attr, &entry);
@@ -3962,11 +3963,11 @@ static int INT21_FindNext( CONTEXT *context )
             INT21_FindPath = dta->fullPath = NULL;
         }
         dta->count = n;
-        return 1;
+        return TRUE;
     }
     HeapFree( GetProcessHeap(), 0, dta->fullPath );
     INT21_FindPath = dta->fullPath = NULL;
-    return 0;
+    return FALSE;
 }
 
 /* microsoft's programmers should be shot for using CP/M style int21
@@ -3976,7 +3977,7 @@ static int INT21_FindNext( CONTEXT *context )
  *		INT21_FindFirstFCB
  *
  */
-static int INT21_FindFirstFCB( CONTEXT *context )
+static BOOL INT21_FindFirstFCB( CONTEXT *context )
 {
     BYTE *fcb = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
     FINDFILE_FCB *pFCB;
@@ -3986,21 +3987,21 @@ static int INT21_FindFirstFCB( CONTEXT *context )
     if (*fcb == 0xff) pFCB = (FINDFILE_FCB *)(fcb + 7);
     else pFCB = (FINDFILE_FCB *)fcb;
     drive = INT21_MapDrive( pFCB->drive );
-    if (drive == MAX_DOS_DRIVES) return 0;
+    if (drive == MAX_DOS_DRIVES) return FALSE;
 
     p[0] = 'A' + drive;
     pFCB->fullPath = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
-    if (!pFCB->fullPath) return 0;
+    if (!pFCB->fullPath) return FALSE;
     GetLongPathNameW(p, pFCB->fullPath, MAX_PATH);
     pFCB->count = 0;
-    return 1;
+    return TRUE;
 }
 
 /******************************************************************
  *		INT21_FindNextFCB
  *
  */
-static int INT21_FindNextFCB( CONTEXT *context )
+static BOOL INT21_FindNextFCB( CONTEXT *context )
 {
     BYTE *fcb = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
     FINDFILE_FCB *pFCB;
@@ -4022,14 +4023,14 @@ static int INT21_FindNextFCB( CONTEXT *context )
         pFCB = (FINDFILE_FCB *)fcb;
     }
 
-    if (!pFCB->fullPath) return 0;
+    if (!pFCB->fullPath) return FALSE;
     n = INT21_FindHelper(pFCB->fullPath, INT21_MapDrive( pFCB->drive ),
                          pFCB->count, pFCB->filename, attr, &entry);
     if (!n)
     {
         HeapFree( GetProcessHeap(), 0, pFCB->fullPath );
         INT21_FindPath = pFCB->fullPath = NULL;
-        return 0;
+        return FALSE;
     }
     pFCB->count += n;
 
@@ -4055,7 +4056,7 @@ static int INT21_FindNextFCB( CONTEXT *context )
     else
         INT21_ToDosFCBFormat( entry.cFileName, nameW );
     WideCharToMultiByte(CP_OEMCP, 0, nameW, 11, ddl->filename, 11, NULL, NULL);
-    return 1;
+    return TRUE;
 }
 
 




More information about the wine-cvs mailing list