Changeset 827 in Sophya for trunk/SophyaLib/BaseTools/dvlist.h


Ignore:
Timestamp:
Apr 6, 2000, 6:39:00 PM (25 years ago)
Author:
ansari
Message:

Suppression de warning compil dvlist (format printf) - Reza 6/4/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/dvlist.h

    r754 r827  
    2525  int_8 iv;
    2626  r_8 dv;
    27   char strv[31];
     27  char strv[39];
    2828  } mtv;
    2929  char typ;
     
    3232
    3333  inline MuTyV() { typ = 'I'; mtv.iv = 0;  mtv.dv = 0.;  mtv.strv[0] ='\0'; }
     34  inline MuTyV(MuTyV const & a) { typ = a.typ; mtv = a.mtv; }
    3435  inline MuTyV(int_4 i) { typ = 'I'; mtv.iv = (int_8)i; mtv.dv = 0.;  mtv.strv[0] ='\0'; }
    3536  inline MuTyV(int_8 i) { typ = 'I'; mtv.iv = i; mtv.dv = 0.;  mtv.strv[0] ='\0'; }
    3637  inline MuTyV(r_4 f) { typ = 'D'; mtv.dv = (r_8)f;  mtv.iv = 0;  mtv.strv[0] ='\0'; }
    3738  inline MuTyV(r_8 d) { typ = 'D'; mtv.dv = d; mtv.iv = 0;  mtv.strv[0] ='\0'; }
    38   inline MuTyV(char const* s)  { typ = 'S'; strncpy(mtv.strv, s, 31); mtv.strv[30] = '\0'; }
    39   inline MuTyV(string const& s) { typ = 'S'; strncpy(mtv.strv, s.c_str(), 31); mtv.strv[30] = '\0'; }
     39  inline MuTyV(char const* s)  { typ = 'S'; strncpy(mtv.strv, s, 39); mtv.strv[38] = '\0'; }
     40  inline MuTyV(string const& s) { typ = 'S'; strncpy(mtv.strv, s.c_str(), 39); mtv.strv[38] = '\0'; }
     41  inline MuTyV & operator= (MuTyV const & a) { typ = a.typ; mtv = a.mtv; return(*this); }
    4042  inline int_4  operator= (int_4 v)  { typ = 'I'; mtv.iv = (int_8)v; return(v); }
    4143  inline int_8  operator= (int_8 v)  { typ = 'I'; mtv.iv = v; return(v); }
    4244  inline r_4  operator= (r_4 v)  { typ = 'D'; mtv.dv = (r_8)v; return(v); }
    4345  inline r_8 operator= (r_8 v) { typ = 'D'; mtv.dv = v; return(v); }
    44   inline char*  operator= (char* s)  { typ = 'S'; strncpy(mtv.strv, s, 31);
    45                                        mtv.strv[30] = '\0';  return(s); }
    46   inline string& operator= (string& s)    { typ = 'S'; strncpy(mtv.strv, s.c_str(), 31);
    47                                             mtv.strv[30] = '\0'; return(s); }
     46  inline char*  operator= (char* s)  { typ = 'S'; strncpy(mtv.strv, s, 39);
     47                                       mtv.strv[38] = '\0';  return(s); }
     48  inline string& operator= (string& s)    { typ = 'S'; strncpy(mtv.strv, s.c_str(), 39);
     49                                            mtv.strv[38] = '\0'; return(s); }
    4850
    4951  inline operator int_4() { if (typ == 'I')  return((int_4)mtv.iv);
     
    6062                            else return(atof(mtv.strv)); }
    6163  inline operator string() { char *ss=myStrBuf;
    62                             if (typ == 'I')  sprintf(ss,"%ld", mtv.iv);
     64                            if (typ == 'I')  sprintf(ss,"%ld", (long)mtv.iv);
    6365                            else if (typ == 'D') sprintf(ss,"%.20g", mtv.dv);
    6466                            else ss = mtv.strv;
Note: See TracChangeset for help on using the changeset viewer.