signed/unsigned fixes, and some other fixes

This commit is contained in:
erorcun
2020-12-21 23:26:32 +03:00
parent aefaa17a84
commit a50244dc16
15 changed files with 57 additions and 54 deletions

View File

@@ -240,20 +240,22 @@ CFileMgr::SetDirMyDocuments(void)
mychdir(_psGetUserFilesFolder());
}
size_t
ssize_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
{
int fd;
size_t n, len;
ssize_t n, len;
fd = myfopen(file, mode);
if(fd == 0)
return 0;
return -1;
len = 0;
do{
n = myfread(buf + len, 1, 0x4000, fd);
if(n < 0)
#ifndef FIX_BUGS
if (n < 0)
return -1;
#endif
len += n;
}while(n == 0x4000);
buf[len] = 0;
@@ -274,13 +276,13 @@ CFileMgr::OpenFileForWriting(const char *file)
}
size_t
CFileMgr::Read(int fd, const char *buf, size_t len)
CFileMgr::Read(int fd, const char *buf, ssize_t len)
{
return myfread((void*)buf, 1, len, fd);
}
size_t
CFileMgr::Write(int fd, const char *buf, size_t len)
CFileMgr::Write(int fd, const char *buf, ssize_t len)
{
return myfwrite((void*)buf, 1, len, fd);
}