Index: /trunk/FACT++/src/fits2sql.cc
===================================================================
--- /trunk/FACT++/src/fits2sql.cc	(revision 19139)
+++ /trunk/FACT++/src/fits2sql.cc	(revision 19140)
@@ -60,6 +60,6 @@
         ("unsigned",       vars<string>(),            "In fits files per default columns are signed. This interpretss the column as unsigned value. Use the FITS column name.")
         ("primary",        vars<string>(),            "List of columns to be used as primary keys during table creation (in connection with --create)")
-        ("first",          var<int64_t>(int64_t(0)),  "First event to start with (default: 0), mainly for test purpose")
-        ("max",            var<int64_t>(int64_t(0)),  "Maximum number of events to process (0: all), mainly for test purpose")
+        ("first",          var<size_t>(size_t(0)),    "First event to start with (default: 0), mainly for test purpose")
+        ("max",            var<size_t>(size_t(0)),    "Maximum number of events to process (0: all), mainly for test purpose")
         ("engine",         var<string>(""),           "Database engine to be used when a new table is created")
         ("row-format",     var<string>(""),           "Defines the ROW_FORMAT keyword for table creation")
@@ -288,6 +288,6 @@
 
     const uint16_t verbose       = conf.Get<uint16_t>("verbose");
-    const int64_t  first         = conf.Get<int64_t>("first");
-    const int64_t  max           = conf.Get<int64_t>("max");
+    const size_t  first          = conf.Get<size_t>("first");
+    const size_t  max            = conf.Get<size_t>("max");
 
     const bool force             = conf.Get<bool>("force");
@@ -315,4 +315,8 @@
     const vector<string> duplicate = conf.Vec<string>("duplicate");
     const vector<string> notsigned = conf.Vec<string>("unsigned");
+
+    if (first>=max)
+        cerr << "WARNING: Resource `first` (" << first << ") exceeds `max` (" << max << ")" << endl;
+
 
     // -------------------------------------------------------------------------
@@ -428,5 +432,5 @@
 
         const size_t N = col.type=='A' ? 1 : col.num;
-        for (int i=0; i<N; i++)
+        for (size_t i=0; i<N; i++)
         {
             query += "   `"+name;
@@ -570,5 +574,5 @@
     {
         const size_t N = c->type==kVarchar ? 1 : c->num;
-        for (int i=0; i<N; i++)
+        for (size_t i=0; i<N; i++)
         {
             if (c!=vec.cbegin())
@@ -591,5 +595,5 @@
     size_t count = 0;
 
-    const size_t num = max>0 && (max-first)<f.GetNumRows() ? (max-first) : f.GetNumRows();
+    const size_t num = max>first && (max-first)<f.GetNumRows() ? (max-first) : f.GetNumRows();
     for (size_t j=first; j<num; j++)
     {
@@ -604,5 +608,5 @@
         {
             const size_t N = c->type==kVarchar ? 1 : c->num;
-            for (int i=0; i<N; i++)
+            for (size_t i=0; i<N; i++)
             {
                 if (c!=vec.cbegin())
