Merging bzr://gaz.tangent.org/libmemcached/build/ to Build branch
[m6w6/libmemcached] / libtest / memcached.cc
index 678c3cf18105a68f6ab64e71e85d88932ed52b05..ce523a7afc134d208c39d509fb8831e81a95d0a2 100644 (file)
@@ -56,7 +56,11 @@ class Memcached : public libtest::Server
   std::string _password;
 
 public:
-  Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg, const std::string& username_arg, const std::string& password_arg) :
+  Memcached(const std::string& host_arg,
+            const in_port_t port_arg,
+            const bool is_socket_arg,
+            const std::string& username_arg,
+            const std::string& password_arg) :
     libtest::Server(host_arg, port_arg, is_socket_arg),
     _username(username_arg),
     _password(password_arg)
@@ -123,7 +127,7 @@ public:
   bool ping()
   {
     // Memcached is slow to start, so we need to do this
-    if (not pid_file().empty())
+    if (pid_file().empty() == false)
     {
       if (wait_for_pidfile() == false)
       {
@@ -137,7 +141,7 @@ public:
 
     if (has_socket())
     {
-        ret= libmemcached_util_ping(socket().c_str(), 0, &rc);
+      ret= libmemcached_util_ping(socket().c_str(), 0, &rc);
     }
     else
     {
@@ -162,6 +166,16 @@ public:
     return MEMCACHED_BINARY;
   }
 
+  bool is_libtool()
+  {
+    if (MEMCACHED_BINARY and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0) 
+    {
+      return true;
+    }
+
+    return false;
+  }
+
   virtual void pid_file_option(Application& app, const std::string& arg)
   {
     if (arg.empty() == false)
@@ -205,11 +219,6 @@ public:
     }
   }
 
-  bool is_libtool()
-  {
-    return false;
-  }
-
   bool broken_socket_cleanup()
   {
     return true;
@@ -344,7 +353,11 @@ public:
 class MemcachedSaSL : public Memcached
 {
 public:
-  MemcachedSaSL(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg, const std::string& username_arg, const std::string &password_arg) :
+  MemcachedSaSL(const std::string& host_arg,
+                const in_port_t port_arg, 
+                const bool is_socket_arg, 
+                const std::string& username_arg, 
+                const std::string &password_arg) :
     Memcached(host_arg, port_arg, is_socket_arg, username_arg, password_arg)
   { }
 
@@ -460,7 +473,7 @@ bool Memcached::build(size_t argc, const char *argv[])
 
 bool MemcachedLight::build(size_t argc, const char *argv[])
 {
-  for (int x= 0 ; x < argc ; x++)
+  for (size_t x= 0 ; x < argc ; x++)
   {
     add_option(argv[x]);
   }