diff options
author | Vince Harron <vince@nethacker.com> | 2015-05-13 00:25:54 +0000 |
---|---|---|
committer | Vince Harron <vince@nethacker.com> | 2015-05-13 00:25:54 +0000 |
commit | d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975 (patch) | |
tree | 329d2a720739a7140401e3842b751aa7f0651c93 /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
parent | 9bbc3653c5ccb170167b2ab3c4ec098be83a3d04 (diff) | |
download | bcm5719-llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.tar.gz bcm5719-llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.zip |
Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.
Differential Revision: http://reviews.llvm.org/D9674
llvm-svn: 237218
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 7ecef310b5c..1baf484cc79 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -382,6 +382,13 @@ ScriptInterpreterPython::LeaveSession () m_session_is_active = false; } +static PyObject * +PyFile_FromFile_Const(FILE *fp, const char *name, const char *mode, int (*close)(FILE *)) +{ + // Read through the Python source, doesn't seem to modify these strings + return PyFile_FromFile(fp, const_cast<char*>(name), const_cast<char*>(mode), close); +} + bool ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags, FILE *in, @@ -447,7 +454,7 @@ ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags, { m_saved_stdin.Reset(sys_module_dict.GetItemForKey("stdin")); // This call can deadlock your process if the file is locked - PyObject *new_file = PyFile_FromFile (in, (char *) "", (char *) "r", nullptr); + PyObject *new_file = PyFile_FromFile_Const (in, "", "r", nullptr); sys_module_dict.SetItemForKey ("stdin", new_file); Py_DECREF (new_file); } @@ -459,7 +466,7 @@ ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags, { m_saved_stdout.Reset(sys_module_dict.GetItemForKey("stdout")); - PyObject *new_file = PyFile_FromFile (out, (char *) "", (char *) "w", nullptr); + PyObject *new_file = PyFile_FromFile_Const (out, "", "w", nullptr); sys_module_dict.SetItemForKey ("stdout", new_file); Py_DECREF (new_file); } @@ -472,7 +479,7 @@ ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags, { m_saved_stderr.Reset(sys_module_dict.GetItemForKey("stderr")); - PyObject *new_file = PyFile_FromFile (err, (char *) "", (char *) "w", nullptr); + PyObject *new_file = PyFile_FromFile_Const (err, "", "w", nullptr); sys_module_dict.SetItemForKey ("stderr", new_file); Py_DECREF (new_file); } |