Fix some win32 compile warnings

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2009-04-05 18:03:31 +00:00
parent 1625af873a
commit b9e82a5946
8 changed files with 27 additions and 16 deletions

View File

@ -166,7 +166,7 @@ static void raw_close(BlockDriverState *bs)
static int raw_truncate(BlockDriverState *bs, int64_t offset) static int raw_truncate(BlockDriverState *bs, int64_t offset)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
DWORD low, high; LONG low, high;
low = offset; low = offset;
high = offset >> 32; high = offset >> 32;
@ -188,7 +188,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
switch(s->type) { switch(s->type) {
case FTYPE_FILE: case FTYPE_FILE:
l.LowPart = GetFileSize(s->hfile, &l.HighPart); l.LowPart = GetFileSize(s->hfile, (PDWORD)&l.HighPart);
if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
return -EIO; return -EIO;
break; break;

1
exec.c
View File

@ -19,7 +19,6 @@
*/ */
#include "config.h" #include "config.h"
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#else #else
#include <sys/types.h> #include <sys/types.h>

2
nbd.c
View File

@ -579,7 +579,7 @@ int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset,
if ((request.from + request.len) > size) { if ((request.from + request.len) > size) {
LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64 LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
", Offset: %" PRIu64 "\n", ", 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?"); LOG("requested operation past EOF--bad client?");
errno = EINVAL; errno = EINVAL;
return -1; return -1;

2
net.c
View File

@ -1903,9 +1903,9 @@ done:
void net_cleanup(void) void net_cleanup(void)
{ {
#if !defined(_WIN32)
VLANState *vlan; VLANState *vlan;
#if !defined(_WIN32)
/* close network clients */ /* close network clients */
for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) { for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
VLANClientState *vc; VLANClientState *vc;

View File

@ -777,7 +777,11 @@ void
fd_nonblock(int fd) fd_nonblock(int fd)
{ {
#ifdef FIONBIO #ifdef FIONBIO
int opt = 1; #ifdef _WIN32
long opt = 1;
#else
int opt = 1;
#endif
ioctlsocket(fd, FIONBIO, &opt); ioctlsocket(fd, FIONBIO, &opt);
#else #else

View File

@ -87,6 +87,7 @@ void soisfconnecting _P((register struct socket *));
void soisfconnected _P((register struct socket *)); void soisfconnected _P((register struct socket *));
void soisfdisconnected _P((struct socket *)); void soisfdisconnected _P((struct socket *));
void sofwdrain _P((struct socket *)); void sofwdrain _P((struct socket *));
struct iovec; /* For win32 */
size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np); size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
int soreadbuf(struct socket *so, const char *buf, int size); int soreadbuf(struct socket *so, const char *buf, int size);

View File

@ -254,7 +254,7 @@ static int is_tap_win32_dev(const char *guid)
component_id_string, component_id_string,
NULL, NULL,
&data_type, &data_type,
component_id, (LPBYTE)component_id,
&len); &len);
if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) { if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) {
@ -264,7 +264,7 @@ static int is_tap_win32_dev(const char *guid)
net_cfg_instance_id_string, net_cfg_instance_id_string,
NULL, NULL,
&data_type, &data_type,
net_cfg_instance_id, (LPBYTE)net_cfg_instance_id,
&len); &len);
if (status == ERROR_SUCCESS && data_type == REG_SZ) { if (status == ERROR_SUCCESS && data_type == REG_SZ) {
@ -353,7 +353,7 @@ static int get_device_guid(
name_string, name_string,
NULL, NULL,
&name_type, &name_type,
name_data, (LPBYTE)name_data,
&len); &len);
if (status != ERROR_SUCCESS || name_type != REG_SZ) { if (status != ERROR_SUCCESS || name_type != REG_SZ) {
@ -560,7 +560,7 @@ static int tap_win32_read(tap_win32_overlapped_t *overlapped,
} }
static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped,
char* pbuf) uint8_t *pbuf)
{ {
tun_buffer_t* buffer = (tun_buffer_t*)pbuf; tun_buffer_t* buffer = (tun_buffer_t*)pbuf;
put_buffer_on_free_list(overlapped, buffer); put_buffer_on_free_list(overlapped, buffer);
@ -580,7 +580,7 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle,
unsigned long minor; unsigned long minor;
unsigned long debug; unsigned long debug;
} version; } version;
LONG version_len; DWORD version_len;
DWORD idThread; DWORD idThread;
HANDLE hThread; HANDLE hThread;

17
vl.c
View File

@ -245,7 +245,9 @@ int no_reboot = 0;
int no_shutdown = 0; int no_shutdown = 0;
int cursor_hide = 1; int cursor_hide = 1;
int graphic_rotate = 0; int graphic_rotate = 0;
#ifndef _WIN32
int daemonize = 0; int daemonize = 0;
#endif
const char *option_rom[MAX_OPTION_ROMS]; const char *option_rom[MAX_OPTION_ROMS];
int nb_option_roms; int nb_option_roms;
int semihosting_enabled = 0; int semihosting_enabled = 0;
@ -1297,8 +1299,9 @@ static int timer_load(QEMUFile *f, void *opaque, int version_id)
} }
#ifdef _WIN32 #ifdef _WIN32
void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg, static void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DWORD_PTR dwUser, DWORD_PTR dw1,
DWORD_PTR dw2)
#else #else
static void host_alarm_handler(int host_signum) static void host_alarm_handler(int host_signum)
#endif #endif
@ -4262,14 +4265,18 @@ int main(int argc, char **argv, char **envp)
const char *cpu_model; const char *cpu_model;
const char *usb_devices[MAX_USB_CMDLINE]; const char *usb_devices[MAX_USB_CMDLINE];
int usb_devices_index; int usb_devices_index;
#ifndef _WIN32
int fds[2]; int fds[2];
#endif
int tb_size; int tb_size;
const char *pid_file = NULL; const char *pid_file = NULL;
const char *incoming = NULL; const char *incoming = NULL;
#ifndef _WIN32
int fd = 0; int fd = 0;
struct passwd *pwd = NULL; struct passwd *pwd = NULL;
const char *chroot_dir = NULL; const char *chroot_dir = NULL;
const char *run_as = NULL; const char *run_as = NULL;
#endif
qemu_cache_utils_init(envp); qemu_cache_utils_init(envp);
@ -5015,7 +5022,6 @@ int main(int argc, char **argv, char **envp)
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
} }
#endif
if (pid_file && qemu_create_pidfile(pid_file) != 0) { if (pid_file && qemu_create_pidfile(pid_file) != 0) {
if (daemonize) { if (daemonize) {
@ -5025,6 +5031,7 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "Could not acquire pid file\n"); fprintf(stderr, "Could not acquire pid file\n");
exit(1); exit(1);
} }
#endif
#ifdef USE_KQEMU #ifdef USE_KQEMU
if (smp_cpus > 1) if (smp_cpus > 1)
@ -5385,6 +5392,7 @@ int main(int argc, char **argv, char **envp)
if (autostart) if (autostart)
vm_start(); vm_start();
#ifndef _WIN32
if (daemonize) { if (daemonize) {
uint8_t status = 0; uint8_t status = 0;
ssize_t len; ssize_t len;
@ -5403,7 +5411,6 @@ int main(int argc, char **argv, char **envp)
exit(1); exit(1);
} }
#ifndef _WIN32
if (run_as) { if (run_as) {
pwd = getpwnam(run_as); pwd = getpwnam(run_as);
if (!pwd) { if (!pwd) {
@ -5434,7 +5441,6 @@ int main(int argc, char **argv, char **envp)
exit(1); exit(1);
} }
} }
#endif
if (daemonize) { if (daemonize) {
dup2(fd, 0); dup2(fd, 0);
@ -5443,6 +5449,7 @@ int main(int argc, char **argv, char **envp)
close(fd); close(fd);
} }
#endif
main_loop(); main_loop();
quit_timers(); quit_timers();