aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-07-02 17:24:07 +0000
committerZachary Turner <zturner@google.com>2014-07-02 17:24:07 +0000
commita746e8e58a460f6667cc9e16eb94d256ea4b0121 (patch)
tree39bdccf355cbc36ce7820f8831fc39639e0b694b /lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
parent379b97f2856afebc4fbdfb8bdde2251c046a10a3 (diff)
downloadllvm-a746e8e58a460f6667cc9e16eb94d256ea4b0121.zip
llvm-a746e8e58a460f6667cc9e16eb94d256ea4b0121.tar.gz
llvm-a746e8e58a460f6667cc9e16eb94d256ea4b0121.tar.bz2
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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index 5d9ff28..5498bed 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -322,14 +322,14 @@ ObjectFileJIT::SetLoadAddress (Target &target,
size_t
ObjectFileJIT::ReadSectionData (const lldb_private::Section *section,
- off_t section_offset,
+ lldb::offset_t section_offset,
void *dst,
size_t dst_len) const
{
lldb::offset_t file_size = section->GetFileSize();
- if (section_offset < static_cast<off_t>(file_size))
+ if (section_offset < file_size)
{
- uint64_t src_len = file_size - section_offset;
+ size_t src_len = file_size - section_offset;
if (src_len > dst_len)
src_len = dst_len;
const uint8_t *src = ((uint8_t *)(uintptr_t)section->GetFileOffset()) + section_offset;
@@ -339,6 +339,7 @@ ObjectFileJIT::ReadSectionData (const lldb_private::Section *section,
}
return 0;
}
+
size_t
ObjectFileJIT::ReadSectionData (const lldb_private::Section *section,
lldb_private::DataExtractor& section_data) const