Remove feof check for file reading
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Dec 2015 06:45:46 +0000 (17:45 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Dec 2015 06:45:46 +0000 (17:45 +1100)
This wasnt correct since we're not reading past the stream,
though it worked on Linux and some Windows systems.

source/blender/blenlib/intern/storage.c

index 5c300e94097384bcc776de058a80972f3821a58e..91df103bc7b202d6501bdac337913374f722f0d4 100644 (file)
@@ -306,7 +306,7 @@ void *BLI_file_read_text_as_mem(const char *filepath, size_t pad_bytes, size_t *
                }
 
                const long int filelen_read = fread(mem, 1, filelen, fp);
-               if ((filelen_read < 0) || (!feof(fp) ) || ferror(fp)) {
+               if ((filelen_read < 0) || ferror(fp)) {
                        MEM_freeN(mem);
                        mem = NULL;
                        goto finally;
@@ -346,7 +346,7 @@ void *BLI_file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t
                }
 
                const long int filelen_read = fread(mem, 1, filelen, fp);
-               if ((filelen_read != filelen) || (!feof(fp) ) || ferror(fp)) {
+               if ((filelen_read != filelen) || ferror(fp)) {
                        MEM_freeN(mem);
                        mem = NULL;
                        goto finally;