From 72d72c92d42a6c668fd6dce6401eced65adcc5b6 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sun, 30 Dec 2007 18:02:22 +0000 Subject: [PATCH] Fixed warnings of VC2008 --- bochs/bx_debug/dbg_main.cc | 4 +-- bochs/disasm/dis_groups.cc | 25 ++++++++++-------- bochs/iodev/eth_null.cc | 54 +++++++++++++++++++------------------- bochs/iodev/pciusb.cc | 4 +-- bochs/logio.cc | 12 ++++----- bochs/memory/misc_mem.cc | 6 ++--- 6 files changed, 54 insertions(+), 51 deletions(-) diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index c40497fd5..fb5052df4 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: dbg_main.cc,v 1.108 2007-12-13 22:56:35 sshwarts Exp $ +// $Id: dbg_main.cc,v 1.109 2007-12-30 18:02:22 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -1070,7 +1070,7 @@ void bx_dbg_xlate_address(bx_lin_address laddr) bx_phy_address paddr; laddr &= BX_CONST64(0xfffffffffffff000); - bx_bool paddr_valid = BX_CPU(which_cpu)->dbg_xlate_linear2phy(laddr, &paddr); + bx_bool paddr_valid = BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(laddr, &paddr); if (paddr_valid) { dbg_printf("linear page 0x" FMT_ADDRX " maps to physical page 0x%08x\n", laddr, paddr); } diff --git a/bochs/disasm/dis_groups.cc b/bochs/disasm/dis_groups.cc index 6efc45221..dc7f10ae2 100644 --- a/bochs/disasm/dis_groups.cc +++ b/bochs/disasm/dis_groups.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: dis_groups.cc,v 1.38 2007-09-19 19:38:10 sshwarts Exp $ +// $Id: dis_groups.cc,v 1.39 2007-12-30 18:02:22 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// #include @@ -588,11 +588,12 @@ void disassembler::Jb(const x86_insn *insn) Bit8s imm8 = (Bit8s) fetch_byte(); if (insn->is_64) { - Bit64u imm64 = (Bit64s) imm8; + Bit64u imm64 = (Bit8s) imm8; dis_sprintf(".+0x%08x%08x", GET32H(imm64), GET32L(imm64)); if (db_base != BX_JUMP_TARGET_NOT_REQ) { - Bit64u target = db_eip + (Bit64s) imm64; target += db_base; + Bit64u target = db_eip + imm64; + target += db_base; dis_sprintf(" (0x%08x%08x)", GET32H(target), GET32L(target)); } @@ -600,20 +601,21 @@ void disassembler::Jb(const x86_insn *insn) } if (insn->os_32) { - Bit32u imm32 = (Bit32s) imm8; + Bit32u imm32 = (Bit8s) imm8; dis_sprintf(".+0x%08x", (unsigned) imm32); if (db_base != BX_JUMP_TARGET_NOT_REQ) { - Bit32u target = db_eip + (Bit32s) imm32; target += db_base; + Bit32u target = (Bit32u)(db_eip + (Bit32s) imm32); + target += db_base; dis_sprintf(" (0x%08x)", target); } } else { - Bit16u imm16 = (Bit16s) imm8; + Bit16u imm16 = (Bit8s) imm8; dis_sprintf(".+0x%04x", (unsigned) imm16); if (db_base != BX_JUMP_TARGET_NOT_REQ) { - Bit16u target = (db_eip + (Bit16s) imm16) & 0xffff; + Bit16u target = (Bit16u)((db_eip + (Bit16s) imm16) & 0xffff); dis_sprintf(" (0x%08x)", target + db_base); } } @@ -638,11 +640,12 @@ void disassembler::Jd(const x86_insn *insn) Bit32s imm32 = (Bit32s) fetch_dword(); if (insn->is_64) { - Bit64u imm64 = (Bit64s) imm32; + Bit64u imm64 = (Bit32s) imm32; dis_sprintf(".+0x%08x%08x", GET32H(imm64), GET32L(imm64)); if (db_base != BX_JUMP_TARGET_NOT_REQ) { - Bit64u target = db_eip + (Bit64s) imm64; target += db_base; + Bit64u target = db_eip + (Bit64s) imm64; + target += db_base; dis_sprintf(" (0x%08x%08x)", GET32H(target), GET32L(target)); } @@ -650,9 +653,9 @@ void disassembler::Jd(const x86_insn *insn) } dis_sprintf(".+0x%08x", (unsigned) imm32); - if (db_base != BX_JUMP_TARGET_NOT_REQ) { - Bit32u target = db_eip + (Bit32s) imm32; target += db_base; + Bit32u target = (Bit32u)(db_eip + (Bit32s) imm32); + target += db_base; dis_sprintf(" (0x%08x)", target); } } diff --git a/bochs/iodev/eth_null.cc b/bochs/iodev/eth_null.cc index a6cc9246d..e45cce801 100644 --- a/bochs/iodev/eth_null.cc +++ b/bochs/iodev/eth_null.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: eth_null.cc,v 1.19 2005-12-10 18:37:35 vruppert Exp $ +// $Id: eth_null.cc,v 1.20 2007-12-30 18:02:22 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -98,17 +98,17 @@ bx_null_pktmover_c::bx_null_pktmover_c(const char *netif, this->rxarg = rxarg; // eventually Bryce wants txlog to dump in pcap format so that // tcpdump -r FILE can read it and interpret packets. - txlog = fopen ("ne2k-tx.log", "wb"); - if (!txlog) BX_PANIC (("open ne2k-tx.log failed")); - txlog_txt = fopen ("ne2k-txdump.txt", "wb"); - if (!txlog_txt) BX_PANIC (("open ne2k-txdump.txt failed")); - fprintf (txlog_txt, "null packetmover readable log file\n"); - fprintf (txlog_txt, "net IF = %s\n", netif); - fprintf (txlog_txt, "MAC address = "); + txlog = fopen("ne2k-tx.log", "wb"); + if (!txlog) BX_PANIC(("open ne2k-tx.log failed")); + txlog_txt = fopen("ne2k-txdump.txt", "wb"); + if (!txlog_txt) BX_PANIC(("open ne2k-txdump.txt failed")); + fprintf(txlog_txt, "null packetmover readable log file\n"); + fprintf(txlog_txt, "net IF = %s\n", netif); + fprintf(txlog_txt, "MAC address = "); for (int i=0; i<6; i++) - fprintf (txlog_txt, "%02x%s", 0xff & macaddr[i], i<5?":" : ""); - fprintf (txlog_txt, "\n--\n"); - fflush (txlog_txt); + fprintf(txlog_txt, "%02x%s", 0xff & macaddr[i], i<5?":" : ""); + fprintf(txlog_txt, "\n--\n"); + fflush(txlog_txt); #endif } @@ -119,20 +119,20 @@ bx_null_pktmover_c::sendpkt(void *buf, unsigned io_len) BX_DEBUG (("sendpkt length %u", io_len)); // dump raw bytes to a file, eventually dump in pcap format so that // tcpdump -r FILE can interpret them for us. - unsigned int n = fwrite (buf, io_len, 1, txlog); - if (n != 1) BX_ERROR (("fwrite to txlog failed, io_len = %u", io_len)); + size_t n = fwrite (buf, io_len, 1, txlog); + if (n != 1) BX_ERROR(("fwrite to txlog failed, io_len = %u", io_len)); // dump packet in hex into an ascii log file - fprintf (txlog_txt, "NE2K transmitting a packet, length %u\n", io_len); + fprintf(txlog_txt, "NE2K transmitting a packet, length %u\n", io_len); Bit8u *charbuf = (Bit8u *)buf; for (n=0; n0) - fprintf (txlog_txt, "\n"); - fprintf (txlog_txt, "%02x ", charbuf[n]); + fprintf(txlog_txt, "\n"); + fprintf(txlog_txt, "%02x ", charbuf[n]); } - fprintf (txlog_txt, "\n--\n"); + fprintf(txlog_txt, "\n--\n"); // flush log so that we see the packets as they arrive w/o buffering - fflush (txlog); - fflush (txlog_txt); + fflush(txlog); + fflush(txlog_txt); #endif } @@ -148,20 +148,20 @@ void bx_null_pktmover_c::rx_timer_handler (void *this_ptr) BX_DEBUG (("receive packet length %u", io_len)); // dump raw bytes to a file, eventually dump in pcap format so that // tcpdump -r FILE can interpret them for us. - int n = fwrite (buf, io_len, 1, class_ptr->rxlog); - if (n != 1) BX_ERROR (("fwrite to rxlog failed, io_len = %u", io_len)); + size_t n = fwrite (buf, io_len, 1, class_ptr->rxlog); + if (n != 1) BX_ERROR(("fwrite to rxlog failed, io_len = %u", io_len)); // dump packet in hex into an ascii log file - fprintf (class_ptr->rxlog_txt, "NE2K transmitting a packet, length %u\n", io_len); + fprintf(class_ptr->rxlog_txt, "NE2K transmitting a packet, length %u\n", io_len); Bit8u *charbuf = (Bit8u *)buf; for (n=0; n0) - fprintf (class_ptr->rxlog_txt, "\n"); - fprintf (class_ptr->rxlog_txt, "%02x ", charbuf[n]); + fprintf(class_ptr->rxlog_txt, "\n"); + fprintf(class_ptr->rxlog_txt, "%02x ", charbuf[n]); } - fprintf (class_ptr->rxlog_txt, "\n--\n"); + fprintf(class_ptr->rxlog_txt, "\n--\n"); // flush log so that we see the packets as they arrive w/o buffering - fflush (class_ptr->rxlog); - fflush (class_ptr->rxlog_txt); + fflush(class_ptr->rxlog); + fflush(class_ptr->rxlog_txt); } #endif } diff --git a/bochs/iodev/pciusb.cc b/bochs/iodev/pciusb.cc index a997eb355..fac72b9be 100644 --- a/bochs/iodev/pciusb.cc +++ b/bochs/iodev/pciusb.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: pciusb.cc,v 1.60 2007-09-28 19:52:03 sshwarts Exp $ +// $Id: pciusb.cc,v 1.61 2007-12-30 18:02:22 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2004 MandrakeSoft S.A. @@ -89,7 +89,7 @@ void usb_dump_packet(Bit8u *data, unsigned size) int set_usb_string(Bit8u *buf, const char *str) { - int len, i; + size_t len, i; Bit8u *q; q = buf; diff --git a/bochs/logio.cc b/bochs/logio.cc index 870712e13..5906a0c65 100644 --- a/bochs/logio.cc +++ b/bochs/logio.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: logio.cc,v 1.62 2007-10-24 23:28:00 sshwarts Exp $ +// $Id: logio.cc,v 1.63 2007-12-30 18:02:22 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -330,8 +330,8 @@ void logfunctions::put(const char *p) prefix = NULL; } - int len=strlen(p); - for(int i=1;i maxwidth) BX_PANIC(("bx_center_print: line is too long: '%s'", line)); - int imax = (maxwidth - len) >> 1; - for (int i=0; i> 1; + for (size_t i=0; i