mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Fix a bunch of warnings from clang.
This commit is contained in:
@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include "compile.h"
|
||||
@ -139,7 +138,7 @@ void PythonInterface::finiPython()
|
||||
//
|
||||
// PURPOSE : run a python string in a specific module name
|
||||
//
|
||||
PyObject* PythonInterface::CompileString(char *command, char* filename)
|
||||
PyObject* PythonInterface::CompileString(const char *command, const char* filename)
|
||||
{
|
||||
PyObject* pycode = Py_CompileString(command, filename, Py_file_input);
|
||||
return pycode;
|
||||
@ -220,7 +219,7 @@ int PythonInterface::getOutputAndReset(char** line)
|
||||
//
|
||||
// PURPOSE : create a new module with built-ins
|
||||
//
|
||||
PyObject* PythonInterface::CreateModule(char* module)
|
||||
PyObject* PythonInterface::CreateModule(const char* module)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
// first we must get rid of any old modules of the same name, we'll replace it
|
||||
@ -291,7 +290,7 @@ hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module)
|
||||
//
|
||||
// PURPOSE : get an item (probably a function) from a specific module
|
||||
//
|
||||
PyObject* PythonInterface::GetModuleItem(char* item, PyObject* module)
|
||||
PyObject* PythonInterface::GetModuleItem(const char* item, PyObject* module)
|
||||
{
|
||||
if ( module )
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "Python.h"
|
||||
#include <Python.h>
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -50,10 +51,10 @@ namespace PythonInterface
|
||||
// So the Python packer can add extra paths
|
||||
void addPythonPath(std::string dir);
|
||||
|
||||
PyObject* CompileString(char *command, char* filename);
|
||||
PyObject* CompileString(const char *command, const char* filename);
|
||||
hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size);
|
||||
int getOutputAndReset(char** line=nil);
|
||||
PyObject* CreateModule(char* module);
|
||||
PyObject* CreateModule(const char* module);
|
||||
hsBool RunPYC(PyObject* code, PyObject* module);
|
||||
PyObject* GetModuleItem(char* item, PyObject* module);
|
||||
PyObject* GetModuleItem(const char* item, PyObject* module);
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
#include "plFile/hsFiles.h"
|
||||
|
||||
#include "PythonInterface.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
@ -123,14 +123,14 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
}
|
||||
|
||||
// import the module first, to make packages work correctly
|
||||
PyImport_ImportModule((char*)fileName.c_str());
|
||||
PyObject* pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str());
|
||||
PyImport_ImportModule(fileName.c_str());
|
||||
PyObject* pythonCode = PythonInterface::CompileString(code, fileName.c_str());
|
||||
if (pythonCode)
|
||||
{
|
||||
// we need to find out if this is PythonFile module
|
||||
// create a module name... with the '.' as an X
|
||||
// and create a python file name that is without the ".py"
|
||||
PyObject* fModule = PythonInterface::CreateModule((char*)fileName.c_str());
|
||||
PyObject* fModule = PythonInterface::CreateModule(fileName.c_str());
|
||||
// run the code
|
||||
if (PythonInterface::RunPYC(pythonCode, fModule) )
|
||||
{
|
||||
@ -166,7 +166,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
// else
|
||||
// skip the CRs
|
||||
}
|
||||
pythonCode = PythonInterface::CompileString(code, (char*)fileName.c_str());
|
||||
pythonCode = PythonInterface::CompileString(code, fileName.c_str());
|
||||
hsAssert(pythonCode,"Not sure why this didn't compile the second time???");
|
||||
printf("an import file ");
|
||||
}
|
||||
@ -181,8 +181,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("\n");
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,8 +199,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("\n");
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
s->WriteLE32(size);
|
||||
s->Write(size, pycode);
|
||||
@ -218,7 +216,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
int chars_read = PythonInterface::getOutputAndReset(&errmsg);
|
||||
if (chars_read > 0)
|
||||
{
|
||||
printf(errmsg);
|
||||
printf("%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user