From 094535c010320967639e8e86f974d878e80baa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 1 May 2015 16:13:57 +0200 Subject: Imported Upstream version 1.7.0 --- icc/iccstd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'icc/iccstd.c') diff --git a/icc/iccstd.c b/icc/iccstd.c index 742be4d..3f7966e 100644 --- a/icc/iccstd.c +++ b/icc/iccstd.c @@ -310,7 +310,6 @@ icmAlloc *al /* heap allocator, NULL for default */ ) { icmFileStd *p; int del_al = 0; - struct stat sbuf; if (al == NULL) { /* None provided, create default */ if ((al = new_icmAllocStd()) == NULL) @@ -334,8 +333,10 @@ icmAlloc *al /* heap allocator, NULL for default */ p->get_buf = icmFileStd_get_buf; p->del = icmFileStd_delete; - if (fstat(fileno(fp), &sbuf) == 0) { - p->size = sbuf.st_size; + // fstat() is not so robust on MSWin. + if (fseek(fp, 0L, SEEK_END) == 0) { + p->size = ftell(fp); + fseek(fp, 0L, SEEK_SET); } else { p->size = 0; } -- cgit v1.2.3