Skip to content

Commit d4b2caa

Browse files
committed
Remove redundant functions and typedef
During a windows build the following warning appeared: ``` definition.cpp(626): warning C4244: 'argument': conversion from 'portable_off_t' to 'size_t', possible loss of data ``` investigations lead to: - fseek and ftell are not used, - portable_off_t is misused removed the mentioned functions and typedefs. - corrected the possible loss of data for shrinkBuffer
1 parent b2c2e22 commit d4b2caa

File tree

3 files changed

+3
-33
lines changed

3 files changed

+3
-33
lines changed

src/definition.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ class FilterCache
583583
private:
584584
struct FilterCacheItem
585585
{
586-
portable_off_t filePos;
586+
size_t filePos;
587587
size_t fileSize;
588588
};
589589
using LineOffsets = std::vector<size_t>;
@@ -742,7 +742,7 @@ class FilterCache
742742

743743
//! Shrinks buffer \a str which should hold the contents of \a fileName to the
744744
//! fragment starting a line \a startLine and ending at line \a endLine
745-
void shrinkBuffer(BufStr &str,const QCString &fileName,int startLine,int endLine)
745+
void shrinkBuffer(BufStr &str,const QCString &fileName,size_t startLine,size_t endLine)
746746
{
747747
// compute offsets from start for each line
748748
compileLineOffsets(fileName,str);
@@ -775,7 +775,7 @@ class FilterCache
775775
std::unordered_map<std::string,FilterCacheItem> m_cache;
776776
std::unordered_map<std::string,LineOffsets> m_lineOffsets;
777777
std::mutex m_mutex;
778-
portable_off_t m_endPos;
778+
size_t m_endPos;
779779
};
780780

781781
FilterCache &FilterCache::instance()

src/portable.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -354,28 +354,6 @@ QCString Portable::getenv(const QCString &variable)
354354
#endif
355355
}
356356

357-
portable_off_t Portable::fseek(FILE *f,portable_off_t offset, int whence)
358-
{
359-
#if defined(__MINGW32__)
360-
return fseeko64(f,offset,whence);
361-
#elif defined(_WIN32) && !defined(__CYGWIN__)
362-
return _fseeki64(f,offset,whence);
363-
#else
364-
return fseeko(f,offset,whence);
365-
#endif
366-
}
367-
368-
portable_off_t Portable::ftell(FILE *f)
369-
{
370-
#if defined(__MINGW32__)
371-
return ftello64(f);
372-
#elif defined(_WIN32) && !defined(__CYGWIN__)
373-
return _ftelli64(f);
374-
#else
375-
return ftello(f);
376-
#endif
377-
}
378-
379357
FILE *Portable::fopen(const QCString &fileName,const QCString &mode)
380358
{
381359
#if defined(_WIN32) && !defined(__CYGWIN__)

src/portable.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
class Buf;
1111

12-
#if defined(_WIN32)
13-
typedef __int64 portable_off_t;
14-
#else
15-
typedef off_t portable_off_t;
16-
#endif
17-
1812
/** @file
1913
* @brief Portable versions of functions that are platform dependent.
2014
*/
@@ -26,8 +20,6 @@ namespace Portable
2620
QCString getenv(const QCString &variable);
2721
void setenv(const QCString &variable,const QCString &value);
2822
void unsetenv(const QCString &variable);
29-
portable_off_t fseek(FILE *f,portable_off_t offset, int whence);
30-
portable_off_t ftell(FILE *f);
3123
FILE * fopen(const QCString &fileName,const QCString &mode);
3224
int fclose(FILE *f);
3325
void unlink(const QCString &fileName);

0 commit comments

Comments
 (0)