This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc. This helps cleanup some of the warning
spew that occurs during builds.
llvm-svn: 205390
return 0;
size_t current_line_size = strlen (current_line);
- if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+ if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
+ last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
return 0;
if (log)
if (breakpoint != NULL)
{
const size_t num_locations = breakpoint->GetNumLocations();
- if (cur_bp_id.GetLocationID() > num_locations)
+ if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations)
{
StreamString id_str;
BreakpointID::GetCanonicalReference (&id_str,
if (m_options.relative_frame_offset < 0)
{
- if (frame_idx >= -m_options.relative_frame_offset)
+ if (static_cast<int32_t>(frame_idx) >= -m_options.relative_frame_offset)
frame_idx += m_options.relative_frame_offset;
else
{
// I don't want "up 20" where "20" takes you past the top of the stack to produce
// an error, but rather to just go to the top. So I have to count the stack here...
const uint32_t num_frames = thread->GetStackFrameCount();
- if (num_frames - frame_idx > m_options.relative_frame_offset)
+ if (static_cast<int32_t>(num_frames - frame_idx) > m_options.relative_frame_offset)
frame_idx += m_options.relative_frame_offset;
else
{
continue;
const TargetList& target_list(debugger_sp->GetTargetList());
for (uint32_t target_idx = 0;
- target_idx < target_list.GetNumTargets();
+ target_idx < static_cast<uint32_t>(target_list.GetNumTargets());
target_idx++)
{
TargetSP target_sp(target_list.GetTargetAtIndex(target_idx));
const size_t argc = input.GetArgumentCount();
const char *arg = NULL;
int setting_var_idx;
- for (setting_var_idx = 1; setting_var_idx < argc; ++setting_var_idx)
+ for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc);
+ ++setting_var_idx)
{
arg = input.GetArgumentAtIndex(setting_var_idx);
if (arg && arg[0] != '-')
static bool
WarnOnPotentialUnquotedUnsignedType (Args& command, CommandReturnObject &result)
{
- for (int idx = 0; idx < command.GetArgumentCount(); idx++)
+ for (unsigned idx = 0; idx < command.GetArgumentCount(); idx++)
{
const char* arg = command.GetArgumentAtIndex(idx);
if (idx+1 < command.GetArgumentCount())
{
name_t port_name;
int len = snprintf(port_name, sizeof(port_name), "%s", port);
- if (len < sizeof(port_name))
+ if (static_cast<size_t>(len) < sizeof(port_name))
{
kret = ::bootstrap_check_in (bootstrap_port,
port_name,
if (port && port[0])
{
- if (::snprintf (port_name, sizeof (port_name), "%s", port) >= sizeof (port_name))
+ if (static_cast<size_t>(::snprintf (port_name, sizeof (port_name), "%s", port)) >= sizeof (port_name))
{
if (error_ptr)
error_ptr->SetErrorString ("port netname is too long");
struct stat stat;
if (::fstat(fd, &stat) == 0)
{
- if (S_ISREG(stat.st_mode) && (stat.st_size > offset))
+ if (S_ISREG(stat.st_mode) &&
+ (stat.st_size > static_cast<off_t>(offset)))
{
const size_t max_bytes_available = stat.st_size - offset;
if (length == SIZE_MAX)
const size_t max_length = help_delegate_ap->GetMaxLineLength();
Rect bounds = GetBounds();
bounds.Inset(1, 1);
- if (max_length + 4 < bounds.size.width)
+ if (max_length + 4 < static_cast<size_t>(bounds.size.width))
{
bounds.origin.x += (bounds.size.width - max_length + 4)/2;
bounds.size.width = max_length + 4;
}
}
- if (num_lines + 2 < bounds.size.height)
+ if (num_lines + 2 < static_cast<size_t>(bounds.size.height))
{
bounds.origin.y += (bounds.size.height - num_lines + 2)/2;
bounds.size.height = num_lines + 2;
for (size_t i=0; i<num_submenus; ++i)
{
Menu *submenu = submenus[i].get();
- if (m_max_submenu_name_length < submenu->m_name.size())
+ if (static_cast<size_t>(m_max_submenu_name_length) < submenu->m_name.size())
m_max_submenu_name_length = submenu->m_name.size();
- if (m_max_submenu_key_name_length < submenu->m_key_name.size())
+ if (static_cast<size_t>(m_max_submenu_key_name_length) < submenu->m_key_name.size())
m_max_submenu_key_name_length = submenu->m_key_name.size();
}
}
Menu::AddSubmenu (const MenuSP &menu_sp)
{
menu_sp->m_parent = this;
- if (m_max_submenu_name_length < menu_sp->m_name.size())
+ if (static_cast<size_t>(m_max_submenu_name_length) < menu_sp->m_name.size())
m_max_submenu_name_length = menu_sp->m_name.size();
- if (m_max_submenu_key_name_length < menu_sp->m_key_name.size())
+ if (static_cast<size_t>(m_max_submenu_key_name_length) < menu_sp->m_key_name.size())
m_max_submenu_key_name_length = menu_sp->m_key_name.size();
m_submenus.push_back(menu_sp);
}
if (width > 2)
{
width -= 2;
- for (size_t i=0; i< width; ++i)
+ for (int i=0; i< width; ++i)
window.PutChar(ACS_HLINE);
}
window.PutChar(ACS_RTEE);
window.Box();
for (size_t i=0; i<num_submenus; ++i)
{
- const bool is_selected = i == selected_idx;
+ const bool is_selected =
+ (i == static_cast<size_t>(selected_idx));
window.MoveCursor(x, y + i);
if (is_selected)
{
case KEY_DOWN:
case KEY_UP:
// Show last menu or first menu
- if (selected_idx < num_submenus)
+ if (selected_idx < static_cast<int>(num_submenus))
run_menu_sp = submenus[selected_idx];
else if (!submenus.empty())
run_menu_sp = submenus.front();
case KEY_RIGHT:
{
++m_selected;
- if (m_selected >= num_submenus)
+ if (m_selected >= static_cast<int>(num_submenus))
m_selected = 0;
- if (m_selected < num_submenus)
+ if (m_selected < static_cast<int>(num_submenus))
run_menu_sp = submenus[m_selected];
else if (!submenus.empty())
run_menu_sp = submenus.front();
--m_selected;
if (m_selected < 0)
m_selected = num_submenus - 1;
- if (m_selected < num_submenus)
+ if (m_selected < static_cast<int>(num_submenus))
run_menu_sp = submenus[m_selected];
else if (!submenus.empty())
run_menu_sp = submenus.front();
const int start_select = m_selected;
while (++m_selected != start_select)
{
- if (m_selected >= num_submenus)
+ if (static_cast<size_t>(m_selected) >= num_submenus)
m_selected = 0;
if (m_submenus[m_selected]->GetType() == Type::Separator)
continue;
const int start_select = m_selected;
while (--m_selected != start_select)
{
- if (m_selected < 0)
+ if (m_selected < static_cast<int>(0))
m_selected = num_submenus - 1;
if (m_submenus[m_selected]->GetType() == Type::Separator)
continue;
break;
case KEY_RETURN:
- if (selected_idx < num_submenus)
+ if (static_cast<size_t>(selected_idx) < num_submenus)
{
if (submenus[selected_idx]->Action() == MenuActionResult::Quit)
return eQuitApplication;
window.PutChar (ACS_DIAMOND);
window.PutChar (ACS_HLINE);
}
- bool highlight = (selected_row_idx == m_row_idx) && window.IsActive();
+ bool highlight =
+ (selected_row_idx == static_cast<size_t>(m_row_idx)) && window.IsActive();
if (highlight)
window.AttributeOn(A_REVERSE);
TreeItem *
GetItemForRowIndex (uint32_t row_idx)
{
- if (m_row_idx == row_idx)
+ if (static_cast<uint32_t>(m_row_idx) == row_idx)
return this;
if (m_children.empty())
return NULL;
- if (m_children.back().m_row_idx < row_idx)
+ if (static_cast<uint32_t>(m_children.back().m_row_idx) < row_idx)
return NULL;
if (IsExpanded())
{
// Page up key
if (m_first_visible_row > 0)
{
- if (m_first_visible_row > m_max_y)
+ if (static_cast<int>(m_first_visible_row) > m_max_y)
m_first_visible_row -= m_max_y;
else
m_first_visible_row = 0;
case '.':
case KEY_NPAGE:
// Page down key
- if (m_num_rows > m_max_y)
+ if (m_num_rows > static_cast<size_t>(m_max_y))
{
if (m_first_visible_row + m_max_y < m_num_rows)
{
// Save the row index in each Row structure
row.row_idx = m_num_rows;
if ((m_num_rows >= m_first_visible_row) &&
- ((m_num_rows - m_first_visible_row) < NumVisibleRows()))
+ ((m_num_rows - m_first_visible_row) < static_cast<size_t>(NumVisibleRows())))
{
row.x = m_min_x;
row.y = m_num_rows - m_first_visible_row + 1;
int y = 1;
const int min_y = y;
const int max_y = window_height - 1 - y;
- const int num_visible_lines = max_y - min_y + 1;
+ const size_t num_visible_lines = max_y - min_y + 1;
const size_t num_lines = m_text.GetSize();
const char *bottom_message;
if (num_lines <= num_visible_lines)
case ',':
if (m_first_visible_line > 0)
{
- if (m_first_visible_line >= num_visible_lines)
+ if (static_cast<size_t>(m_first_visible_line) >= num_visible_lines)
m_first_visible_line -= num_visible_lines;
else
m_first_visible_line = 0;
if (m_first_visible_line + num_visible_lines < num_lines)
{
m_first_visible_line += num_visible_lines;
- if (m_first_visible_line > num_lines)
+ if (static_cast<size_t>(m_first_visible_line) > num_lines)
m_first_visible_line = num_lines - num_visible_lines;
}
break;
{
// Same file, nothing to do, we should either have the
// lines or not (source file missing)
- if (m_selected_line >= m_first_visible_line)
+ if (m_selected_line >= static_cast<size_t>(m_first_visible_line))
{
if (m_selected_line >= m_first_visible_line + num_visible_lines)
m_first_visible_line = m_selected_line - 10;
const attr_t selected_highlight_attr = A_REVERSE;
const attr_t pc_highlight_attr = COLOR_PAIR(1);
- for (int i=0; i<num_visible_lines; ++i)
+ for (size_t i=0; i<num_visible_lines; ++i)
{
const uint32_t curr_line = m_first_visible_line + i;
if (curr_line < num_source_lines)
}
const uint32_t non_visible_pc_offset = (num_visible_lines / 5);
- if (m_first_visible_line >= num_disassembly_lines)
+ if (static_cast<size_t>(m_first_visible_line) >= num_disassembly_lines)
m_first_visible_line = 0;
if (pc_idx < num_disassembly_lines)
{
- if (pc_idx < m_first_visible_line ||
+ if (pc_idx < static_cast<uint32_t>(m_first_visible_line) ||
pc_idx >= m_first_visible_line + num_visible_lines)
m_first_visible_line = pc_idx - non_visible_pc_offset;
}
case ',':
case KEY_PPAGE:
// Page up key
- if (m_first_visible_line > num_visible_lines)
+ if (static_cast<uint32_t>(m_first_visible_line) > num_visible_lines)
m_first_visible_line -= num_visible_lines;
else
m_first_visible_line = 0;
if (m_selected_line > 0)
{
m_selected_line--;
- if (m_first_visible_line > m_selected_line)
+ if (static_cast<size_t>(m_first_visible_line) > m_selected_line)
m_first_visible_line = m_selected_line;
}
return eKeyHandled;
// Add spaces to make sure bytes dispay comes out even in case opcodes
// aren't all the same size
- if (bytes_written < min_byte_width)
+ if (static_cast<uint32_t>(bytes_written) < min_byte_width)
bytes_written = s->Printf ("%*s", min_byte_width - bytes_written, "");
return bytes_written;
}
if (error.Fail() || num_bytes == 0)
return false;
uint8_t *bytes = buffer_sp->GetBytes();
- for (int byte_idx = 0; byte_idx < num_bytes-1; byte_idx++)
+ for (uint64_t byte_idx = 0; byte_idx < num_bytes-1; byte_idx++)
{
uint8_t byte = bytes[byte_idx];
bool bit0 = (byte & 1) == 1;
ai != ae;
++ai, ++arg_index)
{
- if (args.size() < arg_index)
+ if (args.size() < static_cast<size_t>(arg_index))
{
error.SetErrorString ("Not enough arguments passed in to function");
return false;
cpu_type_t cpu = arch_spec.GetMachOCPUType();
cpu_type_t sub = arch_spec.GetMachOCPUSubType();
if (cpu != 0 &&
- cpu != UINT32_MAX &&
- cpu != LLDB_INVALID_CPUTYPE &&
+ cpu != static_cast<cpu_type_t>(UINT32_MAX) &&
+ cpu != static_cast<cpu_type_t>(LLDB_INVALID_CPUTYPE) &&
!(cpu == 0x01000007 && sub == 8)) // If haswell is specified, don't try to set the CPU type or we will fail
{
size_t ocount = 0;
ssize_t count = ::readlink(path, buf, buf_len);
if (count < 0)
error.SetErrorToErrno();
- else if (count < (buf_len-1))
+ else if (static_cast<size_t>(count) < (buf_len-1))
buf[count] = '\0'; // Success
else
error.SetErrorString("'buf' buffer is too small to contain link contents");
error.SetErrorString ("invalid host backing file");
return UINT64_MAX;
}
- if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail())
+ if (static_cast<uint64_t>(file_sp->SeekFromStart(offset, &error)) != offset ||
+ error.Fail())
return UINT64_MAX;
size_t bytes_written = src_len;
error = file_sp->Write(src, bytes_written);
error.SetErrorString ("invalid host backing file");
return UINT64_MAX;
}
- if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail())
+ if (static_cast<uint64_t>(file_sp->SeekFromStart(offset, &error)) != offset ||
+ error.Fail())
return UINT64_MAX;
size_t bytes_read = dst_len;
error = file_sp->Read(dst ,bytes_read);
bool
TerminalState::ProcessGroupIsValid() const
{
- return m_process_group != -1;
+ return static_cast<int32_t>(m_process_group) != -1;
}
//------------------------------------------------------------------
"/usr/bin/lsb_release"
};
- for (int exe_index = 0;
+ for (size_t exe_index = 0;
exe_index < sizeof (exe_paths) / sizeof (exe_paths[0]);
++exe_index)
{
}
// Now extract all arguments
Args &proc_args = process_info.GetArguments();
- for (int i=0; i<argc; ++i)
+ for (int i=0; i<static_cast<int>(argc); ++i)
{
cstr = data.GetCStr(&offset);
if (cstr)
bool all_users = match_info.GetMatchAllUsers();
const lldb::pid_t our_pid = getpid();
const uid_t our_uid = getuid();
- for (int i = 0; i < actual_pid_count; i++)
+ for (size_t i = 0; i < actual_pid_count; i++)
{
const struct kinfo_proc &kinfo = kinfos[i];
kinfo_user_matches = true;
if (kinfo_user_matches == false || // Make sure the user is acceptable
- kinfo.kp_proc.p_pid == our_pid || // Skip this process
+ static_cast<lldb::pid_t>(kinfo.kp_proc.p_pid) == our_pid || // Skip this process
kinfo.kp_proc.p_pid == 0 || // Skip kernel (kernel pid is zero)
kinfo.kp_proc.p_stat == SZOMB || // Zombies are bad, they like brains...
kinfo.kp_proc.p_flag & P_TRACED || // Being debugged?
memset(buf, 0, 50);
sprintf(buf, "%sCount", prefix);
xpc_dictionary_set_int64(message, buf, count);
- for (int i=0; i<count; i++) {
+ for (size_t i=0; i<count; i++) {
memset(buf, 0, 50);
- sprintf(buf, "%s%i", prefix, i);
+ sprintf(buf, "%s%zi", prefix, i);
xpc_dictionary_set_string(message, buf, args.GetArgumentAtIndex(i));
}
}
// were passed. This will be useful when we come to restricting completions based on what other
// options we've seen on the line.
- if (OptionParser::GetOptionIndex() < dummy_vec.size() - 1
+ if (static_cast<size_t>(OptionParser::GetOptionIndex()) < dummy_vec.size() - 1
&& (strcmp (dummy_vec[OptionParser::GetOptionIndex()-1], "--") == 0))
{
dash_dash_pos = OptionParser::GetOptionIndex() - 1;
- if (OptionParser::GetOptionIndex() - 1 == cursor_index)
+ if (static_cast<size_t>(OptionParser::GetOptionIndex() - 1) == cursor_index)
{
option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, OptionParser::GetOptionIndex() - 1,
OptionArgElement::eBareDoubleDash));
// the option_element_vector, but only if it is not after the "--". But it turns out that OptionParser::Parse just ignores
// an isolated "-". So we have to look it up by hand here. We only care if it is AT the cursor position.
- if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos)
+ if ((static_cast<int32_t>(dash_dash_pos) == -1 || cursor_index < dash_dash_pos)
&& strcmp (GetArgumentAtIndex(cursor_index), "-") == 0)
{
option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDash, cursor_index,
int index = GetOptionArgumentPosition (value.c_str());
if (index == 0)
result_str.Printf ("%s", value.c_str());
- else if (index >= cmd_args.GetArgumentCount())
+ else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
{
result.AppendErrorWithFormat
}
}
- else if (index >= cmd_args.GetArgumentCount())
+ else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
{
result.AppendErrorWithFormat
("Not enough arguments provided; you need at least %d arguments to use this alias.\n",
CommandObject::CommandArgumentEntry *
CommandObject::GetArgumentEntryAtIndex (int idx)
{
- if (idx < m_arguments.size())
+ if (static_cast<size_t>(idx) < m_arguments.size())
return &(m_arguments[idx]);
return NULL;
size_t i;
for (i=0; i<argc; ++i)
{
- const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
+ const size_t idx =
+ Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
if (idx >= size)
{
all_indexes_valid = false;
// Will it all fit on one line?
- if ((len + strm.GetIndentLevel()) < output_max_columns)
+ if (static_cast<uint32_t>(len + strm.GetIndentLevel()) < output_max_columns)
{
// Output it as a single line.
strm.Indent (text);
{
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
if (!reg_ctx)
- return false;
-
+ return false;
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
+
if (log)
{
StreamString s;
(uint64_t)sp,
(uint64_t)func_addr,
(uint64_t)return_addr);
-
- for (int i = 0; i < args.size(); ++i)
+
+ for (size_t i = 0; i < args.size(); ++i)
s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]);
s.PutCString (")");
log->PutCString(s.GetString().c_str());
const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
const uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
const uint32_t ra_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
-
+
// x0 - x7 contain first 8 simple args
if (args.size() > 8) // TODO handle more than 6 arguments
return false;
-
- for (int i = 0; i < args.size(); ++i)
+
+ for (size_t i = 0; i < args.size(); ++i)
{
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
if (log)
// Set "lr" to the return address
if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (ra_reg_num), return_addr))
return false;
-
+
// Set "sp" to the requested value
if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (sp_reg_num), sp))
return false;
-
+
// Set "pc" to the address requested
if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (pc_reg_num), func_addr))
return false;
-
+
return true;
}
(uint64_t)func_addr,
(uint64_t)return_addr);
- for (int i = 0; i < args.size(); ++i)
- s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]);
+ for (size_t i = 0; i < args.size(); ++i)
+ s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
s.PutCString (")");
log->PutCString(s.GetString().c_str());
}
if (args.size() > 6) // TODO handle more than 6 arguments
return false;
- for (int i = 0; i < args.size(); ++i)
+ for (size_t i = 0; i < args.size(); ++i)
{
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
if (log)
- log->Printf("About to write arg%d (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
+ log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
return false;
}
if (abi->GetArgumentValues (exe_ctx.GetThreadRef(), argument_values))
{
uint32_t dyld_mode = argument_values.GetValueAtIndex(0)->GetScalar().UInt (-1);
- if (dyld_mode != -1)
+ if (dyld_mode != static_cast<uint32_t>(-1))
{
// Okay the mode was right, now get the number of elements, and the array of new elements...
uint32_t image_infos_count = argument_values.GetValueAtIndex(1)->GetScalar().UInt (-1);
- if (image_infos_count != -1)
+ if (image_infos_count != static_cast<uint32_t>(-1))
{
// Got the number added, now go through the array of added elements, putting out the mach header
// address, and adding the image.
size_t dst_len) const
{
lldb::offset_t file_size = section->GetFileSize();
- if (section_offset < file_size)
+ if (section_offset < static_cast<off_t>(file_size))
{
uint64_t src_len = file_size - section_offset;
if (src_len > dst_len)
Error err;
uint32_t version_or_magic = process->ReadUnsignedIntegerFromMemory (all_image_infos, 4, -1, err);
- if (version_or_magic != -1
+ if (version_or_magic != static_cast<uint32_t>(-1)
&& version_or_magic != MH_MAGIC
&& version_or_magic != MH_CIGAM
&& version_or_magic != MH_MAGIC_64
if (envp == NULL || envp[0] == NULL)
envp = const_cast<const char **>(environ);
- if ((pid = terminal.Fork(err_str, err_len)) == -1)
+ if ((pid = terminal.Fork(err_str, err_len)) == static_cast<lldb::pid_t>(-1))
{
args->m_error.SetErrorToGenericError();
args->m_error.SetErrorString("Process fork failed.");
}
// Wait for the child process to to trap on its call to execve.
- pid_t wpid;
+ lldb::pid_t wpid;
int status;
if ((wpid = waitpid(pid, &status, 0)) < 0)
{
if (log)
log->Printf ("ProcessMonitor::%s(bp) waitpid, pid = %" PRIu64 ", status = %d", __FUNCTION__, wait_pid, status);
- if (wait_pid == -1)
+ if (wait_pid == static_cast<lldb::pid_t>(-1))
{
// If we got interrupted by a signal (in our process, not the
// inferior) try again.
reg_info.encoding = (Encoding)reg_info_dict.GetItemForKeyAsInteger (encoding_pystr, eEncodingUint);
const int64_t set = reg_info_dict.GetItemForKeyAsInteger(set_pystr, -1);
- if (set >= m_sets.size())
+ if (static_cast<size_t>(set) >= m_sets.size())
{
Clear();
return 0;
if (invalidate_reg_num)
{
const int64_t r = invalidate_reg_num.GetInteger();
- if (r != UINT64_MAX)
+ if (r != static_cast<int64_t>(UINT64_MAX))
m_invalidate_regs_map[i].push_back(r);
else
printf("error: 'invalidate-regs' list value wasn't a valid integer\n");
UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_reg)
{
int64_t frame_num = starting_frame_num;
- if (frame_num >= m_frames.size())
+ if (static_cast<size_t>(frame_num) >= m_frames.size())
return false;
// Never interrogate more than one level while looking for the saved pc value. If the value
else
{
const uint32_t mode = response.GetS32(-1);
- if (mode == -1)
+ if (static_cast<int32_t>(mode) == -1)
{
if (response.GetChar() == ',')
{
size_including_slice_registers += reg_info->byte_size;
if (reg_info->value_regs == NULL)
size_not_including_slice_registers += reg_info->byte_size;
- if (reg_info->byte_offset >= size_by_highest_offset)
+ if (static_cast<off_t>(reg_info->byte_offset) >= size_by_highest_offset)
size_by_highest_offset = reg_info->byte_offset + reg_info->byte_size;
}
bool use_byte_offset_into_buffer;
- if (size_by_highest_offset == restore_data.GetByteSize())
+ if (static_cast<size_t>(size_by_highest_offset) == restore_data.GetByteSize())
{
// The size of the packet agrees with the highest offset: + size in the register file
use_byte_offset_into_buffer = true;
}
- else if (size_not_including_slice_registers == restore_data.GetByteSize())
+ else if (static_cast<size_t>(size_not_including_slice_registers) == restore_data.GetByteSize())
{
// The size of the packet is the same as concenating all of the registers sequentially,
// skipping the slice registers
use_byte_offset_into_buffer = true;
}
- else if (size_including_slice_registers == restore_data.GetByteSize())
+ else if (static_cast<size_t>(size_including_slice_registers) == restore_data.GetByteSize())
{
// The slice registers are present in the packet (when they shouldn't be).
// Don't try to use the RegisterInfo byte_offset into the restore_data, it will
// as a multiple of LEB128 operands for each opcode.
{
uint8_t i;
- assert (opcode - 1 < prologue->standard_opcode_lengths.size());
+ assert (static_cast<size_t>(opcode - 1) < prologue->standard_opcode_lengths.size());
const uint8_t opcode_length = prologue->standard_opcode_lengths[opcode - 1];
for (i=0; i<opcode_length; ++i)
debug_line_data.Skip_LEB128(offset_ptr);
pending_item_refs.new_style = true;
uint32_t item_size = extractor.GetU32(&offset);
uint32_t start_of_array_offset = offset;
- while (offset < pending_items_pointer.items_buffer_size && i < pending_items_pointer.count)
+ while (offset < pending_items_pointer.items_buffer_size &&
+ static_cast<size_t>(i) < pending_items_pointer.count)
{
offset = start_of_array_offset + (i * item_size);
ItemRefAndCodeAddress item;
{
offset = 0;
pending_item_refs.new_style = false;
- while (offset < pending_items_pointer.items_buffer_size && i < pending_items_pointer.count)
+ while (offset < pending_items_pointer.items_buffer_size &&
+ static_cast<size_t>(i) < pending_items_pointer.count)
{
ItemRefAndCodeAddress item;
item.item_ref = extractor.GetPointer (&offset);
const bool prefer_file_cache = true;
Error error;
Target *target = m_exe_ctx.GetTargetPtr();
- if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(), max_op_byte_size, error) == -1)
+ if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(),
+ max_op_byte_size, error) == static_cast<size_t>(-1))
{
return false;
}
// An unrecognized/junk instruction
break;
}
- if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
+ if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes,
+ insn_len, error) == static_cast<size_t>(-1))
{
// Error reading the instruction out of the file, stop scanning
break;
bool need_to_push_row = false;
// the PUSH instruction has moved the stack pointer - if the CFA is set in terms of the stack pointer,
// we need to add a new row of instructions.
- if (row->GetCFARegister() == m_lldb_sp_regnum)
+ if (row->GetCFARegister() == static_cast<uint32_t>(m_lldb_sp_regnum))
{
need_to_push_row = true;
row->SetCFAOffset (current_sp_bytes_offset_from_cfa);
if (sub_rsp_pattern_p (stack_offset))
{
current_sp_bytes_offset_from_cfa += stack_offset;
- if (row->GetCFARegister() == m_lldb_sp_regnum)
+ if (row->GetCFARegister() == static_cast<uint32_t>(m_lldb_sp_regnum))
{
row->SetOffset (current_func_text_offset + insn_len);
row->SetCFAOffset (current_sp_bytes_offset_from_cfa);
uint8_t bytebuf[7];
Address last_seven_bytes(end_of_fun);
last_seven_bytes.SetOffset (last_seven_bytes.GetOffset() - 7);
- if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7, error) != -1)
+ if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7,
+ error) != static_cast<size_t>(-1))
{
if (bytebuf[5] == 0x5d && bytebuf[6] == 0xc3) // mov, ret
{
uint8_t bytebuf[2];
Address last_two_bytes(end_of_fun);
last_two_bytes.SetOffset (last_two_bytes.GetOffset() - 2);
- if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2, error) != -1)
+ if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2,
+ error) != static_cast<size_t>(-1))
{
if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3) // mov, ret
{
uint8_t bytebuf[4];
Error error;
const bool prefer_file_cache = true;
- if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, sizeof (bytebuf), error) == -1)
+ if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf,
+ sizeof (bytebuf), error) == static_cast<size_t>(-1))
return false;
uint8_t i386_prologue[] = {0x55, 0x89, 0xe5};
// An error parsing the instruction, i.e. probably data/garbage - stop scanning
break;
}
- if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
+ if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes,
+ insn_len, error) == static_cast<size_t>(-1))
{
// Error reading the instruction out of the file, stop scanning
break;
// Setting this to UINT32_MAX to make sure we don't compute it twice...
bit_offset = UINT32_MAX;
- if (child_byte_offset == LLDB_INVALID_IVAR_OFFSET)
+ if (child_byte_offset == static_cast<int32_t>(LLDB_INVALID_IVAR_OFFSET))
{
bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
child_byte_offset = bit_offset / 8;
else
{
const uint64_t section_file_size = section->GetFileSize();
- if (section_offset < section_file_size)
+ if (section_offset < static_cast<off_t>(section_file_size))
{
const uint64_t section_bytes_left = section_file_size - section_offset;
uint64_t section_dst_len = dst_len;
collection::const_iterator pos, end = m_row_list.end();
for (pos = m_row_list.begin(); pos != end; ++pos)
{
- if ((*pos)->GetOffset() <= offset)
+ if ((*pos)->GetOffset() <= static_cast<lldb::offset_t>(offset))
row = *pos;
else
break;
bool
PathMappingList::Remove (off_t index, bool notify)
{
- if (index >= m_pairs.size())
+ if (static_cast<size_t>(index) >= m_pairs.size())
return false;
++m_mod_id;
}
else
{
- if (pair_index < numPairs)
+ if (static_cast<unsigned int>(pair_index) < numPairs)
s->Printf("%s -> %s",
m_pairs[pair_index].first.GetCString(), m_pairs[pair_index].second.GetCString());
}
valobj_sp->GetTypeName().AsCString("<invalid type>"),
var_expr_path_strm.GetString().c_str());
}
- else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
+ else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
{
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
var_expr_path_strm.GetString().c_str());
}
- else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
+ else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
{
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"",
{
lldb::addr_t pc = reg_ctx_sp->GetPC();
BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc);
- if (bp_site_sp && value == bp_site_sp->GetID())
+ if (bp_site_sp &&
+ static_cast<break_id_t>(value) == bp_site_sp->GetID())
return true;
}
}
size_t version_len = sizeof(g_version_string);
- if (newline_loc && (newline_loc - version_string < version_len))
+ if (newline_loc &&
+ (newline_loc - version_string < static_cast<ptrdiff_t>(version_len)))
version_len = newline_loc - version_string;
::strncpy(g_version_string, version_string, version_len);