diff options
| author | Jim Ingham <jingham@apple.com> | 2012-12-15 02:40:54 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2012-12-15 02:40:54 +0000 |
| commit | 17fafa155cc4e6e8170c149ee20ef5ac685ee918 (patch) | |
| tree | e5586c8d436909e2b6072e203e481f9eb56a74ae /lldb/source/Interpreter/CommandReturnObject.cpp | |
| parent | 2e1f745da77279d3e06822ffa3484ad325810874 (diff) | |
| download | bcm5719-llvm-17fafa155cc4e6e8170c149ee20ef5ac685ee918.tar.gz bcm5719-llvm-17fafa155cc4e6e8170c149ee20ef5ac685ee918.zip | |
Remove the “len” defaulted parameter from CommandReturnObject::AppendMessage, AppendWarning and AppendError. Nobody was using them, and it meant if you accidentally used the AppendWarning when you meant AppendWarningWithFormat with an integer in the format string, it would compile and then return your string plus some unknown amount of junk.
llvm-svn: 170266
Diffstat (limited to 'lldb/source/Interpreter/CommandReturnObject.cpp')
| -rw-r--r-- | lldb/source/Interpreter/CommandReturnObject.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index 896ad2b7e84..c7ab8a988d7 100644 --- a/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/lldb/source/Interpreter/CommandReturnObject.cpp @@ -104,24 +104,19 @@ CommandReturnObject::AppendWarningWithFormat (const char *format, ...) } void -CommandReturnObject::AppendMessage (const char *in_string, int len) +CommandReturnObject::AppendMessage (const char *in_string) { - if (!in_string || len == 0) + if (!in_string || *in_string == '\0') return; - if (len < 0) - GetOutputStream().Printf("%s\n", in_string); - else - GetOutputStream().Printf("%*.*s\n", len, len, in_string); + GetOutputStream().Printf("%s\n", in_string); } void -CommandReturnObject::AppendWarning (const char *in_string, int len) +CommandReturnObject::AppendWarning (const char *in_string) { - if (!in_string) + if (!in_string || *in_string == '\0') return; - if (len < 0) - len = ::strlen (in_string); - GetErrorStream().Printf("warning: %*.*s\n", len, len, in_string); + GetErrorStream().Printf("warning: %s\n", in_string); } // Similar to AppendWarning, but do not prepend 'warning: ' to message, and @@ -138,13 +133,11 @@ CommandReturnObject::AppendRawWarning (const char *in_string, int len) } void -CommandReturnObject::AppendError (const char *in_string, int len) +CommandReturnObject::AppendError (const char *in_string) { - if (!in_string) + if (!in_string || *in_string == '\0') return; - if (len < 0) - len = ::strlen (in_string); - GetErrorStream().Printf ("error: %*.*s\n", len, len, in_string); + GetErrorStream().Printf ("error: %s\n", in_string); } void |

