From a746e8e58a460f6667cc9e16eb94d256ea4b0121 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 2 Jul 2014 17:24:07 +0000 Subject: 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 --- lldb/source/Target/PathMappingList.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Target/PathMappingList.cpp') diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 0d70d03a476..2fd517829b8 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -132,9 +132,9 @@ PathMappingList::Replace (const ConstString &path, } bool -PathMappingList::Remove (off_t index, bool notify) +PathMappingList::Remove (size_t index, bool notify) { - if (static_cast(index) >= m_pairs.size()) + if (index >= m_pairs.size()) return false; ++m_mod_id; -- cgit v1.2.3