Commit 8bbf9345 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Modifications minueures, pour supprimer des warning sur linux/g++ avec Wall...

Modifications minueures, pour supprimer des warning sur linux/g++ avec Wall (comparison signed-unsigned, unused variable ..., Reza
parent eb582f55
......@@ -89,7 +89,8 @@ public :
msg += typeid(o).name();
throw TypeMismatchExc(msg);
}
if (ownobj && dobj) delete dobj; dobj = po; ownobj = false;
if (ownobj && dobj) delete dobj;
dobj = po; ownobj = false;
}
virtual int CheckReadability(FitsInOutFile& is);
......
......@@ -67,7 +67,7 @@ public:
LONGLONG row = rowos;
if (osw) row = oswp;
if (dtp != NULL)
if ((row+sz/repcnt-1) > dtp->NRows() ) sz = (dtp->NRows()-row+1)*repcnt;
if ((row+sz/repcnt-1) > (LONGLONG)dtp->NRows() ) sz = (dtp->NRows()-row+1)*repcnt;
FitsBlockRW<T>::WriteColumnData(fios, fcol, row, 1, d, sz);
if (!osw) rowos += (sz/repcnt);
return row;
......@@ -77,7 +77,7 @@ public:
{
int_8 nrows = fios.GetNbRows();
size_t szi = sz;
if ((swp+sz/repcnt-1) > nrows) sz = (nrows-swp+1)*repcnt;
if ((swp+sz/repcnt-1) > (LONGLONG)nrows) sz = (nrows-swp+1)*repcnt;
FitsBlockRW<T>::ReadColumnData(fios, fcol, swp, 1, d, sz);
if (sz < szi) {
T zz = d[sz-1];
......
......@@ -40,45 +40,57 @@ template <class T>
class PPFDataSwapper : public DataSwapperInterface<T> {
public:
//! Default constructor - no output, nor input streams
PPFDataSwapper() { Init(NULL,false,NULL,false); }
PPFDataSwapper() : mSRef(nullptr)
{ Init(nullptr,false,nullptr,false); }
//! Copy constructor
PPFDataSwapper(const PPFDataSwapper<T> & a) { mSRef=NULL; Share(a); }
PPFDataSwapper(const PPFDataSwapper<T> & a) : mSRef(nullptr)
{ mSRef=nullptr; Share(a); }
//! Constructor from an output stream - swap out (write) only
PPFDataSwapper(POutPersist & os) { Init(&os,false,NULL,false); }
PPFDataSwapper(POutPersist & os) : mSRef(nullptr)
{ Init(&os,false,nullptr,false); }
//! Constructor from an input stream - swap in (read) only
PPFDataSwapper(PInPersist & is) { Init(NULL,false,&is,false); }
PPFDataSwapper(PInPersist & is) : mSRef(nullptr)
{ Init(nullptr,false,&is,false); }
//! Constructor from an output and an input stream - swap out (write) and in (read)
PPFDataSwapper(POutPersist & os, PInPersist & is) { Init(&os,false,&is,false); }
PPFDataSwapper(POutPersist & os, PInPersist & is) : mSRef(nullptr)
{ Init(&os,false,&is,false); }
/*!
\brief Constructor from an output stream - swap out (write) only
POutPersist delete handled by PPFDataSwapper if ados==true
*/
PPFDataSwapper(POutPersist* os, bool ados=true) { Init(os,ados,NULL,false); }
PPFDataSwapper(POutPersist* os, bool ados=true)
: mSRef(nullptr)
{ Init(os,ados,nullptr,false); }
/*!
\brief Constructor from an input stream - swap in (read) only
PInPersist delete handled by PPFDataSwapper if adis==true
*/
PPFDataSwapper(PInPersist* is, bool adis=true) { Init(NULL,false,is,adis); }
PPFDataSwapper(PInPersist* is, bool adis=true)
: mSRef(nullptr)
{ Init(nullptr,false,is,adis); }
/*!
\brief Constructor from an output and an input stream - swap out (write) and in (read)
POutPersist delete handled by PPFDataSwapper if ados==true
PInPersist delete handled by PPFDataSwapper if adis==true.
*/
PPFDataSwapper(POutPersist* os, PInPersist* is, bool ados=false, bool adis=false)
{ Init(os,ados,is,adis); }
PPFDataSwapper(POutPersist* os, PInPersist* is, bool ados=false, bool adis=false)
: mSRef(nullptr)
{ Init(os,ados,is,adis); }
//! enum to define swap mode : Out (write), In (read), InOut (read & write)
//! constructor with specification of PPF file name and the swap mode
PPFDataSwapper(const char* inoutname, int mode)
: mSRef(nullptr)
{
Open(inoutname, mode);
}
//! constructor with specification of PPF file name and the swap mode
PPFDataSwapper(const std::string& inoutname, int mode)
: mSRef(nullptr)
{
Open(inoutname.c_str(), mode);
}
......@@ -96,7 +108,7 @@ public:
//! Implementation of WriteToSwap on PPF streams
virtual int_8 WriteToSwap(const T * d, size_t sz, int_8 idx, int_8 oswp=0, bool osw=false)
{
if (mSRef->ppfos == NULL)
if (mSRef->ppfos == nullptr)
throw NotAvailableOperation("PPFDataSwapper<T>::WriteToSwap() - No POutPersist stream !");
int_8 tag=0;
int_8 cspos=0;
......@@ -117,7 +129,7 @@ public:
virtual void ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz)
{
//DBG cout << " *DBG*ReadFromSwap(idx="<<idx<<" ,swp="<<swp<<", d="<<hex<<d<<dec<<" ,sz="<<sz<<")"<<endl;
if (mSRef->ppfis == NULL)
if (mSRef->ppfis == nullptr)
throw NotAvailableOperation("PPFDataSwapper<T>::ReadFromSwap() - No PInPersist stream !");
if (mSRef->fglastopwrite) {
mSRef->ppfos->getStream().flush();
......@@ -144,9 +156,9 @@ public:
//! Open PPF file(s) and calls Init()
void Open(const char* inoutname, int mode)
{
POutPersist* os=NULL;
POutPersist* os=nullptr;
if (inoutname && (mode&std::ios::out)) os = new POutPersist(inoutname);
PInPersist* is=NULL;
PInPersist* is=nullptr;
if (inoutname && (mode&std::ios::in)) is = new PInPersist(inoutname,false);
if (mSRef) Delete();
Init(os, true, is, true);
......@@ -178,14 +190,14 @@ protected:
//! Decrement the number of reference counts, and free the memory if NRef=0
void Delete()
{
if (mSRef == NULL) return;
if (mSRef == nullptr) return;
mSRef->nref--;
if (mSRef->nref == 0) {
if (mSRef->adfos && mSRef->ppfos) delete mSRef->ppfos;
if (mSRef->adfis && mSRef->ppfis) delete mSRef->ppfis;
delete mSRef;
}
mSRef = NULL;
mSRef = nullptr;
return;
}
/*! \cond
......
......@@ -2,7 +2,7 @@
#define SVERSION_H
#define SOPHYA_VERSION 2.5
#define SOPHYA_REVISION 65
#define SOPHYA_REVISION 66
#define SOPHYA_TAG "V_Jun2022"
#endif
......@@ -285,7 +285,7 @@ protected:
}
bool getSeg(size_t k) const
{
if ((bidx >= 0) && (k == bidx)) return false;
if ((bidx >= 0) && (k == (size_t)bidx)) return false;
if (k >= NbSegments())
throw RangeCheckError("SwSegDataBlock<T>::getSeg(k) k>=NbSegments()");
mSRef->gThsop.lock(); // (ThreadSafe) - Start of atomic operation
......
......@@ -1336,7 +1336,7 @@ int Commander::SubstituteVars(string & s, string & s2)
{
int iarr = -1; // index d'element de tableau
size_t p,q,q2,q3,l;
size_t p,q,q2=0,q3=0,l=0;
bool fgvarapp = false; // Si true, VarApp en priorite
s2="";
......@@ -2295,7 +2295,7 @@ while (fgets(line_buff,2047,fip) != NULL) {
if ((lbl<1)||(line_buff[0]=='#')) continue; // on saute les lignes vides ou celles commencant par #
if (strcmp(line_buff,"!beginlinesgroup")==0) {
ShowMessage("### BEGIN lines group ... ", _MAGENTA_);
bool fgfoundend=false;
//DEL bool fgfoundend=false; - Not used
string lines;
while (fgets(line_buff,2047,fip) != NULL) {
line_buff[2047]='\0';
......
......@@ -93,7 +93,7 @@ void ParalExThread::run()
try {
rcex = ptask_.execute(tid_);
}
catch (std::exception exc) {
catch (std::exception& exc) {
fgexcept_ = true;
msg_exc_ = "std::exception in ParalExThread::run(): ";
msg_exc_ += exc.what();
......
......@@ -95,7 +95,7 @@ RPNExpressionEvaluator::RPNExpressionEvaluator(string const & sex)
RPNExpressionEvaluator::RPNExpressionEvaluator(vector<string> & exe, int off)
{
int rc = EvalRPNExpr(exe, off);
if (rc < exe.size()) {
if (rc < (int)exe.size()) {
string msg = "RPNExpressionEvaluator() - syntax error near ";
msg += exe[rc];
char buff[32];
......
......@@ -349,10 +349,10 @@ int Socket::DetermineNameAddress(const struct sockaddr * saddr, socklen_t slen,
/* --Methode-- */
bool Socket::GetIPv4Adress(const char* name_or_adress, struct sockaddr_in * psin)
{
struct addrinfo hints, *res, *p;
void *addr;
struct addrinfo *res, *p; // hints : Not used
//DEL void *addr; - Not used
int status;
char ipstr[INET6_ADDRSTRLEN], ipver;
//DEL char ipstr[INET6_ADDRSTRLEN], ipver; - Not used , see below
if ((status = getaddrinfo(name_or_adress, nullptr, nullptr, &res)) != 0) {
cout << "Socket::GetIPv4Adress() Pb getaddrinfo(): " << gai_strerror(status) << endl;
}
......@@ -801,7 +801,7 @@ void UDPClientSocket::SetC(UDPClientSocket const& a)
/* --Methode-- */
void UDPClientSocket::InitConnection(const char* name, int port)
{
int s,rc;
int s;
struct sockaddr_in ipskt;
memset((char *) &ipskt, 0, sizeof(ipskt));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment