Browse Source

argc was off by one in a few places

Ian Goldberg 2 years ago
parent
commit
2014e9fe16
1 changed files with 3 additions and 3 deletions
  1. 3 3
      cpir-read/cxx/spir_test.cpp

+ 3 - 3
cpir-read/cxx/spir_test.cpp

@@ -61,7 +61,7 @@ int main(int argc, char **argv)
   tcp::resolver resolver(io_context);
     std::string addr = "127.0.0.1";
 
-  const std::string host1 = (argc < 1) ? "127.0.0.1" : argv[1];
+  const std::string host1 = (argc <= 1) ? "127.0.0.1" : argv[1];
 
 
 
@@ -142,10 +142,10 @@ int main(int argc, char **argv)
         r = strtoul(argv[2], NULL, 10);
         size_t num_records = ((size_t) 1)<<r;
         size_t num_records_mask = num_records - 1;
-        if (argc > 4) {
+        if (argc > 3) {
             num_threads = strtoul(argv[3], NULL, 10);
         }
-        if (argc > 5) {
+        if (argc > 4) {
             num_preproc = strtoul(argv[4], NULL, 10);
         }
         if (argc > 5) {