summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-02-19 08:12:41 +0000
committerPavel Labath <pavel@labath.sk>2019-02-19 08:12:41 +0000
commiteebf32fad62eb1e6972df8d1809aaebf457ab477 (patch)
tree162806eb0ffa31a09acd88e2acf9e5cea3a616eb
parentb7fbfa68779a3f96c6cc933aba3cafb91f3a37ef (diff)
downloadbcm5719-llvm-eebf32fad62eb1e6972df8d1809aaebf457ab477.tar.gz
bcm5719-llvm-eebf32fad62eb1e6972df8d1809aaebf457ab477.zip
[gui] Simplify SourceFileWindowDelegate::WindowDelegateDraw
instead of printf-ing into a buffer, and them using that buffer as a format string, simply use the appropriate indirect format string. This also fixes a -Wformat-truncation warning with gcc. llvm-svn: 354307
-rw-r--r--lldb/source/Core/IOHandler.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index f90984e151e..1e647bb884e 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -3929,12 +3929,10 @@ public:
m_debugger.GetSourceManager().GetFile(m_sc.line_entry.file);
if (m_file_sp) {
const size_t num_lines = m_file_sp->GetNumLines();
- int m_line_width = 1;
+ m_line_width = 1;
for (size_t n = num_lines; n >= 10; n = n / 10)
++m_line_width;
- snprintf(m_line_format, sizeof(m_line_format), " %%%iu ",
- m_line_width);
if (num_lines < num_visible_lines ||
m_selected_line < num_visible_lines)
m_first_visible_line = 0;
@@ -4051,7 +4049,7 @@ public:
if (bp_attr)
window.AttributeOn(bp_attr);
- window.Printf(m_line_format, curr_line + 1);
+ window.Printf(" %*u ", m_line_width, curr_line + 1);
if (bp_attr)
window.AttributeOff(bp_attr);
@@ -4477,7 +4475,6 @@ protected:
AddressRange m_disassembly_range;
StreamString m_title;
lldb::user_id_t m_tid;
- char m_line_format[8];
int m_line_width;
uint32_t m_selected_line; // The selected line
uint32_t m_pc_line; // The line with the PC
OpenPOWER on IntegriCloud