diff --git a/sim_BuildROMs.c b/sim_BuildROMs.c index 8a3e6982..cebf2dfb 100644 --- a/sim_BuildROMs.c +++ b/sim_BuildROMs.c @@ -108,7 +108,7 @@ if ((expected_checksum != 0) && (checksum != expected_checksum)) { * If the target include file already exists, determine if it contains the exact * data in the base ROM image. If so, then we are already done */ -if (iFile = fopen (include_filename, "r")) { +if (NULL != (iFile = fopen (include_filename, "r"))) { unsigned char *IncludeData = NULL; char line[256]; int Difference = 0; diff --git a/sim_disk.c b/sim_disk.c index 01613e53..a711a272 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -2550,13 +2550,13 @@ static FILE *sim_vhd_disk_open (const char *szVHDPath, const char *DesiredAccess if (!hVHD) return (FILE *)hVHD; - if (Status = GetVHDFooter (szVHDPath, - &hVHD->Footer, - &hVHD->Dynamic, - &hVHD->BAT, - NULL, - hVHD->ParentVHDPath, - sizeof (hVHD->ParentVHDPath))) + if (0 != (Status = GetVHDFooter (szVHDPath, + &hVHD->Footer, + &hVHD->Dynamic, + &hVHD->BAT, + NULL, + hVHD->ParentVHDPath, + sizeof (hVHD->ParentVHDPath)))) goto Cleanup_Return; if (NtoHl (hVHD->Footer.DiskType) == VHD_DT_Differencing) { hVHD->Parent = (VHDHANDLE)sim_vhd_disk_open (hVHD->ParentVHDPath, "rb"); @@ -2702,7 +2702,7 @@ if (SizeInBytes > ((uint64)(1024*1024*1024))*2040) { Status = EFBIG; goto Cleanup_Return; } -if (File = sim_fopen (szVHDPath, "rb")) { +if (NULL != (File = sim_fopen (szVHDPath, "rb"))) { fclose (File); File = NULL; Status = EEXIST; @@ -2877,13 +2877,13 @@ char *FullVHDPath = NULL; size_t i, RelativeMatch, UpDirectories, LocatorsWritten = 0; int64 LocatorPosition; -if (Status = GetVHDFooter (szParentVHDPath, - &ParentFooter, - &ParentDynamic, - NULL, - &ParentTimeStamp, - NULL, - 0)) +if (0 != (Status = GetVHDFooter (szParentVHDPath, + &ParentFooter, + &ParentDynamic, + NULL, + &ParentTimeStamp, + NULL, + 0))) goto Cleanup_Return; hVHD = CreateVirtualDisk (szVHDPath, (uint32)(NtoHll(ParentFooter.CurrentSize)/BytesPerSector), diff --git a/sim_ether.c b/sim_ether.c index 26641932..90d3bcd7 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -664,7 +664,7 @@ void eth_zero(ETH_DEV* dev) } static ETH_DEV **eth_open_devices = NULL; -static eth_open_device_count = 0; +static int eth_open_device_count = 0; static void _eth_add_to_open_list (ETH_DEV* dev) { @@ -1394,7 +1394,7 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, char *devname) for (i=0; patterns[i] && (0 == dev->have_host_nic_phy_addr); ++i) { snprintf(command, sizeof(command)-1, "ifconfig %s | %s >NIC.hwaddr", devname, patterns[i]); system(command); - if (f = fopen("NIC.hwaddr", "r")) { + if (NULL != (f = fopen("NIC.hwaddr", "r"))) { while (0 == dev->have_host_nic_phy_addr) { if (fgets(command, sizeof(command)-1, f)) { char *p1, *p2; @@ -1580,7 +1580,7 @@ sim_debug(dev->dbit, dev->dptr, "Writer Thread Starting\n"); pthread_mutex_lock (&dev->writer_lock); while (dev->handle) { pthread_cond_wait (&dev->writer_cond, &dev->writer_lock); - while (request = dev->write_requests) { + while (NULL != (request = dev->write_requests)) { /* Pull buffer off request list */ dev->write_requests = request->next; pthread_mutex_unlock (&dev->writer_lock); @@ -1889,11 +1889,11 @@ pthread_mutex_destroy (&dev->writer_lock); pthread_cond_destroy (&dev->writer_cond); if (1) { struct write_request *buffer; - while (buffer = dev->write_buffers) { + while (NULL != (buffer = dev->write_buffers)) { dev->write_buffers = buffer->next; free(buffer); } - while (buffer = dev->write_requests) { + while (NULL != (buffer = dev->write_requests)) { dev->write_requests = buffer->next; free(buffer); } @@ -2146,10 +2146,10 @@ if (!dev) return SCPE_UNATT; /* Get a buffer */ pthread_mutex_lock (&dev->writer_lock); -if (request = dev->write_buffers) +if (NULL != (request = dev->write_buffers)) dev->write_buffers = request->next; pthread_mutex_unlock (&dev->writer_lock); -if (!request) +if (NULL == request) request = malloc(sizeof(*request)); /* Copy buffer contents */ diff --git a/sim_tape.c b/sim_tape.c index c6cbe410..2a28e133 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -761,7 +761,7 @@ t_stat st; sim_debug (ctx->dbit, ctx->dptr, "sim_tape_rdrecf(unit=%d, buf=%p, max=%d)\n", uptr-ctx->dptr->units, buf, max); opos = uptr->pos; /* old position */ -if (st = sim_tape_rdlntf (uptr, &tbc)) /* read rec lnt */ +if (MTSE_OK != (st = sim_tape_rdlntf (uptr, &tbc))) /* read rec lnt */ return st; *bc = rbc = MTR_L (tbc); /* strip error flag */ if (rbc > max) { /* rec out of range? */ @@ -823,7 +823,7 @@ t_stat st; sim_debug (ctx->dbit, ctx->dptr, "sim_tape_rdrecr(unit=%d, buf=%p, max=%d)\n", uptr-ctx->dptr->units, buf, max); -if (st = sim_tape_rdlntr (uptr, &tbc)) /* read rec lnt */ +if (MTSE_OK != (st = sim_tape_rdlntr (uptr, &tbc))) /* read rec lnt */ return st; *bc = rbc = MTR_L (tbc); /* strip error flag */ if (rbc > max) /* rec out of range? */