diff options
author | Marti Maria <info@littlecms.com> | 2010-11-24 16:45:45 +0100 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2010-11-24 16:45:45 +0100 |
commit | 9dab249d60caebed2ac530ab53fcb0231b218c2b (patch) | |
tree | 57ab940814c476c7f0347967ae4a4851d44456bb | |
parent | 3cb4dac6c35c30d05c35466cfdb31ffbee5a3e80 (diff) | |
download | lcms2-9dab249d60caebed2ac530ab53fcb0231b218c2b.tar.gz |
cmsfilelength now keeps position of stream
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | src/cmserr.c | 8 |
2 files changed, 8 insertions, 3 deletions
@@ -21,4 +21,5 @@ Special Thanks -------------- Jan Morovic Jos Vernon (WebSupergoo) -Harald Schneider (Maxon)
\ No newline at end of file +Harald Schneider (Maxon) +Christian Albrecht diff --git a/src/cmserr.c b/src/cmserr.c index 5f79328..55f0358 100644 --- a/src/cmserr.c +++ b/src/cmserr.c @@ -43,17 +43,21 @@ int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2) // long int because C99 specifies ftell in such way (7.19.9.2) long int CMSEXPORT cmsfilelength(FILE* f) { - long int n; + long int p , n; + + p = ftell(f); // register current file position if (fseek(f, 0, SEEK_END) != 0) { return -1; } + n = ftell(f); - fseek(f, 0, SEEK_SET); + fseek(f, p, SEEK_SET); // file position restored return n; } + // Memory handling ------------------------------------------------------------------ // // This is the interface to low-level memory management routines. By default a simple |