From 7f1943588762227438aec2c66436edc44b2097c4 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 27 Oct 2013 15:13:19 +0000 Subject: [PATCH] Fixed some gcc 4.8.1 warnings --- bochs/gui/rfb.cc | 8 ++++---- bochs/gui/sdl.cc | 2 +- bochs/gui/vncsrv.cc | 4 ++-- bochs/gui/win32paramdlg.cc | 4 ++-- bochs/iodev/display/vgacore.cc | 2 +- bochs/iodev/hdimage/cdrom_win32.cc | 5 ++--- bochs/iodev/sound/es1370.cc | 4 ++-- bochs/iodev/sound/sb16.cc | 6 +++--- bochs/iodev/usb/usb_xhci.cc | 2 +- bochs/iodev/usb/usb_xhci.h | 2 +- 10 files changed, 19 insertions(+), 20 deletions(-) diff --git a/bochs/gui/rfb.cc b/bochs/gui/rfb.cc index d369ba90a..d101d791f 100644 --- a/bochs/gui/rfb.cc +++ b/bochs/gui/rfb.cc @@ -162,8 +162,8 @@ static char rfbPalette[256]; static unsigned rfbWindowX, rfbWindowY; static unsigned rfbDimensionX, rfbDimensionY; static long rfbHeaderbarY; -static long rfbTileX = 0; -static long rfbTileY = 0; +static unsigned rfbTileX = 0; +static unsigned rfbTileY = 0; static unsigned long rfbCursorX = 0; static unsigned long rfbCursorY = 0; static unsigned long rfbOriginLeft = 0; @@ -1290,10 +1290,10 @@ void UpdateScreen(unsigned char *newBits, int x, int y, int width, int height, int i, x0, y0; x0 = x; y0 = y; - if ((x + width - 1) >= rfbWindowX) { + if ((unsigned)(x + width - 1) >= rfbWindowX) { width = rfbWindowX - x + 1; } - if ((y + height - 1) >= rfbWindowY) { + if ((unsigned)(y + height - 1) >= rfbWindowY) { height = rfbWindowY - y + 1; } for (i = 0; i < height; i++) { diff --git a/bochs/gui/sdl.cc b/bochs/gui/sdl.cc index aa16c0a23..99a309b64 100644 --- a/bochs/gui/sdl.cc +++ b/bochs/gui/sdl.cc @@ -1048,7 +1048,7 @@ void bx_sdl_gui_c::handle_events(void) new_mousebuttons &= 0x07; // send motion information if (sdl_mouse_mode_absxy) { - if ((new_mousey >= headerbar_height) && (new_mousey < (res_y + headerbar_height))) { + if ((new_mousey >= headerbar_height) && (new_mousey < (int)(res_y + headerbar_height))) { dx = new_mousex * 0x7fff / res_x; dy = (new_mousey - headerbar_height) * 0x7fff / res_y; DEV_mouse_motion(dx, dy, wheel_status, new_mousebuttons, 1); diff --git a/bochs/gui/vncsrv.cc b/bochs/gui/vncsrv.cc index b66b379f4..21d89f6fd 100644 --- a/bochs/gui/vncsrv.cc +++ b/bochs/gui/vncsrv.cc @@ -979,10 +979,10 @@ void UpdateScreen(rfbPixel *newBits, int x, int y, int width, int height) int i, x0, y0; x0 = x; y0 = y; - if ((x + width - 1) >= rfbWindowX) { + if ((unsigned)(x + width - 1) >= rfbWindowX) { width = rfbWindowX - x + 1; } - if ((y + height - 1) >= rfbWindowY) { + if ((unsigned)(y + height - 1) >= rfbWindowY) { height = rfbWindowY - y + 1; } for (i = 0; i < height; i++) { diff --git a/bochs/gui/win32paramdlg.cc b/bochs/gui/win32paramdlg.cc index 7dacc5f59..0bd3b8bfa 100644 --- a/bochs/gui/win32paramdlg.cc +++ b/bochs/gui/win32paramdlg.cc @@ -999,7 +999,7 @@ static INT_PTR CALLBACK ParamDlgProc(HWND Window, UINT AMessage, WPARAM wParam, EndDialog(Window, 1); break; default: - if ((code >= ID_BROWSE) && (code < (int)(ID_BROWSE + nextDlgID))) { + if ((code >= ID_BROWSE) && (code < (ID_BROWSE + nextDlgID))) { i = (UINT)(code - ID_BROWSE); sparam = (bx_param_string_c *)findParamFromDlgID(i); if (sparam != NULL) { @@ -1010,7 +1010,7 @@ static INT_PTR CALLBACK ParamDlgProc(HWND Window, UINT AMessage, WPARAM wParam, SetFocus(GetDlgItem(Window, ID_PARAM + i)); } } - } else if ((code >= ID_PARAM) && (code < (int)(ID_PARAM + nextDlgID))) { + } else if ((code >= ID_PARAM) && (code < (ID_PARAM + nextDlgID))) { i = (UINT)(code - ID_PARAM); param = findParamFromDlgID(i); if (param != NULL) { diff --git a/bochs/iodev/display/vgacore.cc b/bochs/iodev/display/vgacore.cc index c2dc69db2..287336484 100644 --- a/bochs/iodev/display/vgacore.cc +++ b/bochs/iodev/display/vgacore.cc @@ -399,7 +399,7 @@ void bx_vgacore_c::determine_screen_dimensions(unsigned *piHeight, unsigned *piW { int ai[0x20]; int i,h,v; - for (i = 0 ; i < 0x20 ; i++) + for (i = 0 ; i < 0x19 ; i++) ai[i] = BX_VGA_THIS s.CRTC.reg[i]; h = (ai[1] + 1) * 8; diff --git a/bochs/iodev/hdimage/cdrom_win32.cc b/bochs/iodev/hdimage/cdrom_win32.cc index 6eebbdea8..d6f28d88a 100644 --- a/bochs/iodev/hdimage/cdrom_win32.cc +++ b/bochs/iodev/hdimage/cdrom_win32.cc @@ -48,7 +48,6 @@ extern "C" { static BOOL isWindowsXP; static BOOL isOldWindows; -static UINT cdromCount = 0; #define BX_CD_FRAMESIZE 2048 #define CD_FRAMESIZE 2048 @@ -230,7 +229,7 @@ bx_bool cdrom_interface::read_toc(Bit8u* buf, int* length, bx_bool msf, int star // We have to allocate a chunk of memory to make sure it is aligned on a sector base. UCHAR *data = (UCHAR *) VirtualAlloc(NULL, 2048*2, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); - unsigned long iBytesReturned; + DWORD iBytesReturned; DeviceIoControl(hFile, IOCTL_CDROM_READ_TOC_EX, &input, sizeof(input), data, 804, &iBytesReturned, NULL); // now copy it to the users buffer and free our buffer *length = data[1] + (data[0] << 8) + 2; @@ -298,7 +297,7 @@ bx_bool BX_CPP_AttrRegparmN(3) cdrom_interface::read_block(Bit8u* buf, Bit32u lb if ((pos.LowPart == 0xffffffff) && (GetLastError() != NO_ERROR)) { BX_PANIC(("cdrom: read_block: SetFilePointer returned error.")); } else { - ReadFile(hFile, (void *) buf1, BX_CD_FRAMESIZE, (unsigned long *) &n, NULL); + ReadFile(hFile, (void *) buf1, BX_CD_FRAMESIZE, (LPDWORD) &n, NULL); } } } while ((n != BX_CD_FRAMESIZE) && (--try_count > 0)); diff --git a/bochs/iodev/sound/es1370.cc b/bochs/iodev/sound/es1370.cc index 3b817dfcc..7e373c67a 100644 --- a/bochs/iodev/sound/es1370.cc +++ b/bochs/iodev/sound/es1370.cc @@ -767,8 +767,8 @@ void bx_es1370_c::sendwavepacket(unsigned channel, Bit32u buflen, Bit8u *buffer) } bits = (format >> 1) ? 16 : 8; Bit8u temparray[12] = - { samplerate & 0xff, samplerate >> 8, 0, 0, - bits, (format & 1) + 1, 0, 0, 0, 0, 0, 0 }; + { (Bit8u)(samplerate & 0xff), (Bit8u)(samplerate >> 8), 0, 0, + bits, (Bit8u)((format & 1) + 1), 0, 0, 0, 0, 0, 0 }; if (bits == 16) temparray[6] = 4; diff --git a/bochs/iodev/sound/sb16.cc b/bochs/iodev/sound/sb16.cc index ef58c8563..e364e3bf9 100644 --- a/bochs/iodev/sound/sb16.cc +++ b/bochs/iodev/sound/sb16.cc @@ -970,7 +970,7 @@ void bx_sb16_c::dsp_datawrite(Bit32u value) // only handled for VOC output so far if (BX_SB16_THIS wavemode == 2) { - Bit8u temparray[3] = { length & 0xff, length >> 8, DSP.dma.timeconstant >> 8 }; + Bit8u temparray[3] = { (Bit8u)(length & 0xff), (Bit8u)(length >> 8), (Bit8u)(DSP.dma.timeconstant >> 8) }; DEV_soundmod_VOC_write_block(WAVEDATA, 3, 3, temparray, 0, NULL); } break; @@ -1425,8 +1425,8 @@ void bx_sb16_c::dsp_sendwavepacket() break; case 2: Bit8u temparray[12] = - { DSP.dma.samplerate & 0xff, DSP.dma.samplerate >> 8, 0, 0, - DSP.dma.bits, DSP.dma.stereo + 1, 0, 0, 0, 0, 0, 0 }; + { (Bit8u)(DSP.dma.samplerate & 0xff), (Bit8u)(DSP.dma.samplerate >> 8), 0, 0, + (Bit8u)DSP.dma.bits, (Bit8u)(DSP.dma.stereo + 1), 0, 0, 0, 0, 0, 0 }; switch ((DSP.dma.format >> 1) & 7) { case 2: diff --git a/bochs/iodev/usb/usb_xhci.cc b/bochs/iodev/usb/usb_xhci.cc index b1bae4cf6..170afc112 100644 --- a/bochs/iodev/usb/usb_xhci.cc +++ b/bochs/iodev/usb/usb_xhci.cc @@ -329,7 +329,7 @@ void bx_usb_xhci_c::reset_hc() BX_XHCI_THIS hub.op_regs.HcStatus.hch = 1; // Page Size - BX_XHCI_THIS hub.op_regs.HcPageSize.pagesize = PAGE_SIZE; + BX_XHCI_THIS hub.op_regs.HcPageSize.pagesize = XHCI_PAGE_SIZE; // Device Notification Control Register BX_XHCI_THIS hub.op_regs.HcNotification.RsvdP = 0; diff --git a/bochs/iodev/usb/usb_xhci.h b/bochs/iodev/usb/usb_xhci.h index f797181d9..8b27742d4 100644 --- a/bochs/iodev/usb/usb_xhci.h +++ b/bochs/iodev/usb/usb_xhci.h @@ -76,7 +76,7 @@ #define EXT_CAPS_OFFSET 0x500 #define EXT_CAPS_SIZE 48 -#define PAGE_SIZE 1 // Page size operational register value +#define XHCI_PAGE_SIZE 1 // Page size operational register value #define PORT_SET_OFFSET (0x400 + OPS_REGS_OFFSET) #define RUNTIME_OFFSET 0x600