~ubuntu-branches/ubuntu/hardy/swig1.3/hardy

« back to all changes in this revision

Viewing changes to Lib/python/pystdcommon.swg

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
      if (val) {
79
79
        Type *p = 0;
80
80
        int res = traits_asptr<Type>::asptr(obj, &p);
81
 
        if (res && p) {
 
81
        if ((res != 0) && p) {
82
82
          typedef typename noconst_traits<Type>::noconst_type noconst_type;
83
83
          *(const_cast<noconst_type*>(val)) = *p;
84
84
          if (res == SWIG_NEWOBJ) delete p;
87
87
          return false;
88
88
        }
89
89
      } else {
90
 
        return traits_asptr<Type>::asptr(obj, (Type **)(0));
 
90
        return traits_asptr<Type>::asptr(obj, (Type **)(0)) ? true : false;
91
91
      }
92
92
    }
93
93
  };
105
105
          return false;
106
106
        }
107
107
      } else {
108
 
        return traits_asptr<Type>::asptr(obj, (Type **)(0));
 
108
        return traits_asptr<Type>::asptr(obj, (Type **)(0)) ? true : false;
109
109
      }
110
110
    }
111
111
  };
112
112
  
113
113
  template <class Type>
114
114
  inline bool asval(PyObject *obj, Type *val) {
115
 
    return traits_asval<Type>::asval(obj, val);
 
115
    return traits_asval<Type>::asval(obj, val) ? true : false;
116
116
  }
117
117
 
118
118
  template <class Type> 
133
133
  struct traits_as<Type, pointer_category> {
134
134
    static Type as(PyObject *obj, bool throw_error) {
135
135
      Type *v = 0;      
136
 
      int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0) && v;
137
 
      if (res) {
 
136
      int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0);
 
137
      if (res && v) {
138
138
        if (res == SWIG_NEWOBJ) {
139
139
          Type r(*v);
140
140
          delete v;