Explorar o código

argc was off by one in a few places

Ian Goldberg %!s(int64=2) %!d(string=hai) anos
pai
achega
2014e9fe16
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  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) {