From 2b0acc301a36340ed472b52bbd82fd838ccbce7e Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 29 Mar 2017 08:19:17 -0700 Subject: [PATCH] DISK: Ignore potential cleanup errors and avoid sign extension byte swapping --- sim_disk.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sim_disk.c b/sim_disk.c index fc667459..49c18b2e 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1379,7 +1379,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop if (!copy_buf) { sim_vhd_disk_close(vhd); - remove (gbuf); + (void)remove (gbuf); return SCPE_MEM; } for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) { @@ -1411,7 +1411,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop if (!verify_buf) { sim_vhd_disk_close(vhd); - remove (gbuf); + (void)remove (gbuf); free (copy_buf); return SCPE_MEM; } @@ -1623,7 +1623,7 @@ if ((created) && (!copied)) { free (secbuf); if (r != SCPE_OK) { sim_disk_detach (uptr); /* report error now */ - remove (cptr); /* remove the create file */ + (void)remove (cptr); /* remove the created file */ return SCPE_OPENERR; } if (sim_switches & SWMASK ('I')) { /* Initialize To Sector Address */ @@ -1636,7 +1636,7 @@ if ((created) && (!copied)) { if (!init_buf) { sim_disk_detach (uptr); /* report error now */ - remove (cptr); + (void)remove (cptr); return SCPE_MEM; } for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) { @@ -1652,7 +1652,7 @@ if ((created) && (!copied)) { if (r != SCPE_OK) { free (init_buf); sim_disk_detach (uptr); /* report error now */ - remove (cptr); /* remove the create file */ + (void)remove (cptr); /* remove the created file */ return SCPE_OPENERR; } if (!sim_quiet) @@ -3169,15 +3169,15 @@ static uint32 NtoHl(uint32 value) { uint8 *l = (uint8 *)&value; -return l[3] | (l[2]<<8) | (l[1]<<16) | (l[0]<<24); +return (uint32)l[3] | ((uint32)l[2]<<8) | ((uint32)l[1]<<16) | ((uint32)l[0]<<24); } static uint64 NtoHll(uint64 value) { uint8 *l = (uint8 *)&value; -uint64 highresult = l[3] | (l[2]<<8) | (l[1]<<16) | (l[0]<<24); -uint32 lowresult = l[7] | (l[6]<<8) | (l[5]<<16) | (l[4]<<24); +uint64 highresult = (uint64)l[3] | ((uint64)l[2]<<8) | ((uint64)l[1]<<16) | ((uint64)l[0]<<24); +uint32 lowresult = (uint64)l[7] | ((uint64)l[6]<<8) | ((uint64)l[5]<<16) | ((uint64)l[4]<<24); return (highresult << 32) | lowresult; } #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ @@ -3680,7 +3680,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD) sim_printf ("Merged %dMB. 100%% complete.\n", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000)); fclose (hVHD->File); hVHD->File = NULL; - remove (szVHDPath); + (void)remove (szVHDPath); *ParentVHD = (char*) malloc (strlen (hVHD->ParentVHDPath)+1); strcpy (*ParentVHD, hVHD->ParentVHDPath); } @@ -3958,7 +3958,7 @@ if (File) fclose (File); if (Status) { if (Status != EEXIST) - remove (szVHDPath); + (void)remove (szVHDPath); } else { hVHD = (VHDHANDLE)sim_vhd_disk_open (szVHDPath, "rb+"); @@ -4225,7 +4225,7 @@ sim_vhd_disk_close ((FILE *)hVHD); hVHD = NULL; if (Status) { if ((EEXIST != Status) && (ENOENT != Status)) - remove (szVHDPath); + (void)remove (szVHDPath); } else { hVHD = (VHDHANDLE)sim_vhd_disk_open (szVHDPath, "rb+");