Removed hardcoded -rpath from client libs. libtool should be handling this appropriat...
[m6w6/libmemcached] / clients / memcp.c
index 1762b6018bc7b2f12975db18ccf4242d836ae72b..716bfefd03482e94c40d8b881260e598c2d55206 100644 (file)
@@ -62,7 +62,8 @@ int main(int argc, char *argv[])
 
   memcached_server_push(memc, servers);
   memcached_server_list_free(servers);
-  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, opt_binary);
+  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
+                         (uint64_t)opt_binary);
 
   while (optind < argc) 
   {
@@ -90,20 +91,20 @@ int main(int argc, char *argv[])
 
     if (opt_verbose) 
     {
-      static char *opstr[] = { "set", "add", "replace" };
+      static const char *opstr[] = { "set", "add", "replace" };
       printf("op: %s\nsource file: %s\nlength: %zu\n"
             "key: %s\nflags: %x\nexpires: %llu\n",
             opstr[opt_method - OPT_SET], argv[optind], (size_t)sbuf.st_size,
             ptr, opt_flags, (unsigned long long)opt_expires);
     }
 
-    if ((file_buffer_ptr= (char *)malloc(sizeof(char) * sbuf.st_size)) == NULL)
+    if ((file_buffer_ptr= (char *)malloc(sizeof(char) * (size_t)sbuf.st_size)) == NULL)
     {
       fprintf(stderr, "malloc: %s\n", strerror(errno)); 
       exit(1);
     }
 
-    if ((read_length= read(fd, file_buffer_ptr, sbuf.st_size)) == -1)
+    if ((read_length= read(fd, file_buffer_ptr, (size_t)sbuf.st_size)) == -1)
     {
       fprintf(stderr, "read: %s\n", strerror(errno)); 
       exit(1);
@@ -117,15 +118,15 @@ int main(int argc, char *argv[])
 
     if (opt_method == OPT_ADD)
       rc= memcached_add(memc, ptr, strlen(ptr),
-                        file_buffer_ptr, sbuf.st_size,
+                        file_buffer_ptr, (size_t)sbuf.st_size,
                        opt_expires, opt_flags);
     else if (opt_method == OPT_REPLACE)
       rc= memcached_replace(memc, ptr, strlen(ptr),
-                           file_buffer_ptr, sbuf.st_size,
+                           file_buffer_ptr, (size_t)sbuf.st_size,
                            opt_expires, opt_flags);
     else
       rc= memcached_set(memc, ptr, strlen(ptr),
-                        file_buffer_ptr, sbuf.st_size,
+                        file_buffer_ptr, (size_t)sbuf.st_size,
                         opt_expires, opt_flags);
 
     if (rc != MEMCACHED_SUCCESS)
@@ -164,18 +165,18 @@ void options_parse(int argc, char *argv[])
 
   static struct option long_options[]=
     {
-      {"version", no_argument, NULL, OPT_VERSION},
-      {"help", no_argument, NULL, OPT_HELP},
-      {"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
-      {"debug", no_argument, &opt_verbose, OPT_DEBUG},
-      {"servers", required_argument, NULL, OPT_SERVERS},
-      {"flag", required_argument, NULL, OPT_FLAG},
-      {"expire", required_argument, NULL, OPT_EXPIRE},
-      {"set",  no_argument, NULL, OPT_SET},
-      {"add",  no_argument, NULL, OPT_ADD},
-      {"replace",  no_argument, NULL, OPT_REPLACE},
-      {"hash", required_argument, NULL, OPT_HASH},
-      {"binary", no_argument, NULL, OPT_BINARY},
+      {(OPTIONSTRING)"version", no_argument, NULL, OPT_VERSION},
+      {(OPTIONSTRING)"help", no_argument, NULL, OPT_HELP},
+      {(OPTIONSTRING)"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
+      {(OPTIONSTRING)"debug", no_argument, &opt_verbose, OPT_DEBUG},
+      {(OPTIONSTRING)"servers", required_argument, NULL, OPT_SERVERS},
+      {(OPTIONSTRING)"flag", required_argument, NULL, OPT_FLAG},
+      {(OPTIONSTRING)"expire", required_argument, NULL, OPT_EXPIRE},
+      {(OPTIONSTRING)"set",  no_argument, NULL, OPT_SET},
+      {(OPTIONSTRING)"add",  no_argument, NULL, OPT_ADD},
+      {(OPTIONSTRING)"replace",  no_argument, NULL, OPT_REPLACE},
+      {(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
+      {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
       {0, 0, 0, 0},
     };