Commit b9e82a5946d902af445a53727c69b4851b1b20ff

Authored by blueswir1
1 parent 1625af87

Fix some win32 compile warnings

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
block-raw-win32.c
@@ -166,7 +166,7 @@ static void raw_close(BlockDriverState *bs) @@ -166,7 +166,7 @@ static void raw_close(BlockDriverState *bs)
166 static int raw_truncate(BlockDriverState *bs, int64_t offset) 166 static int raw_truncate(BlockDriverState *bs, int64_t offset)
167 { 167 {
168 BDRVRawState *s = bs->opaque; 168 BDRVRawState *s = bs->opaque;
169 - DWORD low, high; 169 + LONG low, high;
170 170
171 low = offset; 171 low = offset;
172 high = offset >> 32; 172 high = offset >> 32;
@@ -188,7 +188,7 @@ static int64_t raw_getlength(BlockDriverState *bs) @@ -188,7 +188,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
188 188
189 switch(s->type) { 189 switch(s->type) {
190 case FTYPE_FILE: 190 case FTYPE_FILE:
191 - l.LowPart = GetFileSize(s->hfile, &l.HighPart); 191 + l.LowPart = GetFileSize(s->hfile, (PDWORD)&l.HighPart);
192 if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) 192 if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
193 return -EIO; 193 return -EIO;
194 break; 194 break;
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 */ 19 */
20 #include "config.h" 20 #include "config.h"
21 #ifdef _WIN32 21 #ifdef _WIN32
22 -#define WIN32_LEAN_AND_MEAN  
23 #include <windows.h> 22 #include <windows.h>
24 #else 23 #else
25 #include <sys/types.h> 24 #include <sys/types.h>
@@ -579,7 +579,7 @@ int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset, @@ -579,7 +579,7 @@ int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset,
579 if ((request.from + request.len) > size) { 579 if ((request.from + request.len) > size) {
580 LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64 580 LOG("From: %" PRIu64 ", Len: %u, Size: %" PRIu64
581 ", Offset: %" PRIu64 "\n", 581 ", Offset: %" PRIu64 "\n",
582 - request.from, request.len, size, dev_offset); 582 + request.from, request.len, (uint64_t)size, dev_offset);
583 LOG("requested operation past EOF--bad client?"); 583 LOG("requested operation past EOF--bad client?");
584 errno = EINVAL; 584 errno = EINVAL;
585 return -1; 585 return -1;
@@ -1903,9 +1903,9 @@ done: @@ -1903,9 +1903,9 @@ done:
1903 1903
1904 void net_cleanup(void) 1904 void net_cleanup(void)
1905 { 1905 {
  1906 +#if !defined(_WIN32)
1906 VLANState *vlan; 1907 VLANState *vlan;
1907 1908
1908 -#if !defined(_WIN32)  
1909 /* close network clients */ 1909 /* close network clients */
1910 for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) { 1910 for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
1911 VLANClientState *vc; 1911 VLANClientState *vc;
slirp/misc.c
@@ -777,7 +777,11 @@ void @@ -777,7 +777,11 @@ void
777 fd_nonblock(int fd) 777 fd_nonblock(int fd)
778 { 778 {
779 #ifdef FIONBIO 779 #ifdef FIONBIO
780 - int opt = 1; 780 +#ifdef _WIN32
  781 + long opt = 1;
  782 +#else
  783 + int opt = 1;
  784 +#endif
781 785
782 ioctlsocket(fd, FIONBIO, &opt); 786 ioctlsocket(fd, FIONBIO, &opt);
783 #else 787 #else
slirp/socket.h
@@ -87,6 +87,7 @@ void soisfconnecting _P((register struct socket *)); @@ -87,6 +87,7 @@ void soisfconnecting _P((register struct socket *));
87 void soisfconnected _P((register struct socket *)); 87 void soisfconnected _P((register struct socket *));
88 void soisfdisconnected _P((struct socket *)); 88 void soisfdisconnected _P((struct socket *));
89 void sofwdrain _P((struct socket *)); 89 void sofwdrain _P((struct socket *));
  90 +struct iovec; /* For win32 */
90 size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np); 91 size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
91 int soreadbuf(struct socket *so, const char *buf, int size); 92 int soreadbuf(struct socket *so, const char *buf, int size);
92 93
tap-win32.c
@@ -254,7 +254,7 @@ static int is_tap_win32_dev(const char *guid) @@ -254,7 +254,7 @@ static int is_tap_win32_dev(const char *guid)
254 component_id_string, 254 component_id_string,
255 NULL, 255 NULL,
256 &data_type, 256 &data_type,
257 - component_id, 257 + (LPBYTE)component_id,
258 &len); 258 &len);
259 259
260 if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) { 260 if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) {
@@ -264,7 +264,7 @@ static int is_tap_win32_dev(const char *guid) @@ -264,7 +264,7 @@ static int is_tap_win32_dev(const char *guid)
264 net_cfg_instance_id_string, 264 net_cfg_instance_id_string,
265 NULL, 265 NULL,
266 &data_type, 266 &data_type,
267 - net_cfg_instance_id, 267 + (LPBYTE)net_cfg_instance_id,
268 &len); 268 &len);
269 269
270 if (status == ERROR_SUCCESS && data_type == REG_SZ) { 270 if (status == ERROR_SUCCESS && data_type == REG_SZ) {
@@ -353,7 +353,7 @@ static int get_device_guid( @@ -353,7 +353,7 @@ static int get_device_guid(
353 name_string, 353 name_string,
354 NULL, 354 NULL,
355 &name_type, 355 &name_type,
356 - name_data, 356 + (LPBYTE)name_data,
357 &len); 357 &len);
358 358
359 if (status != ERROR_SUCCESS || name_type != REG_SZ) { 359 if (status != ERROR_SUCCESS || name_type != REG_SZ) {
@@ -560,7 +560,7 @@ static int tap_win32_read(tap_win32_overlapped_t *overlapped, @@ -560,7 +560,7 @@ static int tap_win32_read(tap_win32_overlapped_t *overlapped,
560 } 560 }
561 561
562 static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, 562 static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped,
563 - char* pbuf) 563 + uint8_t *pbuf)
564 { 564 {
565 tun_buffer_t* buffer = (tun_buffer_t*)pbuf; 565 tun_buffer_t* buffer = (tun_buffer_t*)pbuf;
566 put_buffer_on_free_list(overlapped, buffer); 566 put_buffer_on_free_list(overlapped, buffer);
@@ -580,7 +580,7 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle, @@ -580,7 +580,7 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle,
580 unsigned long minor; 580 unsigned long minor;
581 unsigned long debug; 581 unsigned long debug;
582 } version; 582 } version;
583 - LONG version_len; 583 + DWORD version_len;
584 DWORD idThread; 584 DWORD idThread;
585 HANDLE hThread; 585 HANDLE hThread;
586 586
@@ -245,7 +245,9 @@ int no_reboot = 0; @@ -245,7 +245,9 @@ int no_reboot = 0;
245 int no_shutdown = 0; 245 int no_shutdown = 0;
246 int cursor_hide = 1; 246 int cursor_hide = 1;
247 int graphic_rotate = 0; 247 int graphic_rotate = 0;
  248 +#ifndef _WIN32
248 int daemonize = 0; 249 int daemonize = 0;
  250 +#endif
249 const char *option_rom[MAX_OPTION_ROMS]; 251 const char *option_rom[MAX_OPTION_ROMS];
250 int nb_option_roms; 252 int nb_option_roms;
251 int semihosting_enabled = 0; 253 int semihosting_enabled = 0;
@@ -1297,8 +1299,9 @@ static int timer_load(QEMUFile *f, void *opaque, int version_id) @@ -1297,8 +1299,9 @@ static int timer_load(QEMUFile *f, void *opaque, int version_id)
1297 } 1299 }
1298 1300
1299 #ifdef _WIN32 1301 #ifdef _WIN32
1300 -void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,  
1301 - DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) 1302 +static void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
  1303 + DWORD_PTR dwUser, DWORD_PTR dw1,
  1304 + DWORD_PTR dw2)
1302 #else 1305 #else
1303 static void host_alarm_handler(int host_signum) 1306 static void host_alarm_handler(int host_signum)
1304 #endif 1307 #endif
@@ -4262,14 +4265,18 @@ int main(int argc, char **argv, char **envp) @@ -4262,14 +4265,18 @@ int main(int argc, char **argv, char **envp)
4262 const char *cpu_model; 4265 const char *cpu_model;
4263 const char *usb_devices[MAX_USB_CMDLINE]; 4266 const char *usb_devices[MAX_USB_CMDLINE];
4264 int usb_devices_index; 4267 int usb_devices_index;
  4268 +#ifndef _WIN32
4265 int fds[2]; 4269 int fds[2];
  4270 +#endif
4266 int tb_size; 4271 int tb_size;
4267 const char *pid_file = NULL; 4272 const char *pid_file = NULL;
4268 const char *incoming = NULL; 4273 const char *incoming = NULL;
  4274 +#ifndef _WIN32
4269 int fd = 0; 4275 int fd = 0;
4270 struct passwd *pwd = NULL; 4276 struct passwd *pwd = NULL;
4271 const char *chroot_dir = NULL; 4277 const char *chroot_dir = NULL;
4272 const char *run_as = NULL; 4278 const char *run_as = NULL;
  4279 +#endif
4273 4280
4274 qemu_cache_utils_init(envp); 4281 qemu_cache_utils_init(envp);
4275 4282
@@ -5015,7 +5022,6 @@ int main(int argc, char **argv, char **envp) @@ -5015,7 +5022,6 @@ int main(int argc, char **argv, char **envp)
5015 signal(SIGTTOU, SIG_IGN); 5022 signal(SIGTTOU, SIG_IGN);
5016 signal(SIGTTIN, SIG_IGN); 5023 signal(SIGTTIN, SIG_IGN);
5017 } 5024 }
5018 -#endif  
5019 5025
5020 if (pid_file && qemu_create_pidfile(pid_file) != 0) { 5026 if (pid_file && qemu_create_pidfile(pid_file) != 0) {
5021 if (daemonize) { 5027 if (daemonize) {
@@ -5025,6 +5031,7 @@ int main(int argc, char **argv, char **envp) @@ -5025,6 +5031,7 @@ int main(int argc, char **argv, char **envp)
5025 fprintf(stderr, "Could not acquire pid file\n"); 5031 fprintf(stderr, "Could not acquire pid file\n");
5026 exit(1); 5032 exit(1);
5027 } 5033 }
  5034 +#endif
5028 5035
5029 #ifdef USE_KQEMU 5036 #ifdef USE_KQEMU
5030 if (smp_cpus > 1) 5037 if (smp_cpus > 1)
@@ -5385,6 +5392,7 @@ int main(int argc, char **argv, char **envp) @@ -5385,6 +5392,7 @@ int main(int argc, char **argv, char **envp)
5385 if (autostart) 5392 if (autostart)
5386 vm_start(); 5393 vm_start();
5387 5394
  5395 +#ifndef _WIN32
5388 if (daemonize) { 5396 if (daemonize) {
5389 uint8_t status = 0; 5397 uint8_t status = 0;
5390 ssize_t len; 5398 ssize_t len;
@@ -5403,7 +5411,6 @@ int main(int argc, char **argv, char **envp) @@ -5403,7 +5411,6 @@ int main(int argc, char **argv, char **envp)
5403 exit(1); 5411 exit(1);
5404 } 5412 }
5405 5413
5406 -#ifndef _WIN32  
5407 if (run_as) { 5414 if (run_as) {
5408 pwd = getpwnam(run_as); 5415 pwd = getpwnam(run_as);
5409 if (!pwd) { 5416 if (!pwd) {
@@ -5434,7 +5441,6 @@ int main(int argc, char **argv, char **envp) @@ -5434,7 +5441,6 @@ int main(int argc, char **argv, char **envp)
5434 exit(1); 5441 exit(1);
5435 } 5442 }
5436 } 5443 }
5437 -#endif  
5438 5444
5439 if (daemonize) { 5445 if (daemonize) {
5440 dup2(fd, 0); 5446 dup2(fd, 0);
@@ -5443,6 +5449,7 @@ int main(int argc, char **argv, char **envp) @@ -5443,6 +5449,7 @@ int main(int argc, char **argv, char **envp)
5443 5449
5444 close(fd); 5450 close(fd);
5445 } 5451 }
  5452 +#endif
5446 5453
5447 main_loop(); 5454 main_loop();
5448 quit_timers(); 5455 quit_timers();