Fix a number of warnings from gcc -pedantic

This commit is contained in:
Nick Mathewson 2010-01-23 16:38:36 -05:00
parent e2ca403fae
commit 918e9c5e72
7 changed files with 19 additions and 18 deletions

View File

@ -173,7 +173,7 @@ struct bufferevent_private {
enum bufferevent_ctrl_op { enum bufferevent_ctrl_op {
BEV_CTRL_SET_FD, BEV_CTRL_SET_FD,
BEV_CTRL_GET_FD, BEV_CTRL_GET_FD,
BEV_CTRL_GET_UNDERLYING, BEV_CTRL_GET_UNDERLYING
}; };
/** Possible data types for a control callback */ /** Possible data types for a control callback */

View File

@ -1743,7 +1743,7 @@ const ev_uint32_t EVUTIL_ISUPPER_TABLE[8] = { 0, 0, 0x7fffffe, 0, 0, 0, 0, 0 };
const ev_uint32_t EVUTIL_ISLOWER_TABLE[8] = { 0, 0, 0, 0x7fffffe, 0, 0, 0, 0 }; const ev_uint32_t EVUTIL_ISLOWER_TABLE[8] = { 0, 0, 0, 0x7fffffe, 0, 0, 0, 0 };
/* Upper-casing and lowercasing tables to map characters to upper/lowercase /* Upper-casing and lowercasing tables to map characters to upper/lowercase
* equivalents. */ * equivalents. */
const char EVUTIL_TOUPPER_TABLE[256] = { const unsigned char EVUTIL_TOUPPER_TABLE[256] = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
@ -1761,7 +1761,7 @@ const char EVUTIL_TOUPPER_TABLE[256] = {
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
}; };
const char EVUTIL_TOLOWER_TABLE[256] = { const unsigned char EVUTIL_TOLOWER_TABLE[256] = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,

View File

@ -467,7 +467,7 @@ enum EVRPC_HOOK_TYPE {
enum EVRPC_HOOK_RESULT { enum EVRPC_HOOK_RESULT {
EVRPC_TERMINATE = -1, /**< indicates the rpc should be terminated */ EVRPC_TERMINATE = -1, /**< indicates the rpc should be terminated */
EVRPC_CONTINUE = 0, /**< continue processing the rpc */ EVRPC_CONTINUE = 0, /**< continue processing the rpc */
EVRPC_PAUSE = 1, /**< pause processing request until resumed */ EVRPC_PAUSE = 1 /**< pause processing request until resumed */
}; };
/** adds a processing hook to either an rpc base or rpc pool /** adds a processing hook to either an rpc base or rpc pool

View File

@ -1526,7 +1526,7 @@ evtag_fuzz(void *ptr)
evtag_marshal_timeval(tmp, 0, &tv); evtag_marshal_timeval(tmp, 0, &tv);
evbuffer_add(tmp, buffer, sizeof(buffer)); evbuffer_add(tmp, buffer, sizeof(buffer));
((char *)EVBUFFER_DATA(tmp))[1] = 0xff; ((char *)EVBUFFER_DATA(tmp))[1] = '\xff';
if (evtag_unmarshal_timeval(tmp, 0, &tv) != -1) { if (evtag_unmarshal_timeval(tmp, 0, &tv) != -1) {
tt_abort_msg("evtag_unmarshal_timeval should have failed"); tt_abort_msg("evtag_unmarshal_timeval should have failed");
} }

View File

@ -84,11 +84,11 @@ http_setup(short *pport)
return (myhttp); return (myhttp);
} }
EVRPC_HEADER(Message, msg, kill); EVRPC_HEADER(Message, msg, kill)
EVRPC_HEADER(NeverReply, msg, kill); EVRPC_HEADER(NeverReply, msg, kill)
EVRPC_GENERATE(Message, msg, kill); EVRPC_GENERATE(Message, msg, kill)
EVRPC_GENERATE(NeverReply, msg, kill); EVRPC_GENERATE(NeverReply, msg, kill)
static int need_input_hook = 0; static int need_input_hook = 0;
static int need_output_hook = 0; static int need_output_hook = 0;

View File

@ -213,16 +213,16 @@ test_ratelimiting(void)
total_received += states[i].received; total_received += states[i].received;
total_persec += persec; total_persec += persec;
total_sq_persec += persec*persec; total_sq_persec += persec*persec;
printf("%d: %lf per second\n", i, persec); printf("%d: %f per second\n", i, persec);
} }
printf(" total: %lf per second\n", printf(" total: %f per second\n",
((double)total_received)/cfg_duration); ((double)total_received)/cfg_duration);
printf(" average: %lf per second\n", printf(" average: %f per second\n",
(((double)total_received)/cfg_duration)/cfg_n_connections); (((double)total_received)/cfg_duration)/cfg_n_connections);
variance = total_sq_persec/cfg_n_connections - total_persec*total_persec/(cfg_n_connections*cfg_n_connections); variance = total_sq_persec/cfg_n_connections - total_persec*total_persec/(cfg_n_connections*cfg_n_connections);
printf(" stddev: %lf per second\n", sqrt(variance)); printf(" stddev: %f per second\n", sqrt(variance));
} }
static struct option { static struct option {
@ -275,7 +275,8 @@ usage(void)
"Pushes bytes through a number of possibly rate-limited connections, and\n" "Pushes bytes through a number of possibly rate-limited connections, and\n"
"displays average throughput.\n\n" "displays average throughput.\n\n"
" -n INT: Number of connections to open (default: 30)\n" " -n INT: Number of connections to open (default: 30)\n"
" -d INT: Duration of the test in seconds (default: 5 sec)\n" " -d INT: Duration of the test in seconds (default: 5 sec)\n");
fprintf(stderr,
" -c INT: Connection-rate limit applied to each connection in bytes per second\n" " -c INT: Connection-rate limit applied to each connection in bytes per second\n"
" (default: None.)\n" " (default: None.)\n"
" -g INT: Group-rate limit applied to sum of all usage in bytes per second\n" " -g INT: Group-rate limit applied to sum of all usage in bytes per second\n"

View File

@ -113,10 +113,10 @@ DECLARE_CTYPE_FN(ISXDIGIT)
DECLARE_CTYPE_FN(ISPRINT) DECLARE_CTYPE_FN(ISPRINT)
DECLARE_CTYPE_FN(ISLOWER) DECLARE_CTYPE_FN(ISLOWER)
DECLARE_CTYPE_FN(ISUPPER) DECLARE_CTYPE_FN(ISUPPER)
extern const char EVUTIL_TOUPPER_TABLE[]; extern const unsigned char EVUTIL_TOUPPER_TABLE[];
extern const char EVUTIL_TOLOWER_TABLE[]; extern const unsigned char EVUTIL_TOLOWER_TABLE[];
#define EVUTIL_TOLOWER(c) (EVUTIL_TOLOWER_TABLE[(ev_uint8_t)c]) #define EVUTIL_TOLOWER(c) ((char)EVUTIL_TOLOWER_TABLE[(ev_uint8_t)c])
#define EVUTIL_TOUPPER(c) (EVUTIL_TOUPPER_TABLE[(ev_uint8_t)c]) #define EVUTIL_TOUPPER(c) ((char)EVUTIL_TOUPPER_TABLE[(ev_uint8_t)c])
/** Helper macro. If we know that a given pointer points to a field in a /** Helper macro. If we know that a given pointer points to a field in a
structure, return a pointer to the structure itself. Used to implement structure, return a pointer to the structure itself. Used to implement