[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Fix some compiler warnings for windows
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH] Fix some compiler warnings for windows |
Date: |
Fri, 13 Feb 2009 22:26:07 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Hello,
this patch fixes some warnings for compilation with mingw32.
Regards
Stefan Weil
fix some compiler warnings for mingw32:
* fix data types for win32 api (block-raw-win32.c, tap-win32.c)
* add missing include (bt-host.c)
* fix symbol redefinition (hw/bt-sdp.c, hw/openpic.c)
* add casts where needed (nbd.c)
* add forward declaration (slirp/socket.h)
* remove some includes which are also included in qemu-common.h
and include qemu-common.h before other include files
(exec.c, kqemu.c, slirp/tftp.c)
* remove unsupported daemonize option for windows
and add missing static for host_alarm_handler (vl.c)
Signed-off-by: Stefan Weil <address@hidden>
Index: trunk/block-raw-win32.c
===================================================================
--- trunk.orig/block-raw-win32.c 2009-02-13 21:06:15.000000000 +0100
+++ trunk/block-raw-win32.c 2009-02-13 21:13:39.000000000 +0100
@@ -279,7 +279,7 @@
static int raw_truncate(BlockDriverState *bs, int64_t offset)
{
BDRVRawState *s = bs->opaque;
- DWORD low, high;
+ LONG low, high;
low = offset;
high = offset >> 32;
@@ -301,7 +301,8 @@
switch(s->type) {
case FTYPE_FILE:
- l.LowPart = GetFileSize(s->hfile, &l.HighPart);
+ l.LowPart = GetFileSize(s->hfile, &count);
+ l.HighPart = count;
if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
return -EIO;
break;
Index: trunk/bt-host.c
===================================================================
--- trunk.orig/bt-host.c 2009-02-13 21:17:29.000000000 +0100
+++ trunk/bt-host.c 2009-02-13 21:17:44.000000000 +0100
@@ -197,6 +197,7 @@
return &s->hci;
}
#else
+# include "hw/bt.h"
struct HCIInfo *bt_host_hci(const char *id)
{
fprintf(stderr, "qemu: bluetooth passthrough not supported (yet)\n");
Index: trunk/hw/bt-sdp.c
===================================================================
--- trunk.orig/hw/bt-sdp.c 2009-02-13 21:20:17.000000000 +0100
+++ trunk/hw/bt-sdp.c 2009-02-13 21:20:58.000000000 +0100
@@ -787,10 +787,12 @@
.type = SDP_DTYPE_UUID | SDP_DSIZE_16, \
.value.uint = val, \
},
+#undef TRUE
#define TRUE { \
.type = SDP_DTYPE_BOOL | SDP_DSIZE_1, \
.value.uint = 1, \
},
+#undef FALSE
#define FALSE { \
.type = SDP_DTYPE_BOOL | SDP_DSIZE_1, \
.value.uint = 0, \
Index: trunk/nbd.c
===================================================================
--- trunk.orig/nbd.c 2009-02-13 21:06:37.000000000 +0100
+++ trunk/nbd.c 2009-02-13 21:16:39.000000000 +0100
@@ -169,7 +169,7 @@
memcpy(&addr.sin_addr.s_addr, &in, sizeof(in));
opt = 1;
- if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) {
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt,
sizeof(opt)) == -1) {
goto error;
}
@@ -579,7 +579,7 @@
if ((request.from + request.len) > size) {
LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
", Offset: %" PRIu64 "\n",
- request.from, request.len, size, dev_offset);
+ request.from, request.len, (uint64_t)size, dev_offset);
LOG("requested operation past EOF--bad client?");
errno = EINVAL;
return -1;
Index: trunk/slirp/socket.h
===================================================================
--- trunk.orig/slirp/socket.h 2009-02-13 21:27:36.000000000 +0100
+++ trunk/slirp/socket.h 2009-02-13 21:28:00.000000000 +0100
@@ -13,6 +13,8 @@
#define SO_EXPIRE 240000
#define SO_EXPIREFAST 10000
+struct iovec;
+
/*
* Our socket structure
*/
Index: trunk/tap-win32.c
===================================================================
--- trunk.orig/tap-win32.c 2009-02-13 21:21:30.000000000 +0100
+++ trunk/tap-win32.c 2009-02-13 21:25:35.000000000 +0100
@@ -214,9 +214,9 @@
char unit_string[256];
HKEY unit_key;
char component_id_string[] = "ComponentId";
- char component_id[256];
+ BYTE component_id[256];
char net_cfg_instance_id_string[] = "NetCfgInstanceId";
- char net_cfg_instance_id[256];
+ BYTE net_cfg_instance_id[256];
DWORD data_type;
len = sizeof (enum_name);
@@ -270,7 +270,7 @@
if (status == ERROR_SUCCESS && data_type == REG_SZ) {
if (/* !strcmp (component_id, TAP_COMPONENT_ID) &&*/
- !strcmp (net_cfg_instance_id, guid)) {
+ !strcmp ((char *)net_cfg_instance_id, guid)) {
RegCloseKey (unit_key);
RegCloseKey (netcard_key);
return TRUE;
@@ -314,7 +314,7 @@
char enum_name[256];
char connection_string[256];
HKEY connection_key;
- char name_data[256];
+ BYTE name_data[256];
DWORD name_type;
const char name_string[] = "Name";
@@ -365,7 +365,7 @@
snprintf(name, name_size, "%s", enum_name);
if (actual_name) {
if (strcmp(actual_name, "") != 0) {
- if (strcmp(name_data, actual_name) != 0) {
+ if (strcmp((char *)name_data, actual_name) != 0) {
RegCloseKey (connection_key);
++i;
continue;
@@ -561,7 +561,7 @@
}
static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped,
- char* pbuf)
+ uint8_t *pbuf)
{
tun_buffer_t* buffer = (tun_buffer_t*)pbuf;
put_buffer_on_free_list(overlapped, buffer);
@@ -581,7 +581,7 @@
unsigned long minor;
unsigned long debug;
} version;
- LONG version_len;
+ DWORD version_len;
DWORD idThread;
HANDLE hThread;
Index: trunk/exec.c
===================================================================
--- trunk.orig/exec.c 2009-02-13 21:37:06.000000000 +0100
+++ trunk/exec.c 2009-02-13 21:40:16.000000000 +0100
@@ -18,24 +18,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
*/
#include "config.h"
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#else
+#include "qemu-common.h"
+#ifndef _WIN32
#include <sys/types.h>
#include <sys/mman.h>
#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
#include "cpu.h"
#include "exec-all.h"
-#include "qemu-common.h"
#include "tcg.h"
#include "hw/hw.h"
#include "osdep.h"
Index: trunk/kqemu.c
===================================================================
--- trunk.orig/kqemu.c 2009-02-13 21:38:12.000000000 +0100
+++ trunk/kqemu.c 2009-02-13 21:40:00.000000000 +0100
@@ -18,9 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
*/
#include "config.h"
+#include "qemu-common.h"
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
#include <winioctl.h>
#else
#include <sys/types.h>
@@ -30,17 +29,9 @@
#ifdef HOST_SOLARIS
#include <sys/ioccom.h>
#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
#include "cpu.h"
#include "exec-all.h"
-#include "qemu-common.h"
#ifdef USE_KQEMU
Index: trunk/slirp/tftp.c
===================================================================
--- trunk.orig/slirp/tftp.c 2009-02-13 21:29:30.000000000 +0100
+++ trunk/slirp/tftp.c 2009-02-13 21:29:33.000000000 +0100
@@ -22,8 +22,8 @@
* THE SOFTWARE.
*/
-#include <slirp.h>
#include "qemu-common.h" // for pstrcpy
+#include <slirp.h>
struct tftp_session {
int in_use;
Index: trunk/vl.c
===================================================================
--- trunk.orig/vl.c 2009-02-13 21:29:52.000000000 +0100
+++ trunk/vl.c 2009-02-13 21:34:31.000000000 +0100
@@ -229,7 +229,9 @@
int no_shutdown = 0;
int cursor_hide = 1;
int graphic_rotate = 0;
+#ifndef _WIN32
int daemonize = 0;
+#endif
const char *option_rom[MAX_OPTION_ROMS];
int nb_option_roms;
int semihosting_enabled = 0;
@@ -1279,8 +1281,9 @@
}
#ifdef _WIN32
-void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
- DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR
dw2)
+static void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
+ DWORD_PTR dwUser,
+ DWORD_PTR dw1, DWORD_PTR dw2)
#else
static void host_alarm_handler(int host_signum)
#endif
@@ -4168,7 +4171,9 @@
QEMU_OPTION_no_reboot,
QEMU_OPTION_no_shutdown,
QEMU_OPTION_loadvm,
+#ifndef _WIN32
QEMU_OPTION_daemonize,
+#endif
QEMU_OPTION_option_rom,
QEMU_OPTION_prom_env,
QEMU_OPTION_clock,
@@ -4291,7 +4296,9 @@
{ "no-reboot", 0, QEMU_OPTION_no_reboot },
{ "no-shutdown", 0, QEMU_OPTION_no_shutdown },
{ "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
+#ifndef _WIN32
{ "daemonize", 0, QEMU_OPTION_daemonize },
+#endif
{ "option-rom", HAS_ARG, QEMU_OPTION_option_rom },
#if defined(TARGET_SPARC) || defined(TARGET_PPC)
{ "prom-env", HAS_ARG, QEMU_OPTION_prom_env },
@@ -4616,7 +4623,9 @@
const char *cpu_model;
const char *usb_devices[MAX_USB_CMDLINE];
int usb_devices_index;
+#ifndef _WIN32
int fds[2];
+#endif
int tb_size;
const char *pid_file = NULL;
int autostart;
@@ -5182,9 +5191,11 @@
exit(1);
}
break;
- case QEMU_OPTION_daemonize:
- daemonize = 1;
- break;
+#ifndef _WIN32
+ case QEMU_OPTION_daemonize:
+ daemonize = 1;
+ break;
+#endif
case QEMU_OPTION_option_rom:
if (nb_option_roms >= MAX_OPTION_ROMS) {
fprintf(stderr, "Too many option ROMs\n");
@@ -5345,7 +5356,6 @@
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
}
-#endif
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
if (daemonize) {
@@ -5355,6 +5365,7 @@
fprintf(stderr, "Could not acquire pid file\n");
exit(1);
}
+#endif
#ifdef USE_KQEMU
if (smp_cpus > 1)
@@ -5722,6 +5733,7 @@
}
}
+#ifndef _WIN32
if (daemonize) {
uint8_t status = 0;
ssize_t len;
@@ -5746,6 +5758,7 @@
close(fd);
}
+#endif
main_loop();
quit_timers();
Index: trunk/hw/openpic.c
===================================================================
--- trunk.orig/hw/openpic.c 2009-02-13 21:57:30.000000000 +0100
+++ trunk/hw/openpic.c 2009-02-13 21:57:35.000000000 +0100
@@ -43,7 +43,6 @@
#else
#define DPRINTF(fmt, args...) do { } while (0)
#endif
-#define ERROR(fmr, args...) do { printf("ERROR: " fmr , ##args); } while (0)
#define USE_MPCxxx /* Intel model is broken, for now */
- [Qemu-devel] [PATCH] Fix some compiler warnings for windows,
Stefan Weil <=