Browse Source

Fix a number of CPPCheck warnings.

Brian Aker 12 years ago
parent
commit
64d074cb62

+ 1 - 1
libgearman/pipe.cc

@@ -104,7 +104,7 @@ bool setup_shutdown_pipe(int pipedes_[2])
     int fcntl_sig_error;
     do 
     {
-      if (fcntl(pipedes_[x], F_SETNOSIGPIPE, 0) != -1)
+      if ((fcntl_sig_error= fcntl(pipedes_[x], F_SETNOSIGPIPE, 0)) != -1)
       {
         close(pipedes_[0]);
         close(pipedes_[1]);

+ 1 - 1
libtest/cmdline.cc

@@ -741,7 +741,7 @@ void Application::create_argv(const char *args[])
 
   built_argv[x++]= strdup(_exectuble_with_path.c_str());
 
-  for (Options::const_iterator iter= _options.begin(); iter != _options.end(); iter++)
+  for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter)
   {
     built_argv[x++]= strdup((*iter).first.c_str());
     if ((*iter).second.empty() == false)

+ 5 - 2
libtest/core.cc

@@ -42,8 +42,11 @@ namespace libtest {
 
 void create_core(void)
 {
-#ifdef TARGET_OS_OSX 
-  return;
+#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+  if (TARGET_OS_OSX)
+  {
+    return;
+  }
 #endif
   if (getenv("YATL_COREDUMP"))
   {

+ 2 - 2
libtest/failed.cc

@@ -46,7 +46,7 @@
 namespace libtest {
 
 struct failed_st {
-  failed_st(const std::string collection_arg, const std::string test_arg) :
+  failed_st(const std::string& collection_arg, const std::string& test_arg) :
     collection(collection_arg),
     test(test_arg)
   { }
@@ -70,7 +70,7 @@ public:
 
   void print_failed_test(void)
   {
-    for (Failures::iterator iter= failures.begin(); iter != failures.end(); iter++)
+    for (Failures::iterator iter= failures.begin(); iter != failures.end(); ++iter)
     {
       Error << "\t" << (*iter).collection << " " << (*iter).test;
     }

+ 1 - 1
libtest/fatal.cc

@@ -54,7 +54,7 @@ fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const cha
 
     strncpy(_mesg, last_error, sizeof(_mesg));
 
-    snprintf(_error_message, sizeof(_error_message), "%s", last_error);
+    snprintf(_error_message, sizeof(_error_message), "%.*s", last_error_length, last_error);
   }
 
 static bool _disabled= false;

+ 11 - 0
libtest/is_local.cc

@@ -45,5 +45,16 @@ bool test_is_local()
   return (getenv("LIBTEST_LOCAL"));
 }
 
+static bool _is_massive= false;
+void is_massive(bool arg)
+{
+  _is_massive= arg;
+}
+
+bool is_massive()
+{
+  return _is_massive;
+}
+
 } // namespace libtest
 

+ 6 - 0
libtest/is_local.hpp

@@ -41,4 +41,10 @@ namespace libtest {
 LIBTEST_API
 bool test_is_local();
 
+LIBTEST_API
+void is_massive(bool);
+
+LIBTEST_API
+bool is_massive();
+
 } // namespace libtest

+ 10 - 0
libtest/main.cc

@@ -187,11 +187,21 @@ int main(int argc, char *argv[])
     }
   }
 
+  if ((bool(getenv("YATL_RUN_MASSIVE_TESTS"))) or opt_massive)
+  {
+    opt_massive= true;
+  }
+
   if (opt_quiet)
   {
     close(STDOUT_FILENO);
   }
 
+  if (opt_massive)
+  {
+    is_massive(opt_massive);
+  }
+
   char buffer[1024];
   if (getenv("LIBTEST_TMP"))
   {

+ 8 - 8
libtest/server_container.cc

@@ -287,17 +287,16 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
 
     server->build(argc, argv);
 
+#if 0
     if (false)
     {
       Out << "Pausing for startup, hit return when ready.";
       std::string gdb_command= server->base_command();
-      std::string options;
-#if 0
-      Out << "run " << server->args(options);
-#endif
       getchar();
     }
-    else if (server->start() == false)
+    else
+#endif
+      if (server->start() == false)
     {
       delete server;
       return false;
@@ -397,17 +396,18 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons
 
     server->build(argc, argv);
 
+#if 0
     if (false)
     {
       Out << "Pausing for startup, hit return when ready.";
       std::string gdb_command= server->base_command();
       std::string options;
-#if 0
       Out << "run " << server->args(options);
-#endif
       getchar();
     }
-    else if (server->start() == false)
+    else
+#endif
+      if (server->start() == false)
     {
       Error << "Failed to start " << *server;
       delete server;

+ 0 - 1
libtest/unittest.cc

@@ -179,7 +179,6 @@ static test_return_t var_drizzle_exists_test(void *)
 static test_return_t var_tmp_test(void *)
 {
   FILE *file= fopen("var/tmp/junk", "w+");
-  char buffer[1024];
   test_true(file);
   fclose(file);
   return TEST_SUCCESS;

Some files were not shown because too many files changed in this diff