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