POV-Ray : Newsgroups : povray.beta-test : use of fseek64 in image.cpp is wrong Server Time
22 Dec 2024 20:50:47 EST (-0500)
  use of fseek64 in image.cpp is wrong (Message 1 to 1 of 1)  
From: Jon Boede
Subject: use of fseek64 in image.cpp is wrong
Date: 6 Dec 2010 16:25:00
Message: <web.4cfd53f0be76ef3981884760@news.povray.org>
image.cpp uses fseek64 which under vfe/unix/syspovconfig.h is #defined to be:

lseek64(fileno(file), ... )

Unfortunately, lseek64 returns the file offset that was seek'd (sought?) and not
zero as is the case with fseek64.

I change image.cpp to use m_File as an int and then did
open/close/lseek64/read/write instead of the f* versions of them.

This solved the problem of the exceptions being thrown in SetLine and GetLine
whenever they were called.

Being unfamiliar with the code I don't know how much GetLine gets called, but I
suspect that SetLine is used so much more that the use of buffered I/O is
actually slowing things down (just the extra step through the library) over
going straight to the write(2) call.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.