Commit 736bafbb9ca645fc8662d9d05f5a72a2e6185e75

Authored by Jay Berkenbilt
1 parent 0802ba27

Rename seek functions in QUtil

include/qpdf/QUtil.hh
@@ -49,9 +49,9 @@ namespace QUtil @@ -49,9 +49,9 @@ namespace QUtil
49 49
50 // Wrap around off_t versions of fseek and ftell if available 50 // Wrap around off_t versions of fseek and ftell if available
51 QPDF_DLL 51 QPDF_DLL
52 - int fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence); 52 + int seek(FILE* stream, qpdf_offset_t offset, int whence);
53 QPDF_DLL 53 QPDF_DLL
54 - qpdf_offset_t ftell_off_t(FILE* stream); 54 + qpdf_offset_t tell(FILE* stream);
55 55
56 QPDF_DLL 56 QPDF_DLL
57 char* copy_string(std::string const&); 57 char* copy_string(std::string const&);
libqpdf/QPDF.cc
@@ -149,7 +149,7 @@ QPDF::FileInputSource::getName() const @@ -149,7 +149,7 @@ QPDF::FileInputSource::getName() const
149 qpdf_offset_t 149 qpdf_offset_t
150 QPDF::FileInputSource::tell() 150 QPDF::FileInputSource::tell()
151 { 151 {
152 - return QUtil::ftell_off_t(this->file); 152 + return QUtil::tell(this->file);
153 } 153 }
154 154
155 void 155 void
@@ -158,7 +158,7 @@ QPDF::FileInputSource::seek(qpdf_offset_t offset, int whence) @@ -158,7 +158,7 @@ QPDF::FileInputSource::seek(qpdf_offset_t offset, int whence)
158 QUtil::os_wrapper(std::string("seek to ") + this->filename + ", offset " + 158 QUtil::os_wrapper(std::string("seek to ") + this->filename + ", offset " +
159 QUtil::int_to_string(offset) + " (" + 159 QUtil::int_to_string(offset) + " (" +
160 QUtil::int_to_string(whence) + ")", 160 QUtil::int_to_string(whence) + ")",
161 - QUtil::fseek_off_t(this->file, offset, whence)); 161 + QUtil::seek(this->file, offset, whence));
162 } 162 }
163 163
164 void 164 void
@@ -170,7 +170,7 @@ QPDF::FileInputSource::rewind() @@ -170,7 +170,7 @@ QPDF::FileInputSource::rewind()
170 size_t 170 size_t
171 QPDF::FileInputSource::read(char* buffer, size_t length) 171 QPDF::FileInputSource::read(char* buffer, size_t length)
172 { 172 {
173 - this->last_offset = QUtil::ftell_off_t(this->file); 173 + this->last_offset = QUtil::tell(this->file);
174 size_t len = fread(buffer, 1, length, this->file); 174 size_t len = fread(buffer, 1, length, this->file);
175 if ((len == 0) && ferror(this->file)) 175 if ((len == 0) && ferror(this->file))
176 { 176 {
libqpdf/QUtil.cc
@@ -122,7 +122,7 @@ QUtil::fopen_wrapper(std::string const& description, FILE* f) @@ -122,7 +122,7 @@ QUtil::fopen_wrapper(std::string const& description, FILE* f)
122 } 122 }
123 123
124 int 124 int
125 -QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence) 125 +QUtil::seek(FILE* stream, qpdf_offset_t offset, int whence)
126 { 126 {
127 #if HAVE_FSEEKO 127 #if HAVE_FSEEKO
128 return fseeko(stream, (off_t)offset, whence); 128 return fseeko(stream, (off_t)offset, whence);
@@ -138,7 +138,7 @@ QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence) @@ -138,7 +138,7 @@ QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence)
138 } 138 }
139 139
140 qpdf_offset_t 140 qpdf_offset_t
141 -QUtil::ftell_off_t(FILE* stream) 141 +QUtil::tell(FILE* stream)
142 { 142 {
143 #if HAVE_FSEEKO 143 #if HAVE_FSEEKO
144 return (qpdf_offset_t)ftello(stream); 144 return (qpdf_offset_t)ftello(stream);
qpdf/test_driver.cc
@@ -113,7 +113,7 @@ void runtest(int n, char const* filename) @@ -113,7 +113,7 @@ void runtest(int n, char const* filename)
113 FILE* f = QUtil::fopen_wrapper(std::string("open ") + filename, 113 FILE* f = QUtil::fopen_wrapper(std::string("open ") + filename,
114 fopen(filename, "rb")); 114 fopen(filename, "rb"));
115 fseek(f, 0, SEEK_END); 115 fseek(f, 0, SEEK_END);
116 - size_t size = (size_t) QUtil::ftell_off_t(f); 116 + size_t size = (size_t) QUtil::tell(f);
117 fseek(f, 0, SEEK_SET); 117 fseek(f, 0, SEEK_SET);
118 file_buf = PointerHolder<char>(true, new char[size]); 118 file_buf = PointerHolder<char>(true, new char[size]);
119 char* buf_p = file_buf.getPointer(); 119 char* buf_p = file_buf.getPointer();