2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-01-05 08:02:11 +00:00

Rename seek functions in QUtil

This commit is contained in:
Jay Berkenbilt 2012-06-26 23:09:21 -04:00
parent 0802ba275f
commit 736bafbb9c
4 changed files with 8 additions and 8 deletions

View File

@ -49,9 +49,9 @@ namespace QUtil
// Wrap around off_t versions of fseek and ftell if available // Wrap around off_t versions of fseek and ftell if available
QPDF_DLL QPDF_DLL
int fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence); int seek(FILE* stream, qpdf_offset_t offset, int whence);
QPDF_DLL QPDF_DLL
qpdf_offset_t ftell_off_t(FILE* stream); qpdf_offset_t tell(FILE* stream);
QPDF_DLL QPDF_DLL
char* copy_string(std::string const&); char* copy_string(std::string const&);

View File

@ -149,7 +149,7 @@ QPDF::FileInputSource::getName() const
qpdf_offset_t qpdf_offset_t
QPDF::FileInputSource::tell() QPDF::FileInputSource::tell()
{ {
return QUtil::ftell_off_t(this->file); return QUtil::tell(this->file);
} }
void void
@ -158,7 +158,7 @@ QPDF::FileInputSource::seek(qpdf_offset_t offset, int whence)
QUtil::os_wrapper(std::string("seek to ") + this->filename + ", offset " + QUtil::os_wrapper(std::string("seek to ") + this->filename + ", offset " +
QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(offset) + " (" +
QUtil::int_to_string(whence) + ")", QUtil::int_to_string(whence) + ")",
QUtil::fseek_off_t(this->file, offset, whence)); QUtil::seek(this->file, offset, whence));
} }
void void
@ -170,7 +170,7 @@ QPDF::FileInputSource::rewind()
size_t size_t
QPDF::FileInputSource::read(char* buffer, size_t length) QPDF::FileInputSource::read(char* buffer, size_t length)
{ {
this->last_offset = QUtil::ftell_off_t(this->file); this->last_offset = QUtil::tell(this->file);
size_t len = fread(buffer, 1, length, this->file); size_t len = fread(buffer, 1, length, this->file);
if ((len == 0) && ferror(this->file)) if ((len == 0) && ferror(this->file))
{ {

View File

@ -122,7 +122,7 @@ QUtil::fopen_wrapper(std::string const& description, FILE* f)
} }
int int
QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence) QUtil::seek(FILE* stream, qpdf_offset_t offset, int whence)
{ {
#if HAVE_FSEEKO #if HAVE_FSEEKO
return fseeko(stream, (off_t)offset, whence); return fseeko(stream, (off_t)offset, whence);
@ -138,7 +138,7 @@ QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence)
} }
qpdf_offset_t qpdf_offset_t
QUtil::ftell_off_t(FILE* stream) QUtil::tell(FILE* stream)
{ {
#if HAVE_FSEEKO #if HAVE_FSEEKO
return (qpdf_offset_t)ftello(stream); return (qpdf_offset_t)ftello(stream);

View File

@ -113,7 +113,7 @@ void runtest(int n, char const* filename)
FILE* f = QUtil::fopen_wrapper(std::string("open ") + filename, FILE* f = QUtil::fopen_wrapper(std::string("open ") + filename,
fopen(filename, "rb")); fopen(filename, "rb"));
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
size_t size = (size_t) QUtil::ftell_off_t(f); size_t size = (size_t) QUtil::tell(f);
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
file_buf = PointerHolder<char>(true, new char[size]); file_buf = PointerHolder<char>(true, new char[size]);
char* buf_p = file_buf.getPointer(); char* buf_p = file_buf.getPointer();