Commit 7f741c27 authored by Richard Gobeille's avatar Richard Gobeille

engine: use kread_and_test() instead of regular kread() where appropriate

parent ab90c721
......@@ -31,7 +31,7 @@ int32_t animvpx_read_ivf_header(buildvfs_kfd inhandle, animvpx_ivf_header_t *hdr
{
int32_t err;
if (kread(inhandle, hdr, sizeof(animvpx_ivf_header_t)) != sizeof(animvpx_ivf_header_t))
if (kread_and_test(inhandle, hdr, sizeof(animvpx_ivf_header_t)))
return 1; // "couldn't read header"
err = animvpx_check_header(hdr);
......@@ -158,7 +158,7 @@ static int32_t animvpx_read_frame(buildvfs_kfd inhandle, uint8_t **bufptr, uint3
struct { uint32_t framesiz; uint64_t timestamp; } hdr;
#pragma pack(pop)
if (kread(inhandle, &hdr, sizeof(hdr)) != sizeof(hdr))
if (kread_and_test(inhandle, &hdr, sizeof(hdr)))
return 1;
if (hdr.framesiz == 0)
......@@ -183,7 +183,7 @@ static int32_t animvpx_read_frame(buildvfs_kfd inhandle, uint8_t **bufptr, uint3
*bufsizptr = hdr.framesiz;
if (kread(inhandle, *bufptr, hdr.framesiz) != (signed)hdr.framesiz)
if (kread_and_test(inhandle, *bufptr, hdr.framesiz))
return 3;
return 0;
......
......@@ -2112,7 +2112,7 @@ static int32_t defsparser(scriptfile *script)
filebuf = (char *)Xmalloc(filesize);
klseek(fd, 0, SEEK_SET);
if (kread(fd, filebuf, filesize)!=filesize)
if (kread_and_test(fd, filebuf, filesize))
{ kclose(fd); Xfree(highpaldata); initprintf("Error: didn't read all of \"%s\".\n", fn); break; }
kclose(fd);
......
......@@ -1448,7 +1448,7 @@ int32_t kdfread_LZ4(void *buffer, int dasizeof, int count, buildvfs_kfd fil)
int32_t leng;
// read compressed data length
if (kread(fil, &leng, sizeof(leng)) != sizeof(leng))
if (kread_and_test(fil, &leng, sizeof(leng)))
return -1;
leng = B_LITTLE32(leng);
......@@ -1458,7 +1458,7 @@ int32_t kdfread_LZ4(void *buffer, int dasizeof, int count, buildvfs_kfd fil)
if (leng > ARRAY_SSIZE(compressedDataStackBuf))
pCompressedData = (char *)Xaligned_alloc(16, leng);
if (kread(fil, pCompressedData, leng) != leng)
if (kread_and_test(fil, pCompressedData, leng))
return -1;
int32_t decompressedLength = LZ4_decompress_safe(pCompressedData, (char*) buffer, leng, dasizeof*count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment