Skip to content

Commit 72b009f

Browse files
committed
Speed up cimg::fsize
1 parent b6bbf37 commit 72b009f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

CImg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5799,11 +5799,11 @@ namespace cimg_library {
57995799
#if cimg_OS==1 // Optimized for POSIX Environements (Linux, macOS, BSD, etc.)
58005800
const int fd = fileno(file);
58015801
struct stat st;
5802-
if (fd>=0 && !fstat(fd,&st)) return (cimg_int64)st.st_size;
5802+
if (!fstat(fd,&st)) return (cimg_int64)st.st_size;
58035803
#elif cimg_OS==2 // Optimized for Windows Environements (MSVC, MinGW)
58045804
const int fd = _fileno(file);
58055805
struct _stati64 st;
5806-
if (fd>=0 && !_fstati64(fd,&st)) return (cimg_int64)st.st_size;
5806+
if (!_fstati64(fd,&st)) return (cimg_int64)st.st_size;
58075807
#endif
58085808

58095809
// Fallback, used for non-POSIX systems or if fstat failed (pipes or sockets).

0 commit comments

Comments
 (0)