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", no_argument, &opt_displayflag, OPT_FLAG},
- {"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", no_argument, &opt_displayflag, OPT_FLAG},
+ {(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
+ {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
{0, 0, 0, 0},
};
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},
};
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},
- {"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)"hash", required_argument, NULL, OPT_HASH},
+ {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
{0, 0, 0, 0}
};
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},
+ {(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},
{0, 0, 0, 0},
};
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},
- {"expire", required_argument, NULL, OPT_EXPIRE},
- {"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)"expire", required_argument, NULL, OPT_EXPIRE},
+ {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
{0, 0, 0, 0},
};
int option_index= 0;
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},
- {"expire", required_argument, NULL, OPT_EXPIRE},
- {"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)"expire", required_argument, NULL, OPT_EXPIRE},
+ {(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
+ {(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
{0, 0, 0, 0},
};
int option_index= 0;
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},
};
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", no_argument, &opt_displayflag, OPT_FLAG},
- {"analyze", optional_argument, NULL, OPT_ANALYZE},
+ {(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", no_argument, &opt_displayflag, OPT_FLAG},
+ {(OPTIONSTRING)"analyze", optional_argument, NULL, OPT_ANALYZE},
{0, 0, 0, 0},
};
# endif
#endif
+#ifdef __sun
+ /* For some odd reason the option struct on solaris defines the argument
+ * as char* and not const char*
+ */
+#define OPTIONSTRING char*
+#else
+#define OPTIONSTRING const char*
+#endif
+
typedef struct memcached_programs_help_st memcached_programs_help_st;
struct memcached_programs_help_st
uint32_t crc= UINT32_MAX;
for (x= 0; x < key_length; x++)
- crc= (crc >> 8) ^ crc32tab[(crc ^ (key[x])) & 0xff];
+ crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff];
return ~crc;
}
for (x= 0; x < key_length; x++)
{
temp_hash *= FNV_64_PRIME;
- temp_hash ^= key[x];
+ temp_hash ^= (uint64_t)key[x];
}
hash= (uint32_t)temp_hash;
}
hash= (uint32_t) FNV_64_INIT;
for (x= 0; x < key_length; x++)
{
- hash ^= key[x];
+ uint32_t val= (uint32_t)key[x];
+ hash ^= val;
hash *= (uint32_t) FNV_64_PRIME;
}
}
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
+ uint32_t val= (uint32_t)key[x];
hash *= FNV_32_PRIME;
- hash ^= key[x];
+ hash ^= val;
}
}
break;
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
- hash ^= key[x];
+ uint32_t val= (uint32_t)key[x];
+ hash ^= val;
hash *= FNV_32_PRIME;
}
}
while (key_length--)
{
- value += (uint32_t) *ptr++;
+ uint32_t val= (uint32_t) *ptr++;
+ value += val;
value += (value << 10);
value ^= (value >> 6);
}
*/
const unsigned int m= 0x5bd1e995;
- const size_t seed= (0xdeadbeef * length);
+ const uint32_t seed= (0xdeadbeef * (uint32_t)length);
const int r= 24;
// Initialize the hash to a 'random' value
- size_t h= seed ^ length;
+ uint32_t h= seed ^ (uint32_t)length;
// Mix 4 bytes at a time into the hash
switch(length)
{
- case 3: h ^= data[2] << 16;
- case 2: h ^= data[1] << 8;
+ case 3: h ^= ((uint32_t)data[2]) << 16;
+ case 2: h ^= ((uint32_t)data[1]) << 8;
case 1: h ^= data[0];
h *= m;
default: break;
return 0;
}
+#ifndef __sun
/* Check the validity of chinese key*/
static test_return user_supplied_bug17(memcached_st *memc)
{
return 0;
}
+#endif
/*
From Andrei on IRC