get rid of annoying warning :

deprecated conversion from string constant to char*
still one occurrence of this warning, but I don't know how to treat
it between C++ and Python C API.
This commit is contained in:
Christophe Alexandre 2008-11-18 11:54:01 +00:00
parent 6d3904c0e2
commit 40e00bd4de
2 changed files with 19 additions and 19 deletions

View File

@ -131,7 +131,7 @@ using namespace Hurricane;
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
char* ConverterState::ObjectType::_inheritStop const char* ConverterState::ObjectType::_inheritStop
= "comp"; = "comp";
ConverterState __cs = ConverterState (); ConverterState __cs = ConverterState ();
int __objectOffset = offsetof ( PyPoint, _object ); int __objectOffset = offsetof ( PyPoint, _object );
@ -200,11 +200,11 @@ using namespace Hurricane;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Method : "::ConverterState::addType ()" // Method : "::ConverterState::addType ()"
void ConverterState::addType ( char* id void ConverterState::addType ( const char* id
, PyTypeObject* pyType , PyTypeObject* pyType
, char* name , const char* name
, bool isPythonType , bool isPythonType
, char* idBase ) { , const char* idBase ) {
for ( unsigned i=0 ; i < _types.size() ; i++ ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ! strcmp ( _types[i]->_id, id ) ) if ( ! strcmp ( _types[i]->_id, id ) )
throw Error ( objectTypeRedefinition ); throw Error ( objectTypeRedefinition );
@ -259,7 +259,7 @@ using namespace Hurricane;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Method : "::ConverterState::getObjectId ()" // Method : "::ConverterState::getObjectId ()"
char* ConverterState::getObjectId ( PyObject* object ) { const char* ConverterState::getObjectId ( PyObject* object ) const {
for ( unsigned i=0 ; i < _types.size() ; i++ ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ( ! strcmp ( _types[i]->_id, "function" ) ) && ( PyCallable_Check(object) ) ) if ( ( ! strcmp ( _types[i]->_id, "function" ) ) && ( PyCallable_Check(object) ) )
return ( _types[i]->_id ); return ( _types[i]->_id );
@ -290,7 +290,7 @@ using namespace Hurricane;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Method : "::ConverterState::getObjectName ()" // Method : "::ConverterState::getObjectName ()"
char *ConverterState::getObjectName ( string id ) { const char *ConverterState::getObjectName ( string id ) const {
for ( unsigned i=0 ; i < _types.size() ; i++ ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ! strcmp ( id.c_str(), _types[i]->_id ) ) return ( _types[i]->_name ); if ( ! strcmp ( id.c_str(), _types[i]->_id ) ) return ( _types[i]->_name );
} }
@ -303,7 +303,7 @@ using namespace Hurricane;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Method : "::ConverterState::init ()" // Method : "::ConverterState::init ()"
void ConverterState::init ( char* function, char* inheritStop ) { void ConverterState::init ( const char* function, const char* inheritStop ) {
_objectIds = ""; _objectIds = "";
setFunction ( function ); setFunction ( function );
ObjectType::_inheritStop = inheritStop; ObjectType::_inheritStop = inheritStop;

View File

@ -82,11 +82,11 @@ using namespace std;
public: public:
struct ObjectType { struct ObjectType {
static char* _inheritStop; static const char* _inheritStop;
char _id [11]; char _id [11];
char _idBase[11]; char _idBase[11];
PyTypeObject* _pyType; PyTypeObject* _pyType;
char* _name; const char* _name;
bool _isPythonType; bool _isPythonType;
unsigned _index; unsigned _index;
@ -99,7 +99,7 @@ using namespace std;
typedef vector<ObjectType*> ObjectTypeVector; typedef vector<ObjectType*> ObjectTypeVector;
protected: string _objectIds; protected: string _objectIds;
protected: char* _function; protected: const char* _function;
protected: ObjectTypeVector _types; protected: ObjectTypeVector _types;
@ -110,17 +110,17 @@ using namespace std;
public: ~ConverterState (); public: ~ConverterState ();
public: ObjectType* getObject ( char* id ); public: ObjectType* getObject ( char* id );
public: char* getObjectId ( PyObject* object ); public: const char* getObjectId ( PyObject* object ) const;
public: char* getObjectName ( string id ); public: const char* getObjectName ( string id ) const;
public: string getObjectIds () const { return ( _objectIds ); }; public: string getObjectIds () const { return ( _objectIds ); };
public: char* getFunction () const { return ( _function ); }; public: const char* getFunction () const { return ( _function ); };
public: int getSize () const { return ( _objectIds.size() ); }; public: int getSize () const { return ( _objectIds.size() ); };
public: const ObjectTypeVector& getTypes () const { return ( _types ); }; public: const ObjectTypeVector& getTypes () const { return ( _types ); };
public: void addObject ( PyObject* object ) { _objectIds += getObjectId ( object ); }; public: void addObject ( PyObject* object ) { _objectIds += getObjectId ( object ); };
public: void addId ( char* id ) { _objectIds += ":"; _objectIds += id; }; public: void addId ( char* id ) { _objectIds += ":"; _objectIds += id; };
public: void setFunction ( char* function ) { _function = function; }; public: void setFunction ( const char* function ) { _function = function; };
public: void init ( char* function, char* inheritStop="comp" ); public: void init ( const char* function, const char* inheritStop="comp" );
public: void addType ( char* id, PyTypeObject* pyType, char* name, bool isPythonType, char* idBase="" ); public: void addType ( const char* id, PyTypeObject* pyType, const char* name, bool isPythonType, const char* idBase="" );
public: static string getObjectType ( string objectsTypes, unsigned n ); public: static string getObjectType ( string objectsTypes, unsigned n );
}; };
@ -131,9 +131,9 @@ using namespace std;
// Isobar Global Functions. // Isobar Global Functions.
int Converter ( PyObject* object, void** pArg ); int Converter ( PyObject* object, void** pArg );
bool ParseOneArg ( char* function, PyObject* args, string format, PyObject** arg ); bool ParseOneArg ( const char* function, PyObject* args, string format, PyObject** arg );
bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ); bool ParseTwoArg ( const char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 );
bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ); bool ParseThreeArg ( const char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 );