From 9dab249d60caebed2ac530ab53fcb0231b218c2b Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Wed, 24 Nov 2010 16:45:45 +0100 Subject: cmsfilelength now keeps position of stream --- AUTHORS | 3 ++- src/cmserr.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5ffeafe..37c0e43 100644 --- a/AUTHORS +++ b/AUTHORS @@ -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 -- cgit v1.2.1