Index: trunk/FACT++/src/fitsdump.cc
===================================================================
--- trunk/FACT++/src/fitsdump.cc	(revision 12884)
+++ trunk/FACT++/src/fitsdump.cc	(revision 12885)
@@ -132,11 +132,11 @@
 }
 
-void FitsDumper::ListKeywords(ostream &out)
+void FitsDumper::ListKeywords(ostream &fout)
 {
     const fits::Table::Keys &fKeyMap = GetKeys();
 
     for (auto it=fKeyMap.begin(); it != fKeyMap.end(); it++) {
-        out << "## " << setw(8) << it->first << " = " << setw(10);
-        out << "'" << it->second.value << "'" << " / " << it->second.comment << endl;
+        fout << "## " << setw(8) << it->first << " = " << setw(10);
+        fout << "'" << it->second.value << "'" << " / " << it->second.comment << endl;
     }
 }
@@ -144,6 +144,6 @@
 void FitsDumper::ListHeader(const string& filename)
 {
-    ofstream out(filename=="-"?"/dev/stdout":filename);
-    if (!out)
+    ofstream fout(filename=="-"?"/dev/stdout":filename);
+    if (!fout)
     {
         cerr << "Cannot open file " << filename << ": " << strerror(errno) << endl;
@@ -153,11 +153,10 @@
     const fits::Table::Keys &fKeyMap = GetKeys();
 
-    out << "\nTable: " << fKeyMap.find("EXTNAME")->second.value << " (rows=" << fKeyMap.find("NAXIS2")->second.value << ")\n";
+    fout << "\nTable: " << fKeyMap.find("EXTNAME")->second.value << " (rows=" << fKeyMap.find("NAXIS2")->second.value << ")\n";
     if (fKeyMap.find("COMMENT") != fKeyMap.end())
-        out << "Comment: \t" << fKeyMap.find("COMMENT")->second.value << "\n";
-
-    ListKeywords(out);
-    out << endl;
-
+        fout << "Comment: \t" << fKeyMap.find("COMMENT")->second.value << "\n";
+
+    ListKeywords(fout);
+    fout << endl;
 }
 
@@ -235,35 +234,35 @@
 //! Perform the actual dump, based on the current parameters
 //
-void FitsDumper::Dump(ofstream &out, const vector<MyColumn> &cols, const string &filename)
+void FitsDumper::Dump(ofstream &fout, const vector<MyColumn> &cols, const string &filename)
 {
     const fits::Table::Keys &fKeyMap = GetKeys();
 
-    out << "## --------------------------------------------------------------------------\n";
-    out << "## Fits file:\t" << fFilename << '\n';
+    fout << "## --------------------------------------------------------------------------\n";
+    fout << "## Fits file:\t" << fFilename << '\n';
     if (filename!="-")
-        out << "## File:    \t" << filename << '\n';
-    out << "## Table:   \t" << fKeyMap.find("EXTNAME")->second.value << '\n';
-    out << "## NumRows: \t" << GetInt("NAXIS2") << '\n';
-    out << "## Comment: \t" << ((fKeyMap.find("COMMENT") != fKeyMap.end()) ? fKeyMap.find("COMMENT")->second.value : "") << '\n';
-    out << "## --------------------------------------------------------------------------\n";
-    ListKeywords(out);
-    out << "## --------------------------------------------------------------------------\n";
-    out << "#\n";
+        fout << "## File:    \t" << filename << '\n';
+    fout << "## Table:   \t" << fKeyMap.find("EXTNAME")->second.value << '\n';
+    fout << "## NumRows: \t" << GetInt("NAXIS2") << '\n';
+    fout << "## Comment: \t" << ((fKeyMap.find("COMMENT") != fKeyMap.end()) ? fKeyMap.find("COMMENT")->second.value : "") << '\n';
+    fout << "## --------------------------------------------------------------------------\n";
+    ListKeywords(fout);
+    fout << "## --------------------------------------------------------------------------\n";
+    fout << "#\n";
 
     for (auto it=cols.begin(); it!=cols.end(); it++)
     {
-        out << "# " << it->name;
+        fout << "# " << it->name;
 
         if (it->first==it->last)
         {
             if (it->first!=0)
-                out << "[" << it->first << "]";
+                fout << "[" << it->first << "]";
         }
         else
-            out << "[" << it->first << ":" << it->last << "]";
-
-        out << ": " << it->col.unit << '\n';
-    }
-    out << "#" << endl;
+            fout << "[" << it->first << ":" << it->last << "]";
+
+        fout << ": " << it->col.unit << '\n';
+    }
+    fout << "#" << endl;
 
     // -----------------------------------------------------------------
@@ -286,23 +285,23 @@
                     break;
                 case 'B':
-                    out << (unsigned int)reinterpret_cast<const unsigned char*>(it->ptr)[i] << " ";
+                    fout << (unsigned int)reinterpret_cast<const unsigned char*>(it->ptr)[i] << " ";
                     break;
                 case 'L':
-                    out << reinterpret_cast<const bool*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const bool*>(it->ptr)[i] << " ";
                     break;
                 case 'I':
-                    out << reinterpret_cast<const int16_t*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const int16_t*>(it->ptr)[i] << " ";
                     break;
                 case 'J':
-                    out << reinterpret_cast<const int32_t*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const int32_t*>(it->ptr)[i] << " ";
                     break;
                 case 'K':
-                    out << reinterpret_cast<const int64_t*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const int64_t*>(it->ptr)[i] << " ";
                     break;
                 case 'E':
-                    out << reinterpret_cast<const float*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const float*>(it->ptr)[i] << " ";
                     break;
                 case 'D':
-                    out << reinterpret_cast<const double*>(it->ptr)[i] << " ";
+                    fout << reinterpret_cast<const double*>(it->ptr)[i] << " ";
                     break;
                 default:
@@ -312,11 +311,11 @@
 
             if (it->col.type=='A')
-                out << "'" << msg << "' ";
-        }
-        out << endl;
-    }
-}
-
-void FitsDumper::DumpMinMax(ofstream &out, const vector<MyColumn> &cols, bool fNoZeroPlease)
+                fout << "'" << msg << "' ";
+        }
+        fout << endl;
+    }
+}
+
+void FitsDumper::DumpMinMax(ofstream &fout, const vector<MyColumn> &cols, bool fNoZeroPlease)
 {
     vector<minMaxStruct> statData(cols.size());
@@ -331,9 +330,9 @@
         auto statsIt = statData.begin();
 
-        for (auto in=cols.begin(); in!=cols.end(); in++, statsIt++)
-        {
-            if ((in->name=="UnixTimeUTC" || in->name=="PCTime") && in->first==0 && in->last==1)
+        for (auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
+        {
+            if ((it->name=="UnixTimeUTC" || it->name=="PCTime") && it->first==0 && it->last==1)
             {
-                const uint32_t *val = reinterpret_cast<const uint32_t*>(in->ptr);
+                const uint32_t *val = reinterpret_cast<const uint32_t*>(it->ptr);
                 if (fNoZeroPlease && val[0]==0 && val[1]==0)
                     continue;
@@ -343,29 +342,29 @@
             }
 
-            for (uint32_t i=in->first; i<=in->last; i++)
+            for (uint32_t i=it->first; i<=it->last; i++)
             {
                 double cValue = 0;
-                switch (in->col.type)
+                switch (it->col.type)
                 {
                 case 'L':
-                        cValue = reinterpret_cast<const bool*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const bool*>(it->ptr)[i];
                         break;
                 case 'B':
-                        cValue = reinterpret_cast<const int8_t*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const int8_t*>(it->ptr)[i];
                         break;
                 case 'I':
-                        cValue = reinterpret_cast<const int16_t*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const int16_t*>(it->ptr)[i];
                         break;
                 case 'J':
-                        cValue = reinterpret_cast<const int32_t*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const int32_t*>(it->ptr)[i];
                         break;
                 case 'K':
-                        cValue = reinterpret_cast<const int64_t*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const int64_t*>(it->ptr)[i];
                         break;
                 case 'E':
-                        cValue = reinterpret_cast<const float*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const float*>(it->ptr)[i];
                         break;
                 case 'D':
-                        cValue = reinterpret_cast<const double*>(in->ptr)[i];
+                        cValue = reinterpret_cast<const double*>(it->ptr)[i];
                         break;
                 default:
@@ -387,12 +386,12 @@
     for (auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
     {
-        cout << "\n[" << it->name << ':' << it->first;
+        fout << "\n[" << it->name << ':' << it->first;
         if (it->first!=it->last)
-            cout << ':' << it->last;
-        cout << "]\n";
+            fout << ':' << it->last;
+        fout << "]\n";
 
         if (statsIt->numValues == 0)
         {
-            out << "Min: -\nMax: -\nAvg: -\nRms: -" << endl;
+            fout << "Min: -\nMax: -\nAvg: -\nRms: -" << endl;
             continue;
         }
@@ -406,8 +405,8 @@
         rms  = sqrt(rms/num - avg*avg);
 
-        out << "Min: " << statsIt->min << '\n';
-        out << "Max: " << statsIt->max << '\n';
-        out << "Avg: " << avg << '\n';
-        out << "Rms: " << rms << endl;
+        fout << "Min: " << statsIt->min << '\n';
+        fout << "Max: " << statsIt->max << '\n';
+        fout << "Avg: " << avg << '\n';
+        fout << "Rms: " << rms << endl;
     }
 }
@@ -454,11 +453,11 @@
 }
 
-void FitsDumper::DumpStats(ofstream &out, const vector<MyColumn> &cols)
+void FitsDumper::DumpStats(ofstream &fout, const vector<MyColumn> &cols)
 {
     // Loop over all columns in our list of requested columns
     vector<vector<char>> statData;
 
-    for (auto in=cols.begin(); in!=cols.end(); in++)
-        statData.push_back(vector<char>(in->col.size*GetNumRows()*(in->last-in->first+1)));
+    for (auto it=cols.begin(); it!=cols.end(); it++)
+        statData.push_back(vector<char>(it->col.size*GetNumRows()*(it->last-it->first+1)));
 
     while (GetNextRow())
@@ -469,42 +468,42 @@
 
         auto statsIt = statData.begin();
-        for (auto in=cols.begin(); in!=cols.end(); in++, statsIt++)
-        {
-            const char *src = reinterpret_cast<const char*>(in->ptr);
-            const size_t sz = (in->last-in->first+1)*in->col.size;
-            memcpy(statsIt->data()+row*sz, src+in->first*in->col.size, sz);
+        for (auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
+        {
+            const char *src = reinterpret_cast<const char*>(it->ptr);
+            const size_t sz = (it->last-it->first+1)*it->col.size;
+            memcpy(statsIt->data()+row*sz, src+it->first*it->col.size, sz);
         }
     }
 
     auto statsIt = statData.begin();
-    for (auto in=cols.begin(); in!=cols.end(); in++, statsIt++)
-    {
-        out << "\n[" << in->name << ':' << in->first;
-        if (in->last!=in->first)
-            out << ':' << in->last;
-        out << "]\n";
-
-        switch (in->col.type)
+    for (auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
+    {
+        fout << "\n[" << it->name << ':' << it->first;
+        if (it->last!=it->first)
+            fout << ':' << it->last;
+        fout << "]\n";
+
+        switch (it->col.type)
         {
         case 'L':
-            displayStats<bool>(*statsIt, out);
+            displayStats<bool>(*statsIt, fout);
             break;
         case 'B':
-            displayStats<char>(*statsIt, out);
+            displayStats<char>(*statsIt, fout);
             break;
         case 'I':
-            displayStats<int16_t>(*statsIt, out);
+            displayStats<int16_t>(*statsIt, fout);
             break;
         case 'J':
-            displayStats<int32_t>(*statsIt, out);
+            displayStats<int32_t>(*statsIt, fout);
             break;
         case 'K':
-            displayStats<int64_t>(*statsIt, out);
+            displayStats<int64_t>(*statsIt, fout);
             break;
         case 'E':
-            displayStats<float>(*statsIt, out);
+            displayStats<float>(*statsIt, fout);
             break;
         case 'D':
-            displayStats<double>(*statsIt, out);
+            displayStats<double>(*statsIt, fout);
             break;
         default:
@@ -555,11 +554,11 @@
     const string filename = conf.Get<string>("outfile");
 
-    ofstream out(filename=="-"?"/dev/stdout":filename);
-    if (!out)
+    ofstream fout(filename=="-"?"/dev/stdout":filename);
+    if (!fout)
     {
         cerr << "Cannot open file " << filename << ": " << strerror(errno) << endl;
         return false;
     }
-    out.precision(conf.Get<int>("precision"));
+    fout.precision(conf.Get<int>("precision"));
 
     const vector<MyColumn> cols = InitColumns(conf.Vec<string>("col"));
@@ -569,5 +568,5 @@
     if (conf.Get<bool>("minmax"))
     {
-        DumpMinMax(out, cols, conf.Get<bool>("nozero"));
+        DumpMinMax(fout, cols, conf.Get<bool>("nozero"));
         return 0;
     }
@@ -575,9 +574,9 @@
     if (conf.Get<bool>("stat"))
     {
-        DumpStats(out, cols);
+        DumpStats(fout, cols);
         return 0;
     }
 
-    Dump(out, cols, filename);
+    Dump(fout, cols, filename);
 
     return 0;
