Commit 96b01f23 authored by Anne Gunn's avatar Anne Gunn
Browse files

T2345: Walking back nullptr changes to lib/awpmd

parent ed57554e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public:
  
  message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, 
                 int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0)
    :descriptor(descriptor_),prev(nullptr),next(nullptr){
    :descriptor(descriptor_),prev(NULL),next(NULL){
    set_throw(throw_exceptions);
    set_levels(out_level,stop_level);
    extra_levels(0,0);
@@ -157,8 +157,8 @@ public:
        return -1; 
      glogp=prev;
      if(glogp)
        glogp->next=nullptr;
      prev=nullptr;
        glogp->next=NULL;
      prev=NULL;
    }
    return 1;
  }
@@ -244,7 +244,7 @@ public:
                  FILE *out=stdout, FILE *err=stderr, 
                  int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL,
                  int use_globally=0)
                  : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){
                  : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){
    set_out(out);
    set_err(err);
  }
+14 −14
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public:
  public:
    iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
    }
    iterator():ptr(nullptr),incr(0){}
    iterator():ptr(NULL),incr(0){}
    iterator &operator++(){ // prefix
      ptr+=incr;
      return *this;
@@ -173,13 +173,13 @@ public:
  size_t sizex, sizey;

  //e default constructor
  recmatrix(): parr(nullptr,1) {
  recmatrix(): parr(NULL,1) {
    sizey=sizex=0;
    arr=nullptr;
    arr=NULL;
  }

  //e copy constructor: makes a managed copy
  recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){
  recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){
    *this=other;
  }

@@ -222,7 +222,7 @@ public:
  virtual int init(size_t nx, size_t ny, int smanaged=-1){
    int managed=parr.managed();
    if(managed && (sizex!=nx || sizey!=ny)){
      parr.reset(nullptr,0);
      parr.reset(NULL,0);
    }
    if(smanaged>=0){ // for changing the managed flag?
      parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0  );
@@ -355,7 +355,7 @@ public:
  public:
    iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
    }
    iterator():ptr(nullptr),incr(0){}
    iterator():ptr(NULL),incr(0){}
    iterator &operator++(){ // prefix
      ptr+=incr;
      return *this;
@@ -382,13 +382,13 @@ public:
  size_t size;

  //e default constructor
  sqmatrix(): parr(nullptr,1) {
  sqmatrix(): parr(NULL,1) {
    size=0;
    arr=nullptr;
    arr=NULL;
  }

  //e copy constructor: makes a managed copy
  sqmatrix(const sqmatrix &other):size(0),arr(nullptr){
  sqmatrix(const sqmatrix &other):size(0),arr(NULL){
    *this=other;
  }

@@ -430,7 +430,7 @@ public:
  virtual int init(size_t n, int smanaged=-1){
    int managed=parr.managed();
    if(managed && size!=n){
      parr.reset(nullptr,0);
      parr.reset(NULL,0);
    }
    if(smanaged>=0){ // for changing the managed flag?
      parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0  );
@@ -600,9 +600,9 @@ class PairHash{
public:
  //e find the value with indexes i, j
  //e @return 0 if not found, 1 otherwise
  //e if retval is not nullptr, puts the found value there
  virtual int Find(long i, long j, T *retval=nullptr)=0;
  virtual int Find(long i, long j, T **retval=nullptr)=0;
  //e if retval is not NULL, puts the found value there
  virtual int Find(long i, long j, T *retval=NULL)=0;
  virtual int Find(long i, long j, T **retval=NULL)=0;
  virtual int Del(long i, long j)=0;
  virtual int Put(long i, long j, const T *value)=0;
  virtual int Put(long i, long j, const T& value)=0;
@@ -621,7 +621,7 @@ public:
    indm.Set(-1);
    arr= new T[n*(n+1)/2];
  }
  int Find(long i, long j, T *retval=nullptr){
  int Find(long i, long j, T *retval=NULL){
    long ind=indm(i,j);
    if(ind>=0){
      if(retval){
+10 −10
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public:
  using base_t::second;
  using base_t::first;

  mngptr(T* ptr=nullptr, int managed=0): pair<T*,int>(ptr,managed){
  mngptr(T* ptr=NULL, int managed=0): pair<T*,int>(ptr,managed){
    //if(managed==2)ptr= new T(*ptr);
  }
  mngptr(const mngarg<T> &arg): pair<T*,int>(arg.first,arg.second){}
@@ -166,7 +166,7 @@ public:
    reset(arg.first,arg.second);
    return *this;
  }
  void reset(T* ptr=nullptr, int managed=0){
  void reset(T* ptr=NULL, int managed=0){
    if(second && first && first!=ptr){
      if(second&0x8)delete [] first;
      else delete first;
@@ -313,7 +313,7 @@ template<class T, class delete_t=delete_ptr<T> >
class shptr{
  template<class Y, class Z> friend class shptr;
  T *p;
  int *num; //if num==nullptr than p is not managed (as in mngptr)
  int *num; //if num==NULL than p is not managed (as in mngptr)

  void set(T *p_, int managed){
    p=p_;
@@ -321,7 +321,7 @@ class shptr{
      num=new int;
      *num=1;
    }
    else num=nullptr;
    else num=NULL;
  }
  template<class Y>
  void set(const Y &other){
@@ -330,7 +330,7 @@ class shptr{
      num=other.num;
      if(num)(*num)++;
    }
    else num=nullptr;
    else num=NULL;
  }
  void set(const shptr &other){
    p=other.p;
@@ -338,11 +338,11 @@ class shptr{
      num=other.num;
      if(num)(*num)++;
    }
    else num=nullptr;
    else num=NULL;
  }

public:
  shptr(T* p=nullptr, int managed=1){
  shptr(T* p=NULL, int managed=1){
    set(p,managed);
  }
  shptr(const mngarg<T> &arg){
@@ -398,14 +398,14 @@ public:
          delete_t()(p);
          delete num;
        }
        num=nullptr;
        num=NULL;
      }
      p=nullptr;
      p=NULL;
    }
  }

  bool valid() const {
    return p!=nullptr;
    return p!=NULL;
  }

  T* ptr() const {
+7 −7
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ struct Vector_Nt {
  }


  T maxcoord(int *ind=nullptr) const {
  T maxcoord(int *ind=NULL) const {
    int im=0;
    T vv=v[0];
    for (int i=1; i<N; i++) {
@@ -389,7 +389,7 @@ struct Vector_Nt {


  //e returns the corrd having maximal absolute value
  T maxabscoord(int *ind=nullptr) const {
  T maxabscoord(int *ind=NULL) const {
    int im=0;
    T vv=fabs(v[0]);
    for (int i=1; i<N; i++) {
@@ -403,7 +403,7 @@ struct Vector_Nt {
  }

  //e returns the corrd having minimal absolute value
  T minabscoord(int *ind=nullptr) const {
  T minabscoord(int *ind=NULL) const {
    int im=0;
    T vv=fabs(v[0]);
    for (int i=1; i<N; i++) {
@@ -417,7 +417,7 @@ struct Vector_Nt {
  }


  T mincoord(int *ind=nullptr) const {
  T mincoord(int *ind=NULL) const {
    int im=0;
    T vv=v[0];
    for (int i=1; i<N; i++) {
@@ -485,7 +485,7 @@ vec_type dist_av(Vector_3 *va1,Vector_3 *va2,int n);

//e finds the average difference norm between two vector sets of the same length
/*e optionally gives the indexes for maximal and minimal difference
 va2 can be nullptr, then the norm of va1 is used */
 va2 can be NULL, then the norm of va1 is used */

vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0);

@@ -615,9 +615,9 @@ inline Vector_3 randdir(){

///\en Calculates extent of the vector container.
///    \return the center of the vector set, optionally
///    (if arguments are not nullptr) fills the bounding box in \a box_min, \a box_max.
///    (if arguments are not NULL) fills the bounding box in \a box_min, \a box_max.
template<class vec_inp_it>
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){
  if(beg==end)
    return Vector_3();
  Vector_3 center(*beg++);
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ message_logger &message_logger::global(){
  return *glogp;
}

message_logger *message_logger::glogp=nullptr;
message_logger *message_logger::glogp=NULL;
stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1);

const char *logfmt(const char *format,...){
Loading