From 175654cc23ee24b39dc00f594a4c84d20dea64dc Mon Sep 17 00:00:00 2001 From: lemeur <> Date: Wed, 9 Oct 2002 09:12:52 +0000 Subject: [PATCH] mise aux normes de for(int k= ...) --- FitsIOServer/fitsautoreader.cc | 6 ++++-- FitsIOServer/fitsfile.cc | 21 ++++++++++++--------- FitsIOServer/fitsntuple.cc | 3 ++- FitsIOServer/fitsxntuple.cc | 14 ++++++++------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/FitsIOServer/fitsautoreader.cc b/FitsIOServer/fitsautoreader.cc index 02d90d1..cb82101 100644 --- a/FitsIOServer/fitsautoreader.cc +++ b/FitsIOServer/fitsautoreader.cc @@ -97,7 +97,8 @@ AnyDataObj* FITS_AutoReader::ReadObject(int hdunum, bool toutCharger) const else { int index=0; - for (int k=0; k < inFits_->NbColsFromFits(); k++) + int k; + for (k=0; k < inFits_->NbColsFromFits(); k++) { if (inFits_->ColTypeFromFits(k) != FitsFile::FitsDataType_float) { @@ -111,7 +112,8 @@ AnyDataObj* FITS_AutoReader::ReadObject(int hdunum, bool toutCharger) const if (!toutCharger ) { int maxEntries=0; - for (int k=0; k < inFits_->NbColsFromFits(); k++) + int k; + for ( k=0; k < inFits_->NbColsFromFits(); k++) { if (inFits_->NentriesFromFits(k) > maxEntries ) maxEntries = inFits_->NentriesFromFits(k); } diff --git a/FitsIOServer/fitsfile.cc b/FitsIOServer/fitsfile.cc index e090a79..dabb0b3 100644 --- a/FitsIOServer/fitsfile.cc +++ b/FitsIOServer/fitsfile.cc @@ -22,7 +22,8 @@ void BnTblLine::setFormat(int dc, int fc, int ic, int lc, int bc,int cc, vector maxName = nbcols < maxName ? nbcols : maxName; } ColName_ = vector<string>(nbcols); - for (int k=0; k < maxName; k++) ColName_[k] = names[k]; + int k; + for (k=0; k < maxName; k++) ColName_[k] = names[k]; if (dc >0) ddata_ = vector<double>(dc); if (fc >0) fdata_ = vector<float>(fc); if (ic >0) idata_ = vector<int>(ic); @@ -77,7 +78,8 @@ FitsFile::BufferLine::BufferLine(const vector<FitsFile::FitsDataType>& types) int cc=0; int bc=0; id_ = vector< pair<FitsFile::FitsDataType, int> >(types.size()); - for (int k= 0; k < types.size(); k++) + int k; + for (k= 0; k < types.size(); k++) { switch( types[k] ) { @@ -145,48 +147,49 @@ void FitsFile::BufferLine::Print() const cout << " impression de la ligne: " << endl; cout << " doubles : " << endl; - for (int k=0; k< ddata_.size(); k++) + int k; + for (k=0; k< ddata_.size(); k++) { cout << ddata_[k] << " " ; } cout << endl; cout << " floats : " << endl; - for (int k=0; k< fdata_.size(); k++) + for (k=0; k< fdata_.size(); k++) { cout << fdata_[k] << " " ; } cout << endl; cout << " entiers courts: " << endl; - for (int k=0; k< shdata_.size(); k++) + for (k=0; k< shdata_.size(); k++) { cout << shdata_[k] << " " ; } cout << endl; cout << " entiers : " << endl; - for (int k=0; k< idata_.size(); k++) + for (k=0; k< idata_.size(); k++) { cout << idata_[k] << " " ; } cout << endl; cout << " entiers longs : " << endl; - for (int k=0; k< ldata_.size(); k++) + for (k=0; k< ldata_.size(); k++) { cout << ldata_[k] << " " ; } cout << endl; cout << " chaines carac. : " << endl; - for (int k=0; k< cdata_.size(); k++) + for (k=0; k< cdata_.size(); k++) { cout << cdata_[k] << " " ; } cout << endl; cout << " bytes : " << endl; - for (int k=0; k< bdata_.size(); k++) + for (k=0; k< bdata_.size(); k++) { cout << (char)bdata_[k] << " " ; } diff --git a/FitsIOServer/fitsntuple.cc b/FitsIOServer/fitsntuple.cc index 2fa5108..f910c9c 100644 --- a/FitsIOServer/fitsntuple.cc +++ b/FitsIOServer/fitsntuple.cc @@ -182,7 +182,8 @@ void FITS_NTuple::WriteToFits(FitsOutFile& os) float* column = new float[nentries]; for (k=0; k<ncols;k++) { - for(int j = 0; j < nentries; j++) column[j]= dobj_->GetVal(j,k); + int j; + for(j = 0; j < nentries; j++) column[j]= dobj_->GetVal(j,k); os.PutColToFits(k, nentries, column); } delete [] column; diff --git a/FitsIOServer/fitsxntuple.cc b/FitsIOServer/fitsxntuple.cc index 889d453..4271818 100644 --- a/FitsIOServer/fitsxntuple.cc +++ b/FitsIOServer/fitsxntuple.cc @@ -296,7 +296,7 @@ void FITS_XNTuple::WriteToFits(FitsOutFile& os) int ncols = dobj_->NVar(); // table will have 'nrows' rows int nrows = dobj_->NEntry(); - cout << " FITS_XNTuple::WriteToFits : nombre de lignes a ecrire " << nrows << endl; + // cout << " FITS_XNTuple::WriteToFits : nombre de lignes a ecrire " << nrows << endl; // get names and values from the join DVList object DVList dvl= dobj_->Info(); // extension name @@ -336,7 +336,8 @@ void FITS_XNTuple::WriteToFits(FitsOutFile& os) double* dcolumn = new double[nrows]; for (k=0; k<dobj_->NDVar();k++) { - for(int j = 0; j < nrows; j++) dcolumn[j]= dobj_->GetDVal(j,compt); + int j; + for(j = 0; j < nrows; j++) dcolumn[j]= dobj_->GetDVal(j,compt); os.PutColToFits(compt, nrows, dcolumn); compt++; } @@ -348,7 +349,8 @@ void FITS_XNTuple::WriteToFits(FitsOutFile& os) float* fcolumn = new float[nrows]; for (k=0; k<dobj_->NFVar();k++) { - for(int j = 0; j < nrows; j++) fcolumn[j]= dobj_->GetFVal(j,compt); + int j; + for(j = 0; j < nrows; j++) fcolumn[j]= dobj_->GetFVal(j,compt); os.PutColToFits(compt, nrows, fcolumn); compt++; } @@ -360,9 +362,9 @@ void FITS_XNTuple::WriteToFits(FitsOutFile& os) int_4* icolumn = new int_4[nrows]; for (k=0; k<dobj_->NIVar();k++) { - for(int j = 0; j < nrows; j++) icolumn[j]= dobj_->GetIVal(j,compt); - cout << " fitsx.. va ecrire la colonne " << endl; - for(int j = 0; j < nrows; j++) cout << icolumn[j] << endl;; + int j; + for(j = 0; j < nrows; j++) icolumn[j]= dobj_->GetIVal(j,compt); + // for(j = 0; j < nrows; j++) cout << icolumn[j] << endl;; os.PutColToFits(compt, nrows, icolumn); compt++; -- GitLab