silence some warnings

This commit is contained in:
Alexei Svitkine 2017-04-20 20:44:03 -04:00
parent 79ec72e0cb
commit 14f2e85c6f
2 changed files with 19 additions and 15 deletions

View File

@ -135,7 +135,7 @@ main(int argc, const char *argv[])
{ {
int fd; int fd;
char *addr; char *addr;
off_t file_size; size_t file_size;
struct mach_header *machhead; struct mach_header *machhead;
#if defined(MH_MAGIC_64) #if defined(MH_MAGIC_64)
struct mach_header_64 *machhead64; struct mach_header_64 *machhead64;
@ -155,7 +155,7 @@ main(int argc, const char *argv[])
progname, filename, strerror(errno)); progname, filename, strerror(errno));
exit(1); exit(1);
} }
file_size = f.st_size; file_size = (size_t) f.st_size;
fd = open(filename, O_RDWR, 0); fd = open(filename, O_RDWR, 0);
if (fd == -1) { if (fd == -1) {

View File

@ -1320,8 +1320,9 @@ read_next_de:
get_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0, false); get_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0, false);
WriteMacInt16(pb + ioFlStBlk, 0); WriteMacInt16(pb + ioFlStBlk, 0);
WriteMacInt32(pb + ioFlLgLen, st.st_size); uint32 file_size = (uint32) st.st_size;
WriteMacInt32(pb + ioFlPyLen, (st.st_size | (AL_BLK_SIZE - 1)) + 1); WriteMacInt32(pb + ioFlLgLen, file_size);
WriteMacInt32(pb + ioFlPyLen, (file_size | (AL_BLK_SIZE - 1)) + 1);
WriteMacInt16(pb + ioFlRStBlk, 0); WriteMacInt16(pb + ioFlRStBlk, 0);
uint32 rf_size = get_rfork_size(full_path); uint32 rf_size = get_rfork_size(full_path);
WriteMacInt32(pb + ioFlRLgLen, rf_size); WriteMacInt32(pb + ioFlRLgLen, rf_size);
@ -1476,8 +1477,9 @@ read_next_de:
WriteMacInt16(pb + ioDrNmFls, count); WriteMacInt16(pb + ioDrNmFls, count);
} else { } else {
WriteMacInt16(pb + ioFlStBlk, 0); WriteMacInt16(pb + ioFlStBlk, 0);
WriteMacInt32(pb + ioFlLgLen, st.st_size); uint32 file_size = (uint32) st.st_size;
WriteMacInt32(pb + ioFlPyLen, (st.st_size | (AL_BLK_SIZE - 1)) + 1); WriteMacInt32(pb + ioFlLgLen, file_size);
WriteMacInt32(pb + ioFlPyLen, (file_size | (AL_BLK_SIZE - 1)) + 1);
WriteMacInt16(pb + ioFlRStBlk, 0); WriteMacInt16(pb + ioFlRStBlk, 0);
uint32 rf_size = get_rfork_size(full_path); uint32 rf_size = get_rfork_size(full_path);
WriteMacInt32(pb + ioFlRLgLen, rf_size); WriteMacInt32(pb + ioFlRLgLen, rf_size);
@ -1586,8 +1588,9 @@ static int16 fs_open(uint32 pb, uint32 dirID, uint32 vcb, bool resource_fork)
// Initialize FCB, fd is stored in fcbCatPos // Initialize FCB, fd is stored in fcbCatPos
WriteMacInt32(fcb + fcbFlNm, fs_item->id); WriteMacInt32(fcb + fcbFlNm, fs_item->id);
WriteMacInt8(fcb + fcbFlags, ((flag == O_WRONLY || flag == O_RDWR) ? fcbWriteMask : 0) | (resource_fork ? fcbResourceMask : 0) | (write_ok ? 0 : fcbFileLockedMask)); WriteMacInt8(fcb + fcbFlags, ((flag == O_WRONLY || flag == O_RDWR) ? fcbWriteMask : 0) | (resource_fork ? fcbResourceMask : 0) | (write_ok ? 0 : fcbFileLockedMask));
WriteMacInt32(fcb + fcbEOF, st.st_size); uint32 file_size = (uint32) st.st_size;
WriteMacInt32(fcb + fcbPLen, (st.st_size | (AL_BLK_SIZE - 1)) + 1); WriteMacInt32(fcb + fcbEOF, file_size);
WriteMacInt32(fcb + fcbPLen, (file_size | (AL_BLK_SIZE - 1)) + 1);
WriteMacInt32(fcb + fcbCrPs, 0); WriteMacInt32(fcb + fcbCrPs, 0);
WriteMacInt32(fcb + fcbVPtr, vcb); WriteMacInt32(fcb + fcbVPtr, vcb);
WriteMacInt32(fcb + fcbClmpSize, CLUMP_SIZE); WriteMacInt32(fcb + fcbClmpSize, CLUMP_SIZE);
@ -1707,9 +1710,10 @@ static int16 fs_get_eof(uint32 pb)
return errno2oserr(); return errno2oserr();
// Adjust FCBs // Adjust FCBs
WriteMacInt32(fcb + fcbEOF, st.st_size); uint32 file_size = (uint32) st.st_size;
WriteMacInt32(fcb + fcbPLen, (st.st_size | (AL_BLK_SIZE - 1)) + 1); WriteMacInt32(fcb + fcbEOF, file_size);
WriteMacInt32(pb + ioMisc, st.st_size); WriteMacInt32(fcb + fcbPLen, (file_size | (AL_BLK_SIZE - 1)) + 1);
WriteMacInt32(pb + ioMisc, file_size);
D(bug(" adjusting FCBs\n")); D(bug(" adjusting FCBs\n"));
r.d[0] = ReadMacInt16(pb + ioRefNum); r.d[0] = ReadMacInt16(pb + ioRefNum);
Execute68k(fs_data + fsAdjustEOF, &r); Execute68k(fs_data + fsAdjustEOF, &r);
@ -1777,7 +1781,7 @@ static int16 fs_get_fpos(uint32 pb)
} }
// Get file position // Get file position
uint32 pos = lseek(fd, 0, SEEK_CUR); uint32 pos = (uint32) lseek(fd, 0, SEEK_CUR);
WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(fcb + fcbCrPs, pos);
WriteMacInt32(pb + ioPosOffset, pos); WriteMacInt32(pb + ioPosOffset, pos);
return noErr; return noErr;
@ -1820,7 +1824,7 @@ static int16 fs_set_fpos(uint32 pb)
default: default:
break; break;
} }
uint32 pos = lseek(fd, 0, SEEK_CUR); uint32 pos = (uint32) lseek(fd, 0, SEEK_CUR);
WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(fcb + fcbCrPs, pos);
WriteMacInt32(pb + ioPosOffset, pos); WriteMacInt32(pb + ioPosOffset, pos);
return noErr; return noErr;
@ -1871,7 +1875,7 @@ static int16 fs_read(uint32 pb)
int16 read_err = errno2oserr(); int16 read_err = errno2oserr();
D(bug(" actual %d\n", actual)); D(bug(" actual %d\n", actual));
WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0); WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0);
uint32 pos = lseek(fd, 0, SEEK_CUR); uint32 pos = (uint32) lseek(fd, 0, SEEK_CUR);
WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(fcb + fcbCrPs, pos);
WriteMacInt32(pb + ioPosOffset, pos); WriteMacInt32(pb + ioPosOffset, pos);
if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount)) if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount))
@ -1925,7 +1929,7 @@ static int16 fs_write(uint32 pb)
int16 write_err = errno2oserr(); int16 write_err = errno2oserr();
D(bug(" actual %d\n", actual)); D(bug(" actual %d\n", actual));
WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0); WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0);
uint32 pos = lseek(fd, 0, SEEK_CUR); uint32 pos = (uint32) lseek(fd, 0, SEEK_CUR);
WriteMacInt32(fcb + fcbCrPs, pos); WriteMacInt32(fcb + fcbCrPs, pos);
WriteMacInt32(pb + ioPosOffset, pos); WriteMacInt32(pb + ioPosOffset, pos);
if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount)) if (actual != (ssize_t)ReadMacInt32(pb + ioReqCount))