From 5c3e457b16e10eab18bfd34a8558fb8c398470dc Mon Sep 17 00:00:00 2001 From: Jesper Skov Date: Sun, 1 Nov 1998 19:27:22 +0000 Subject: [PATCH] egcs 'ambiguous else' warnings fixes. --- files/file.c | 2 ++ graphics/x11drv/xfont.c | 4 ++++ memory/heap.c | 2 ++ misc/commdlg.c | 2 ++ misc/shell.c | 2 ++ misc/winsock.c | 8 ++++++++ miscemu/instr.c | 2 ++ multimedia/audio.c | 4 ++++ multimedia/joystick.c | 4 +++- objects/bitmap.c | 2 ++ objects/clipping.c | 2 ++ objects/color.c | 2 ++ objects/cursoricon.c | 8 ++++++++ objects/dib.c | 4 ++++ tools/wrc/dumpres.c | 4 +++- tools/wrc/parser.l | 2 ++ windows/clipboard.c | 6 ++++++ windows/mdi.c | 2 ++ windows/message.c | 2 ++ windows/nonclient.c | 2 ++ windows/painting.c | 2 ++ windows/winhelp.c | 2 ++ windows/winpos.c | 4 ++++ 23 files changed, 72 insertions(+), 2 deletions(-) diff --git a/files/file.c b/files/file.c index 451c3573362..78daca888b6 100644 --- a/files/file.c +++ b/files/file.c @@ -1811,6 +1811,7 @@ BOOL32 WINAPI MoveFileEx32A( LPCSTR fn1, LPCSTR fn2, DWORD flag ) if (!DOSFS_GetFullName( fn2, FALSE, &full_name2 )) return FALSE; /* Source name and target path are valid */ if ( full_name1.drive != full_name2.drive) + { /* use copy, if allowed */ if (!(flag & MOVEFILE_COPY_ALLOWED)) { /* FIXME: Use right error code */ @@ -1818,6 +1819,7 @@ BOOL32 WINAPI MoveFileEx32A( LPCSTR fn1, LPCSTR fn2, DWORD flag ) return FALSE; } else mode =1; + } if (DOSFS_GetFullName( fn2, TRUE, &full_name2 )) /* target exists, check if we may overwrite */ if (!(flag & MOVEFILE_REPLACE_EXISTING)) { diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index ac860227fdf..e4a43ff5913 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -453,11 +453,13 @@ static BOOL32 LFD_ComposeLFD( fontObject* fo, else h = (fo->fi->lfd_height * height) / fo->fi->df.dfPixHeight; if( XTextCaps & TC_SF_X_YINDEP ) + { if( fo->lf.lfWidth && !(fo->fo_flags & FO_SYNTH_WIDTH) ) point = (fo->fi->lfd_decipoints * fo->lf.lfWidth) / fo->fi->df.dfAvgWidth; else if( fo->fi->fi_flags & FI_SCALABLE ) /* adjust h/w ratio */ point = h * 72 * 10 / fo->fi->lfd_resolution; + } /* handle rotated fonts */ if (fo->lf.lfEscapement) { @@ -2242,10 +2244,12 @@ BOOL32 X11DRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf, else for( ; pfr ; pfr = pfr->next ) if(pfr->fi) + { if( (b = (*proc)( (LPENUMLOGFONT16)&lf, &tm, XFONT_GetFontMetric( pfr->fi, &lf, &tm ), lp )) ) bRet = b; else break; + } return bRet; } diff --git a/memory/heap.c b/memory/heap.c index 5a0f7adc2a1..b73d1d05969 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -1435,10 +1435,12 @@ HANDLE32 WINAPI Local32Init( WORD segment, DWORD tableSize, /* Determine new heap size */ if ( segment ) + { if ( (segSize = GetSelectorLimit( segment )) == 0 ) return 0; else segSize++; + } if ( heapSize == -1L ) heapSize = 1024L*1024L; /* FIXME */ diff --git a/misc/commdlg.c b/misc/commdlg.c index b269e1ff69f..d6198d172cd 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -425,11 +425,13 @@ static LONG FILEDLG_WMDrawItem(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam,int s (LPARAM)SEGPTR_GET(str)); if (savedlg) /* use _gray_ text in FileSaveDlg */ + { if (!lpdis->itemState) SetTextColor32(lpdis->hDC,GetSysColor32(COLOR_GRAYTEXT) ); else SetTextColor32(lpdis->hDC,GetSysColor32(COLOR_WINDOWTEXT) ); /* inversion of gray would be bad readable */ + } TextOut16(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, str, strlen(str)); diff --git a/misc/shell.c b/misc/shell.c index 9659d69a82e..9c927f2352b 100644 --- a/misc/shell.c +++ b/misc/shell.c @@ -667,6 +667,7 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance, /* load resources and create icons */ if( (pIconStorage && pIconDir) || lpiID ) + { if( nIconIndex == (UINT16)-1 ) RetPtr[0] = iconDirCount; else if( nIconIndex < iconDirCount ) { @@ -705,6 +706,7 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance, RetPtr[icon-nIconIndex] = 0; } } + } if( lpiID ) HeapFree( GetProcessHeap(), 0, lpiID); else HeapFree( GetProcessHeap(), 0, pData); } diff --git a/misc/winsock.c b/misc/winsock.c index 0fb8a1abd8b..dbf45ef1c2c 100644 --- a/misc/winsock.c +++ b/misc/winsock.c @@ -500,9 +500,11 @@ void WINAPI WSASetLastError16(INT16 iError) int _check_ws(LPWSINFO pwsi, ws_socket* pws) { if( pwsi ) + { if( pwsi->flags & WSI_BLOCKINGCALL ) pwsi->err = WSAEINPROGRESS; else if( WSI_CHECK_RANGE(pwsi, pws) ) return 1; else pwsi->err = WSAENOTSOCK; + } return 0; } @@ -611,8 +613,11 @@ INT32 WINAPI WINSOCK_bind32(SOCKET32 s, struct sockaddr *name, INT32 namelen) #endif if ( _check_ws(pwsi, pws) ) + { if ( namelen >= sizeof(*name) ) + { if ( ((struct ws_sockaddr_in *)name)->sin_family == AF_INET ) + { if ( bind(pws->fd, name, namelen) < 0 ) { int loc_errno = errno; @@ -626,8 +631,11 @@ INT32 WINAPI WINSOCK_bind32(SOCKET32 s, struct sockaddr *name, INT32 namelen) } } else return 0; /* success */ + } else pwsi->err = WSAEAFNOSUPPORT; + } else pwsi->err = WSAEFAULT; + } return SOCKET_ERROR; } diff --git a/miscemu/instr.c b/miscemu/instr.c index b9acd30ae84..3ace37d0255 100644 --- a/miscemu/instr.c +++ b/miscemu/instr.c @@ -472,10 +472,12 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context ) (void)0; if (repX) + { if (long_addr) ECX_sig(context) = 0; else CX_sig(context) = 0; + } while (count-- > 0) { diff --git a/multimedia/audio.c b/multimedia/audio.c index 64cf6aee4f6..2ca9955661d 100644 --- a/multimedia/audio.c +++ b/multimedia/audio.c @@ -1228,10 +1228,12 @@ DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, /* FIXME: For now, only one sound device (SOUND_DEV) is allowed */ audio = open (SOUND_DEV, O_WRONLY, 0); if (audio == -1) + { if (errno == EBUSY) return 1; else return 0; + } close (audio); return 1; case WODM_GETPITCH: @@ -1685,10 +1687,12 @@ DWORD WINAPI widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, /* FIXME: For now, only one sound device (SOUND_DEV) is allowed */ audio = open (SOUND_DEV, O_RDONLY, 0); if (audio == -1) + { if (errno == EBUSY) return 1; else return 0; + } close (audio); return 1; case WIDM_GETPOS: diff --git a/multimedia/joystick.c b/multimedia/joystick.c index 102f13af634..2cb7aa48a70 100644 --- a/multimedia/joystick.c +++ b/multimedia/joystick.c @@ -83,7 +83,8 @@ void joySendMessages(void) struct js_status js; if (joy_nr_open) - for (joy=0; joy < MAXJOYDRIVERS; joy++) + { + for (joy=0; joy < MAXJOYDRIVERS; joy++) if (joy_dev[joy] >= 0) { if (count_use[joy] > 250) { joyCloseDriver(joy); @@ -92,6 +93,7 @@ void joySendMessages(void) count_use[joy]++; } else return; + } if (joyCaptured == FALSE) return; TRACE(mmsys, " --\n"); diff --git a/objects/bitmap.c b/objects/bitmap.c index c08193bf9d0..27dd4f51120 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -465,6 +465,7 @@ HANDLE32 WINAPI LoadImage32W( HINSTANCE32 hinst, LPCWSTR name, UINT32 type, ); } if (loadflags & LR_DEFAULTSIZE) + { if (type == IMAGE_ICON) { if (!desiredx) desiredx = SYSMETRICS_CXICON; if (!desiredy) desiredy = SYSMETRICS_CYICON; @@ -472,6 +473,7 @@ HANDLE32 WINAPI LoadImage32W( HINSTANCE32 hinst, LPCWSTR name, UINT32 type, if (!desiredx) desiredx = SYSMETRICS_CXCURSOR; if (!desiredy) desiredy = SYSMETRICS_CYCURSOR; } + } if (loadflags & LR_LOADFROMFILE) loadflags &= ~LR_SHARED; switch (type) { case IMAGE_BITMAP: diff --git a/objects/clipping.c b/objects/clipping.c index e4597c5cec1..add52eebb40 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -491,6 +491,7 @@ INT32 WINAPI GetClipRgn32( HDC32 hdc, HRGN32 hRgn ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if( dc && hRgn ) + { if( dc->w.hClipRgn ) { /* this assumes that dc->w.hClipRgn is in coordinates @@ -503,6 +504,7 @@ INT32 WINAPI GetClipRgn32( HDC32 hdc, HRGN32 hRgn ) } } else return 0; + } return -1; } diff --git a/objects/color.c b/objects/color.c index 65fdcccb1a6..d7f4604617a 100644 --- a/objects/color.c +++ b/objects/color.c @@ -795,12 +795,14 @@ COLORREF COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size, COLORREF (palPalEntry + COLOR_PaletteLookupPixel(palPalEntry,size,NULL,color,FALSE)); else if( spec_type == 1 ) /* PALETTEINDEX */ + { if( (i = color & 0x0000ffff) >= size ) { WARN(palette, "RGB(%lx) : idx %d is out of bounds, assuming NULL\n", color, i); color = *(COLORREF*)palPalEntry; } else color = *(COLORREF*)(palPalEntry + i); + } color &= 0x00ffffff; return (0x00ffffff & *(COLORREF*) diff --git a/objects/cursoricon.c b/objects/cursoricon.c index 57e07386594..47ba56c0b1a 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -1774,15 +1774,19 @@ BOOL32 WINAPI DrawIconEx32( HDC32 hdc, INT32 x0, INT32 y0, HICON32 hIcon, /* Calculate the size of the destination image. */ if (cxWidth == 0) + { if (flags & DI_DEFAULTSIZE) cxWidth = GetSystemMetrics32 (SM_CXICON); else cxWidth = ptr->nWidth; + } if (cyWidth == 0) + { if (flags & DI_DEFAULTSIZE) cyWidth = GetSystemMetrics32 (SM_CYICON); else cyWidth = ptr->nHeight; + } if (!(DoOffscreen = (hbr >= STOCK_WHITE_BRUSH) && (hbr <= STOCK_HOLLOW_BRUSH))) @@ -1828,20 +1832,24 @@ BOOL32 WINAPI DrawIconEx32( HDC32 hdc, INT32 x0, INT32 y0, HICON32 hIcon, { HBITMAP32 hBitTemp = SelectObject32( hMemDC, hAndBits ); if (flags & DI_MASK) + { if (DoOffscreen) StretchBlt32 (hDC_off, 0, 0, cxWidth, cyWidth, hMemDC, 0, 0, ptr->nWidth, ptr->nHeight, SRCAND); else StretchBlt32 (hdc, x0, y0, cxWidth, cyWidth, hMemDC, 0, 0, ptr->nWidth, ptr->nHeight, SRCAND); + } SelectObject32( hMemDC, hXorBits ); if (flags & DI_IMAGE) + { if (DoOffscreen) StretchBlt32 (hDC_off, 0, 0, cxWidth, cyWidth, hMemDC, 0, 0, ptr->nWidth, ptr->nHeight, SRCPAINT); else StretchBlt32 (hdc, x0, y0, cxWidth, cyWidth, hMemDC, 0, 0, ptr->nWidth, ptr->nHeight, SRCPAINT); + } SelectObject32( hMemDC, hBitTemp ); result = TRUE; } diff --git a/objects/dib.c b/objects/dib.c index 372a44fc03b..65dd28fba73 100644 --- a/objects/dib.c +++ b/objects/dib.c @@ -2090,10 +2090,12 @@ HBITMAP32 WINAPI CreateDIBSection32 (HDC32 hdc, BITMAPINFO *bmi, UINT32 usage, if (!res || !bmp || !dib || !bm.bmBits || (bm.bmBitsPixel <= 8 && !colorMap)) { if (bm.bmBits) + { if (section) UnmapViewOfFile(bm.bmBits), bm.bmBits = NULL; else VirtualFree(bm.bmBits, MEM_RELEASE, 0L), bm.bmBits = NULL; + } if (dib->image) XDestroyImage(dib->image), dib->image = NULL; if (colorMap) HeapFree(GetProcessHeap(), 0, colorMap), colorMap = NULL; @@ -2125,10 +2127,12 @@ void DIB_DeleteDIBSection( BITMAPOBJ *bmp ) DIBSECTIONOBJ *dib = bmp->dib; if (dib->dibSection.dsBm.bmBits) + { if (dib->dibSection.dshSection) UnmapViewOfFile(dib->dibSection.dsBm.bmBits); else VirtualFree(dib->dibSection.dsBm.bmBits, MEM_RELEASE, 0L); + } if (dib->image) XDestroyImage( dib->image ); diff --git a/tools/wrc/dumpres.c b/tools/wrc/dumpres.c index 33c09f4b765..6814a3b53e4 100644 --- a/tools/wrc/dumpres.c +++ b/tools/wrc/dumpres.c @@ -224,7 +224,8 @@ void dump_raw_data(raw_data_t *d) for(n = 0; n < d->size; n++) { - if((n % 16) == 0) + if((n % 16) == 0) + { if(n) { printf("- "); @@ -234,6 +235,7 @@ void dump_raw_data(raw_data_t *d) } else printf("%08x: ", n); + } printf("%02x ", d->data[n] & 0xff); } printf("- "); diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l index ddb7a970b36..bc11b4e7558 100644 --- a/tools/wrc/parser.l +++ b/tools/wrc/parser.l @@ -791,10 +791,12 @@ L\" { <> { YY_BUFFER_STATE b = YY_CURRENT_BUFFER; if(!pop_buffer()) + { if(YY_START == pp_strips || YY_START == pp_stripp || YY_START == pp_stripp_final) yyerror("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline); else yyterminate(); + } yy_delete_buffer(b); } %% diff --git a/windows/clipboard.c b/windows/clipboard.c index 0ccdf826e82..e8fa56a1276 100644 --- a/windows/clipboard.c +++ b/windows/clipboard.c @@ -537,6 +537,7 @@ HANDLE32 WINAPI SetClipboardData32( UINT32 wFormat, HANDLE32 hData ) static BOOL32 CLIPBOARD_RenderFormat(LPCLIPFORMAT lpFormat) { if( lpFormat->wDataPresent && !lpFormat->hData16 && !lpFormat->hData32 ) + { if( IsWindow32(hWndClipOwner) ) SendMessage16(hWndClipOwner,WM_RENDERFORMAT, (WPARAM16)lpFormat->wFormatID,0L); @@ -547,6 +548,7 @@ static BOOL32 CLIPBOARD_RenderFormat(LPCLIPFORMAT lpFormat) hWndClipOwner = 0; lpFormat->wDataPresent = 0; return FALSE; } + } return (lpFormat->hData16 || lpFormat->hData32) ? TRUE : FALSE; } @@ -812,10 +814,12 @@ UINT32 WINAPI EnumClipboardFormats32( UINT32 wFormat ) && !selectionAcquired) CLIPBOARD_RequestXSelection(); if (wFormat == 0) + { if (lpFormat->wDataPresent || ClipFormats[CF_OEMTEXT-1].wDataPresent) return lpFormat->wFormatID; else wFormat = lpFormat->wFormatID; /* and CF_TEXT is not available */ + } /* walk up to the specified format record */ @@ -1183,6 +1187,7 @@ void CLIPBOARD_ReleaseSelection(Window w, HWND32 hwnd) (unsigned)w, (unsigned)selectionWindow, (unsigned)selectionPrevWindow ); if( selectionAcquired ) + { if( w == selectionWindow || selectionPrevWindow == None) { /* alright, we really lost it */ @@ -1198,6 +1203,7 @@ void CLIPBOARD_ReleaseSelection(Window w, HWND32 hwnd) if( w == None ) TSXSetSelectionOwner(display, XA_PRIMARY, selectionWindow, CurrentTime); } + } selectionPrevWindow = None; } diff --git a/windows/mdi.c b/windows/mdi.c index 94b6e5ee80b..09f462f1fa4 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -552,6 +552,7 @@ static LONG MDI_ChildActivate( WND *clientPtr, HWND32 hWndChild ) /* set appearance */ if( clientInfo->hwndChildMaximized ) + { if( clientInfo->hwndChildMaximized != hWndChild ) if( hWndChild ) { @@ -560,6 +561,7 @@ static LONG MDI_ChildActivate( WND *clientPtr, HWND32 hWndChild ) } else ShowWindow32( clientInfo->hwndActiveChild, SW_SHOWNORMAL ); + } clientInfo->hwndActiveChild = hWndChild; diff --git a/windows/message.c b/windows/message.c index c42d49b0e0e..7df8516d08f 100644 --- a/windows/message.c +++ b/windows/message.c @@ -504,6 +504,7 @@ static BOOL32 MSG_PeekHardwareMsg( MSG16 *msg, HWND16 hwnd, DWORD filter, case SYSQ_MSG_SKIP: if (HOOK_IsHooked( WH_CBT )) + { if( kbd_msg ) HOOK_CallHooks16( WH_CBT, HCBT_KEYSKIPPED, msg->wParam, msg->lParam ); @@ -521,6 +522,7 @@ static BOOL32 MSG_PeekHardwareMsg( MSG16 *msg, HWND16 hwnd, DWORD filter, SEGPTR_FREE(hook); } } + } if (remove) QUEUE_RemoveMsg( sysMsgQueue, pos ); diff --git a/windows/nonclient.c b/windows/nonclient.c index 856f59c6915..41efc2fdd07 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -164,10 +164,12 @@ NC_AdjustRectOuter95 (LPRECT16 rect, DWORD style, BOOL32 menu, DWORD exStyle) } if ((style & WS_CAPTION) == WS_CAPTION) + { if (exStyle & WS_EX_TOOLWINDOW) rect->top -= SYSMETRICS_CYSMCAPTION; else rect->top -= SYSMETRICS_CYCAPTION; + } } if (menu) diff --git a/windows/painting.c b/windows/painting.c index 9ddd9f1cdbc..a2dab04b722 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -230,10 +230,12 @@ void WINAPI PaintRect( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush, const RECT16 *rect) { if( hbrush <= CTLCOLOR_MAX ) + { if( hwndParent ) hbrush = PAINT_GetControlBrush( hwndParent, hwnd, hdc, (UINT16)hbrush ); else return; + } if( hbrush ) FillRect16( hdc, rect, hbrush ); } diff --git a/windows/winhelp.c b/windows/winhelp.c index 3a8ea2e2481..0019d0ee82c 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -53,10 +53,12 @@ BOOL32 WINAPI WinHelp32A( HWND32 hWnd, LPCSTR lpHelpFile, UINT32 wCommand, hDest = FindWindow32A( "MS_WINHELP", NULL ); if(!hDest) + { if(wCommand == HELP_QUIT) return TRUE; else return FALSE; + } switch(wCommand) { case HELP_CONTEXT: diff --git a/windows/winpos.c b/windows/winpos.c index a16b009d3b3..bffee99f0ed 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -2188,11 +2188,13 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, } } else if (!(wndPtr->window)) + { /* FIXME: the following optimization is no good for "X-ed" windows */ if (hwndInsertAfter == HWND_TOP) flags |= ( wndPtr->parent->child == wndPtr)? SWP_NOZORDER: 0; else /* HWND_BOTTOM */ flags |= ( wndPtr->next )? 0: SWP_NOZORDER; + } /* Fill the WINDOWPOS structure */ @@ -2320,6 +2322,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, wndPtr->rectClient = newClientRect; if( !(flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW)) ) + { if( (oldClientRect.left - oldWindowRect.left != newClientRect.left - newWindowRect.left) || (oldClientRect.top - oldWindowRect.top != @@ -2362,6 +2365,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, if( !wErase ) /* just update the nonclient area */ wndPtr->flags |= WIN_NEEDS_NCPAINT; } + } uFlags |= SMC_NOPARENTERASE; /* X windows do not have eraseable parents */ } else /* not an X window */