Start converting usages of off_t to other types.

off_t is a type which is used for file offsets.  Even more
specifically, it is only used by a limited number of C APIs that
deal with files.  Any usage of off_t where the variable is not
intended to be used with one of these APIs is a bug, by definition.

This patch corrects some easy mis-uses of off_t, generally by
converting them to lldb::offset_t, but sometimes by using other
types such as size_t, when appropriate.

The use of off_t to represent these offsets has worked fine in
practice on linux-y platforms, since we used _FILE_OFFSET_64 to
guarantee that off_t was a uint64.  On Windows, however,
_FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit.
So the usage of off_t on Windows actually leads to legitimate bugs.

Reviewed by: Greg Clayton

Differential Revision: http://reviews.llvm.org/D4358

llvm-svn: 212192
This commit is contained in:
Zachary Turner
2014-07-02 17:24:07 +00:00
parent 379b97f285
commit a746e8e58a
16 changed files with 45 additions and 44 deletions

View File

@@ -235,7 +235,7 @@ Module::Module (const ModuleSpec &module_spec) :
Module::Module(const FileSpec& file_spec,
const ArchSpec& arch,
const ConstString *object_name,
off_t object_offset,
lldb::offset_t object_offset,
const TimeValue *object_mod_time_ptr) :
m_mutex (Mutex::eMutexTypeRecursive),
m_mod_time (file_spec.GetModificationTime()),