Merge in Adam's bug case.
[m6w6/libmemcached] / clients / memslap.c
index 5e747b23fc58ee9789beda3e590b3634841e1b05..4e3d6813f05742cc6ba4a26a7f64446d306e62bf 100644 (file)
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
 
   memset(&conclusion, 0, sizeof(conclusions_st));
 
-  srandom(time(NULL));
+  srandom((unsigned int)time(NULL));
   options_parse(argc, argv);
 
   if (!opt_servers)
@@ -146,13 +146,15 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
   /* We need to set udp behavior before adding servers to the client */
   if (opt_udp_io)
   {
-    memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, opt_udp_io);
+    memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP,
+                           (uint64_t)opt_udp_io);
     for(x= 0; x < servers[0].count; x++ )
       servers[x].type= MEMCACHED_CONNECTION_UDP;
   }
   memcached_server_push(memc, servers);
 
-  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, opt_binary);
+  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
+                         (uint64_t)opt_binary);
   
   if (opt_flush)
     flush_all(memc);
@@ -236,21 +238,21 @@ void options_parse(int argc, char *argv[])
 
   static struct option long_options[]=
     {
-      {"concurrency", required_argument, NULL, OPT_SLAP_CONCURRENCY},
-      {"debug", no_argument, &opt_verbose, OPT_DEBUG},
-      {"execute-number", required_argument, NULL, OPT_SLAP_EXECUTE_NUMBER},
-      {"flag", no_argument, &opt_displayflag, OPT_FLAG},
-      {"flush", no_argument, &opt_flush, OPT_FLUSH},
-      {"help", no_argument, NULL, OPT_HELP},
-      {"initial-load", required_argument, NULL, OPT_SLAP_INITIAL_LOAD}, /* Number to load initially */
-      {"non-blocking", no_argument, &opt_non_blocking_io, OPT_SLAP_NON_BLOCK},
-      {"servers", required_argument, NULL, OPT_SERVERS},
-      {"tcp-nodelay", no_argument, &opt_tcp_nodelay, OPT_SLAP_TCP_NODELAY},
-      {"test", required_argument, NULL, OPT_SLAP_TEST},
-      {"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
-      {"version", no_argument, NULL, OPT_VERSION},
-      {"binary", no_argument, NULL, OPT_BINARY},
-      {"udp", no_argument, NULL, OPT_UDP},
+      {(OPTIONSTRING)"concurrency", required_argument, NULL, OPT_SLAP_CONCURRENCY},
+      {(OPTIONSTRING)"debug", no_argument, &opt_verbose, OPT_DEBUG},
+      {(OPTIONSTRING)"execute-number", required_argument, NULL, OPT_SLAP_EXECUTE_NUMBER},
+      {(OPTIONSTRING)"flag", no_argument, &opt_displayflag, OPT_FLAG},
+      {(OPTIONSTRING)"flush", no_argument, &opt_flush, OPT_FLUSH},
+      {(OPTIONSTRING)"help", no_argument, NULL, OPT_HELP},
+      {(OPTIONSTRING)"initial-load", required_argument, NULL, OPT_SLAP_INITIAL_LOAD}, /* Number to load initially */
+      {(OPTIONSTRING)"non-blocking", no_argument, &opt_non_blocking_io, OPT_SLAP_NON_BLOCK},
+      {(OPTIONSTRING)"servers", required_argument, NULL, OPT_SERVERS},
+      {(OPTIONSTRING)"tcp-nodelay", no_argument, &opt_tcp_nodelay, OPT_SLAP_TCP_NODELAY},
+      {(OPTIONSTRING)"test", required_argument, NULL, OPT_SLAP_TEST},
+      {(OPTIONSTRING)"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
+      {(OPTIONSTRING)"version", no_argument, NULL, OPT_VERSION},
+      {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+      {(OPTIONSTRING)"udp", no_argument, NULL, OPT_UDP},
       {0, 0, 0, 0},
     };
 
@@ -312,13 +314,13 @@ void options_parse(int argc, char *argv[])
       }
       break;
     case OPT_SLAP_CONCURRENCY:
-      opt_concurrency= strtol(optarg, (char **)NULL, 10);
+      opt_concurrency= (unsigned int)strtoul(optarg, (char **)NULL, 10);
       break;
     case OPT_SLAP_EXECUTE_NUMBER:
-      opt_execute_number= strtol(optarg, (char **)NULL, 10);
+      opt_execute_number= (unsigned int)strtoul(optarg, (char **)NULL, 10);
       break;
     case OPT_SLAP_INITIAL_LOAD:
-      opt_createial_load= strtol(optarg, (char **)NULL, 10);
+      opt_createial_load= (unsigned int)strtoul(optarg, (char **)NULL, 10);
       break;
     case '?':
       /* getopt_long already printed an error message. */