Removing the warnings after running static code analyser.

-Changes to fix all the clarifyCalulation warnings.
-Fixes a part of issue number 480
This commit is contained in:
kushalsingh007 2015-03-10 01:41:39 +05:30
parent 0b8271a08a
commit 390e030f84
4 changed files with 8 additions and 8 deletions

View File

@ -371,13 +371,13 @@ static void pagefault_handler(uint8_t intr_num, struct x86_pushad *orig_ctx, uns
} }
#endif #endif
else if (error_code & PF_EC_P) { else if (error_code & PF_EC_P) {
printf("Page fault: access violation while %s present page.\n", error_code & PF_EC_W ? "writing to" : "reading from"); printf("Page fault: access violation while %s present page.\n", (error_code & PF_EC_W) ? "writing to" : "reading from");
x86_print_registers(orig_ctx, error_code); x86_print_registers(orig_ctx, error_code);
puts("Halting."); puts("Halting.");
x86_hlt(); x86_hlt();
} }
else { else {
printf("Page fault: access violation while %s non-present page.\n", error_code & PF_EC_W ? "writing to" : "reading from"); printf("Page fault: access violation while %s non-present page.\n", (error_code & PF_EC_W) ? "writing to" : "reading from");
x86_print_registers(orig_ctx, error_code); x86_print_registers(orig_ctx, error_code);
puts("Halting."); puts("Halting.");
x86_hlt(); x86_hlt();

View File

@ -149,7 +149,7 @@ static void pci_setup_ios(struct x86_known_pci_device *dev)
io->bar_num = bar_num; io->bar_num = bar_num;
++dev->io_count; ++dev->io_count;
unsigned addr_offs = tmp_bar & PCI_BAR_IO_SPACE ? PCI_BAR_ADDR_OFFS_IO : PCI_BAR_ADDR_OFFS_MEM; unsigned addr_offs = (tmp_bar & PCI_BAR_IO_SPACE) ? PCI_BAR_ADDR_OFFS_IO : PCI_BAR_ADDR_OFFS_MEM;
uint32_t length_tmp = tmp_bar >> addr_offs; uint32_t length_tmp = tmp_bar >> addr_offs;
uint32_t length = 1 << addr_offs; uint32_t length = 1 << addr_offs;
while ((length_tmp & 1) == 0) { while ((length_tmp & 1) == 0) {

View File

@ -98,10 +98,10 @@ static void rtc_irq_handler(uint8_t irq_num)
(void) irq_num; /* == PIC_NUM_RTC */ (void) irq_num; /* == PIC_NUM_RTC */
uint8_t c = x86_cmos_read(RTC_REG_C); uint8_t c = x86_cmos_read(RTC_REG_C);
DEBUG("RTC: c = 0x%02x, IRQ=%u, A=%u, P=%u, U=%u\n", c, c & RTC_REG_C_IRQ ? 1 : 0, DEBUG("RTC: c = 0x%02x, IRQ=%u, A=%u, P=%u, U=%u\n", c, (c & RTC_REG_C_IRQ) ? 1 : 0,
c & RTC_REG_C_IRQ_ALARM ? 1 : 0, (c & RTC_REG_C_IRQ_ALARM) ? 1 : 0,
c & RTC_REG_C_IRQ_PERIODIC ? 1 : 0, (c & RTC_REG_C_IRQ_PERIODIC) ? 1 : 0,
c & RTC_REG_C_IRQ_UPDATE ? 1 : 0); (c & RTC_REG_C_IRQ_UPDATE) ? 1 : 0);
if (!(c & RTC_REG_C_IRQ)) { if (!(c & RTC_REG_C_IRQ)) {
return; return;
} }

View File

@ -157,7 +157,7 @@ double decode_float_half(unsigned char *halfp)
val = mant == 0 ? INFINITY : NAN; val = mant == 0 ? INFINITY : NAN;
} }
return half & 0x8000 ? -val : val; return (half & 0x8000) ? -val : val;
} }
/** /**