From 49b15797bd434531f3f563556f9935275c5dcd7e Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:39:58 -0400
Subject: [PATCH 01/40] libevent-2.0.18-stable/arc4random.c: line 306:  
 INT01: Use size_t for all integer values representing
 the size of an object

 for (i = 0; filenames[i]; ++i) {
                       ^
---
 arc4random.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arc4random.c b/arc4random.c
index cabc46f..e390fa9 100644
--- a/arc4random.c
+++ b/arc4random.c
@@ -300,8 +300,8 @@ arc4_seed_urandom(void)
 		"/dev/srandom", "/dev/urandom", "/dev/random", NULL
 	};
 	unsigned char buf[ADD_ENTROPY];
-	int fd, i;
-	size_t n;
+	int fd;
+	size_t i, n;
 
 	for (i = 0; filenames[i]; ++i) {
 		fd = evutil_open_closeonexec(filenames[i], O_RDONLY, 0);
-- 
1.7.7.5 (Apple Git-26)


From 265caf36eb51f0981c9a8a94efa23c208ee746e3 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:41:13 -0400
Subject: [PATCH 02/40] libevent-2.0.18-stable/event.c: line 587:   INT01: Use
 size_t for all integer values representing the size
 of an object

 for (i = 0; eventops[i] && !base->evbase; i++) {
                      ^
---
 event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/event.c b/event.c
index f13cdcf..7459e48 100644
--- a/event.c
+++ b/event.c
@@ -547,7 +547,7 @@ event_disable_debug_mode(void)
 struct event_base *
 event_base_new_with_config(const struct event_config *cfg)
 {
-	int i;
+	size_t i;
 	struct event_base *base;
 	int should_check_environment;
 
-- 
1.7.7.5 (Apple Git-26)


From 139907a518447f64047a51cdcb4ad4b54df2e01e Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:44:51 -0400
Subject: [PATCH 03/40] libevent-2.0.18-stable/event.c: line 905:   INT01: Use
 size_t for all integer values representing the size
 of an object

 for (k = 0, i = 0; eventops[k] != NULL; ++k) {
                             ^
---
 event.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/event.c b/event.c
index 7459e48..657411d 100644
--- a/event.c
+++ b/event.c
@@ -889,7 +889,8 @@ event_get_supported_methods(void)
 	static const char **methods = NULL;
 	const struct eventop **method;
 	const char **tmp;
-	int i = 0, k;
+	int i = 0;
+	size_t k;
 
 	/* count all methods */
 	for (method = &eventops[0]; *method != NULL; ++method) {
-- 
1.7.7.5 (Apple Git-26)


From 9b2ff56b7c42c64728d9649d45f858d07086ec76 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:46:06 -0400
Subject: [PATCH 04/40] libevent-2.0.18-stable/event.c: line 908:   INT01: Use
 size_t for all integer values representing the size
 of an object

 tmp[i] = NULL;
     ^
---
 event.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/event.c b/event.c
index 657411d..b0f3aba 100644
--- a/event.c
+++ b/event.c
@@ -889,8 +889,7 @@ event_get_supported_methods(void)
 	static const char **methods = NULL;
 	const struct eventop **method;
 	const char **tmp;
-	int i = 0;
-	size_t k;
+	size_t i = 0, k;
 
 	/* count all methods */
 	for (method = &eventops[0]; *method != NULL; ++method) {
-- 
1.7.7.5 (Apple Git-26)


From 75ac7617d93f1eadb775c6cbdc0bb515ab865287 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:49:22 -0400
Subject: [PATCH 05/40] libevent-2.0.18-stable/event.c: line 479:   INT01: Use
 size_t for all integer values representing the size
 of an object

 for (i = 8; environment[i] != '\0'; ++i)
                         ^
---
 event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/event.c b/event.c
index b0f3aba..5c17917 100644
--- a/event.c
+++ b/event.c
@@ -473,7 +473,7 @@ static int
 event_is_method_disabled(const char *name)
 {
 	char environment[64];
-	int i;
+	size_t i;
 
 	evutil_snprintf(environment, sizeof(environment), "EVENT_NO%s", name);
 	for (i = 8; environment[i] != '\0'; ++i)
-- 
1.7.7.5 (Apple Git-26)


From fd6397cfeee4257248b4a27e0b59aebe2561a46b Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:50:33 -0400
Subject: [PATCH 06/40] libevent-2.0.18-stable/evutil.c: line 1819:   INT01:
 Use size_t for all integer values representing the
 size of an object

  buf[len] = '\0';
      ^
---
 evutil.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/evutil.c b/evutil.c
index b663459..f6d1718 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1807,12 +1807,12 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
 
 	cp = strchr(ip_as_string, ':');
 	if (*ip_as_string == '[') {
-		int len;
+		size_t len;
 		if (!(cp = strchr(ip_as_string, ']'))) {
 			return -1;
 		}
-		len = (int) ( cp-(ip_as_string + 1) );
-		if (len > (int)sizeof(buf)-1) {
+		len = (size_t) ( cp-(ip_as_string + 1) );
+		if (len > sizeof(buf)-1) {
 			return -1;
 		}
 		memcpy(buf, ip_as_string+1, len);
-- 
1.7.7.5 (Apple Git-26)


From 80bc869ad2e9bfa6959592bd9b013c973409edb4 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:51:36 -0400
Subject: [PATCH 07/40] libevent-2.0.18-stable/evutil.c: line 1539:   INT01:
 Use size_t for all integer values representing the
 size of an object

  for (i=0; windows_socket_errors[i].code >= 0; ++i) {
                                  ^
---
 evutil.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/evutil.c b/evutil.c
index f6d1718..51e1c0b 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1535,7 +1535,7 @@ const char *
 evutil_socket_error_to_string(int errcode)
 {
   /* XXXX Is there really no built-in function to do this? */
-  int i;
+  size_t i;
   for (i=0; windows_socket_errors[i].code >= 0; ++i) {
     if (errcode == windows_socket_errors[i].code)
       return windows_socket_errors[i].msg;
-- 
1.7.7.5 (Apple Git-26)


From d8da1d26deeb796d17b6d51969101f150015af68 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:52:55 -0400
Subject: [PATCH 08/40] libevent-2.0.18-stable/http.c: line 2735:   INT01: Use
 size_t for all integer values representing the size
 of an object

 ret[j] = '\0';
     ^
---
 http.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/http.c b/http.c
index b9687df..0d4a723 100644
--- a/http.c
+++ b/http.c
@@ -2710,9 +2710,8 @@ evhttp_decode_uri_internal(
 	const char *uri, size_t length, char *ret, int decode_plus_ctl)
 {
 	char c;
-	int j;
+	size_t i, j;
 	int decode_plus = (decode_plus_ctl == 1) ? 1: 0;
-	unsigned i;
 
 	for (i = j = 0; i < length; i++) {
 		c = uri[i];
-- 
1.7.7.5 (Apple Git-26)


From 26b4aa4afd5e3520d599ab5cc655fe1c7244ebd3 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:55:56 -0400
Subject: [PATCH 09/40] libevent-2.0.18-stable/http.c: line 2592:   INT01: Use
 size_t for all integer values representing the size
 of an object

 if (subcode >= (int) response_classes[klass].num_responses)
                                       ^
---
 http.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/http.c b/http.c
index 0d4a723..1de5647 100644
--- a/http.c
+++ b/http.c
@@ -2581,11 +2581,12 @@ static const struct response_class response_classes[] = {
 static const char *
 evhttp_response_phrase_internal(int code)
 {
-	int klass = code / 100 - 1;
+	EVUTIL_ASSERT(code >= 100);
+	size_t klass = code / 100 - 1;
 	int subcode = code % 100;
 
 	/* Unknown class - can't do any better here */
-	if (klass < 0 || klass >= (int) MEMBERSOF(response_classes))
+	if (klass >= (size_t) MEMBERSOF(response_classes))
 		return "Unknown Status Class";
 
 	/* Unknown sub-code, return class name at least */
-- 
1.7.7.5 (Apple Git-26)


From 401d916f3cc4721ef751606e23697dbac3c6fe9d Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:57:34 -0400
Subject: [PATCH 10/40] libevent-2.0.18-stable/sample/dns-example.c: line 154:
   INT01: Use size_t for all integer values
 representing the size of an object

 while (idx < c && v[idx][0] == '-') {
                     ^
---
 sample/dns-example.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sample/dns-example.c b/sample/dns-example.c
index f97a0c6..9658fb6 100644
--- a/sample/dns-example.c
+++ b/sample/dns-example.c
@@ -141,7 +141,7 @@ logfn(int is_warn, const char *msg) {
 
 int
 main(int c, char **v) {
-	int idx;
+	size_t idx;
 	int reverse = 0, servertest = 0, use_getaddrinfo = 0;
 	struct event_base *event_base = NULL;
 	struct evdns_base *evdns_base = NULL;
-- 
1.7.7.5 (Apple Git-26)


From 2cc50fa4e07f7e79f52b979076e5602e0dc8126d Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:58:51 -0400
Subject: [PATCH 11/40] libevent-2.0.18-stable/sample/le-proxy.c: line 215:  
 INT01: Use size_t for all integer values representing
 the size of an object

  if (!strcmp(argv[i], "-s")) {
                   ^
---
 sample/le-proxy.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sample/le-proxy.c b/sample/le-proxy.c
index 446bfb5..4bc8fc1 100644
--- a/sample/le-proxy.c
+++ b/sample/le-proxy.c
@@ -202,7 +202,7 @@ accept_cb(struct evconnlistener *listener, evutil_socket_t fd,
 int
 main(int argc, char **argv)
 {
-	int i;
+	size_t i;
 	int socklen;
 
 	int use_ssl = 0;
@@ -211,7 +211,7 @@ main(int argc, char **argv)
 	if (argc < 3)
 		syntax();
 
-	for (i=1; i < argc; ++i) {
+	for (i=1; i < (size_t) argc; ++i) {
 		if (!strcmp(argv[i], "-s")) {
 			use_ssl = 1;
 		} else if (!strcmp(argv[i], "-W")) {
@@ -222,7 +222,7 @@ main(int argc, char **argv)
 			break;
 	}
 
-	if (i+2 != argc)
+	if (i+2 != (size_t) argc)
 		syntax();
 
 	memset(&listen_on_addr, 0, sizeof(listen_on_addr));
-- 
1.7.7.5 (Apple Git-26)


From 2540a464a2aa0d639541a32c186eb90d5207fc7a Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 17:59:40 -0400
Subject: [PATCH 12/40] libevent-2.0.18-stable/test/regress_util.c: line 113: 
  INT01: Use size_t for all integer values
 representing the size of an object

 for (i = 0; ipv4_entries[i].addr; ++i) {
                          ^
---
 test/regress_util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress_util.c b/test/regress_util.c
index 88d8057..7067e5b 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -109,7 +109,7 @@ static struct ipv6_entry {
 static void
 regress_ipv4_parse(void *ptr)
 {
-	int i;
+	size_t i;
 	for (i = 0; ipv4_entries[i].addr; ++i) {
 		char written[128];
 		struct ipv4_entry *ent = &ipv4_entries[i];
-- 
1.7.7.5 (Apple Git-26)


From 7302062862bbd99dd43fddfb13f456d2b825cf97 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:00:37 -0400
Subject: [PATCH 13/40] libevent-2.0.18-stable/test/regress_util.c: line 160: 
  INT01: Use size_t for all integer values
 representing the size of an object

 for (i = 0; ipv6_entries[i].addr; ++i) {
                          ^
---
 test/regress_util.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/regress_util.c b/test/regress_util.c
index 7067e5b..c23a7d8 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -155,7 +155,8 @@ static void
 regress_ipv6_parse(void *ptr)
 {
 #ifdef AF_INET6
-	int i, j;
+	size_t i;
+	int j;
 
 	for (i = 0; ipv6_entries[i].addr; ++i) {
 		char written[128];
-- 
1.7.7.5 (Apple Git-26)


From 7398ae8b02ae9ad599cc96a1030bd936dd0b03dc Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:01:23 -0400
Subject: [PATCH 14/40] libevent-2.0.18-stable/test/regress_util.c: line 232: 
  INT01: Use size_t for all integer values
 representing the size of an object

 for (i = 0; sa_port_ents[i].parse; ++i) {
                          ^
---
 test/regress_util.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/regress_util.c b/test/regress_util.c
index c23a7d8..6eb7d00 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -228,7 +228,8 @@ static void
 regress_sockaddr_port_parse(void *ptr)
 {
 	struct sockaddr_storage ss;
-	int i, r;
+	size_t i;
+	int r;
 
 	for (i = 0; sa_port_ents[i].parse; ++i) {
 		struct sa_port_ent *ent = &sa_port_ents[i];
-- 
1.7.7.5 (Apple Git-26)


From 20d37895f5dd2593ca3e483366e6f2128992a441 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:02:14 -0400
Subject: [PATCH 15/40] libevent-2.0.18-stable/test/regress_util.c: line 343: 
  INT01: Use size_t for all integer values
 representing the size of an object

 for (i=0; sa_pred_entries[i].parse; ++i) {
                           ^
---
 test/regress_util.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/regress_util.c b/test/regress_util.c
index 6eb7d00..a8d3db4 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -340,7 +340,8 @@ static void
 test_evutil_sockaddr_predicates(void *ptr)
 {
 	struct sockaddr_storage ss;
-	int r, i;
+	size_t i;
+	int r;
 
 	for (i=0; sa_pred_entries[i].parse; ++i) {
 		struct sa_pred_ent *ent = &sa_pred_entries[i];
-- 
1.7.7.5 (Apple Git-26)


From c9c89f93bd3a1c896912e0f143ea912d44c24d18 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:03:11 -0400
Subject: [PATCH 16/40] libevent-2.0.18-stable/test/tinytest.c: line 259:  
 INT01: Use size_t for all integer values representing
 the size of an object

 for (i=0; groups[i].prefix; ++i) {
                  ^
---
 test/tinytest.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/tinytest.c b/test/tinytest.c
index 91cd8cb..0d84b68 100644
--- a/test/tinytest.c
+++ b/test/tinytest.c
@@ -250,7 +250,8 @@ testcase_run_one(const struct testgroup_t *group,
 int
 _tinytest_set_flag(struct testgroup_t *groups, const char *arg, unsigned long flag)
 {
-	int i, j;
+	size_t i;
+	int j;
 	size_t length = LONGEST_TEST_NAME;
 	char fullname[LONGEST_TEST_NAME];
 	int found=0;
-- 
1.7.7.5 (Apple Git-26)


From ecb21b512205c8e5016539ddf447bc3bc2dbd22e Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:04:46 -0400
Subject: [PATCH 17/40] libevent-2.0.18-stable/test/tinytest.c: line 302:  
 INT01: Use size_t for all integer values representing
 the size of an object

  if (v[i][0] == '-') {
        ^
---
 test/tinytest.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/tinytest.c b/test/tinytest.c
index 0d84b68..3ded200 100644
--- a/test/tinytest.c
+++ b/test/tinytest.c
@@ -289,7 +289,8 @@ usage(struct testgroup_t *groups, int list_groups)
 int
 tinytest_main(int c, const char **v, struct testgroup_t *groups)
 {
-	int i, j, n=0;
+	size_t i;
+	int j, n=0;
 
 #ifdef WIN32
 	const char *sp = strrchr(v[0], '.');
-- 
1.7.7.5 (Apple Git-26)


From ea442b065bdbb30e15ec34adc5f4bec8641fd5f3 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:07:41 -0400
Subject: [PATCH 18/40] libevent-2.0.18-stable/evutil.c: line 1848:   INT06:
 Use strtol() et al. to convert a string token to an
 integer

  port = atoi(port_part);
         ^
---
 evutil.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/evutil.c b/evutil.c
index 51e1c0b..7815900 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1845,10 +1845,13 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
 	if (port_part == NULL) {
 		port = 0;
 	} else {
-		port = atoi(port_part);
-		if (port <= 0 || port > 65535) {
+		int save_errno = errno;
+		errno = 0;
+		port = (int) strtol(port_part, NULL, 10);
+		if (errno != 0 || port <= 0 || port > 65535) {
 			return -1;
 		}
+		errno = save_errno;
 	}
 
 	if (!addr_part)
-- 
1.7.7.5 (Apple Git-26)


From 00851f0119bd940377891f230d8197be188895eb Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:12:23 -0400
Subject: [PATCH 19/40] libevent-2.0.18-stable/http.c: line 3684:   INT06: Use
 strtol() et al. to convert a string token to an
 integer

  http->base, NULL, hostname, atoi(portname));
                              ^
---
 http.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/http.c b/http.c
index 1de5647..729f164 100644
--- a/http.c
+++ b/http.c
@@ -3668,6 +3668,8 @@ evhttp_get_request_connection(
 {
 	struct evhttp_connection *evcon;
 	char *hostname = NULL, *portname = NULL;
+	ev_uint16_t port;
+	int save_errno;
 
 	name_from_addr(sa, salen, &hostname, &portname);
 	if (hostname == NULL || portname == NULL) {
@@ -3680,8 +3682,13 @@ evhttp_get_request_connection(
 			__func__, hostname, portname, fd));
 
 	/* we need a connection object to put the http request on */
-	evcon = evhttp_connection_base_new(
-		http->base, NULL, hostname, atoi(portname));
+	save_errno = errno;
+	errno = 0;
+	port = (ev_uint16_t) strtol(portname, NULL, 10);
+	if (errno != 0)
+		return (NULL);
+	errno = save_errno;
+	evcon = evhttp_connection_base_new(http->base, NULL, hostname, port);
 	mm_free(hostname);
 	mm_free(portname);
 	if (evcon == NULL)
-- 
1.7.7.5 (Apple Git-26)


From c80f875e05dd7cabc41ae674fc04271d670eb39b Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:14:38 -0400
Subject: [PATCH 20/40] libevent-2.0.18-stable/http.c: line 1501:   INT06: Use
 strtol() et al. to convert a string token to an
 integer

 req->response_code = atoi(number);
                      ^
---
 http.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/http.c b/http.c
index 729f164..84a39c0 100644
--- a/http.c
+++ b/http.c
@@ -1487,6 +1487,7 @@ evhttp_parse_response_line(struct evhttp_request *req, char *line)
 	char *protocol;
 	char *number;
 	const char *readable = "";
+	int save_errno;
 
 	protocol = strsep(&line, " ");
 	if (line == NULL)
@@ -1498,7 +1499,12 @@ evhttp_parse_response_line(struct evhttp_request *req, char *line)
 	if (evhttp_parse_http_version(protocol, req) < 0)
 		return (-1);
 
-	req->response_code = atoi(number);
+	save_errno = errno;
+	errno = 0;
+	req->response_code = strtol(number, NULL, 10);
+	if (errno != 0)
+		return (-1);
+	errno = save_errno;
 	if (!evhttp_valid_response_code(req->response_code)) {
 		event_debug(("%s: bad response code \"%s\"",
 			__func__, number));
-- 
1.7.7.5 (Apple Git-26)


From 5ccfc2a88e67fd62bc4699421ba7368a7eb454d9 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:16:51 -0400
Subject: [PATCH 21/40] libevent-2.0.18-stable/sample/le-proxy.c: line 232:  
 INT06: Use strtol() et al. to convert a string token
 to an integer

  int p = atoi(argv[i]);
          ^
---
 sample/le-proxy.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/sample/le-proxy.c b/sample/le-proxy.c
index 4bc8fc1..91de738 100644
--- a/sample/le-proxy.c
+++ b/sample/le-proxy.c
@@ -229,7 +229,12 @@ main(int argc, char **argv)
 	socklen = sizeof(listen_on_addr);
 	if (evutil_parse_sockaddr_port(argv[i],
 		(struct sockaddr*)&listen_on_addr, &socklen)<0) {
-		int p = atoi(argv[i]);
+		int save_errno = errno;
+		errno = 0;
+		int p = (int) strtol(argv[i], NULL, 10);
+		if (errno != 0)
+			syntax();
+		errno = save_errno;
 		struct sockaddr_in *sin = (struct sockaddr_in*)&listen_on_addr;
 		if (p < 1 || p > 65535)
 			syntax();
-- 
1.7.7.5 (Apple Git-26)


From d184b88c845475700f99ad02685c9029b327dec7 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:18:25 -0400
Subject: [PATCH 22/40] libevent-2.0.18-stable/test/bench.c: line 145:  
 INT06: Use strtol() et al. to convert a string token
 to an integer

   num_pipes = atoi(optarg);
               ^

libevent-2.0.18-stable/test/bench.c: line 148:
  INT06: Use strtol() et al. to convert a string token to an integer

   num_active = atoi(optarg);
                ^

libevent-2.0.18-stable/test/bench.c: line 151:
  INT06: Use strtol() et al. to convert a string token to an integer

   num_writes = atoi(optarg);
                ^
---
 test/bench.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/bench.c b/test/bench.c
index 66b7d71..304528d 100644
--- a/test/bench.c
+++ b/test/bench.c
@@ -142,13 +142,13 @@ main(int argc, char **argv)
 	while ((c = getopt(argc, argv, "n:a:w:")) != -1) {
 		switch (c) {
 		case 'n':
-			num_pipes = atoi(optarg);
+			num_pipes = (int) strtol(optarg, NULL, 10);
 			break;
 		case 'a':
-			num_active = atoi(optarg);
+			num_active = (int) strtol(optarg, NULL, 10);
 			break;
 		case 'w':
-			num_writes = atoi(optarg);
+			num_writes = (int) strtol(optarg, NULL, 10);
 			break;
 		default:
 			fprintf(stderr, "Illegal argument \"%c\"\n", c);
-- 
1.7.7.5 (Apple Git-26)


From 9ad9a51d6b335fdfb511c2f959b759f371747bcc Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:19:46 -0400
Subject: [PATCH 23/40] libevent-2.0.18-stable/test/bench_cascade.c: line 147:
   INT06: Use strtol() et al. to convert a string
 token to an integer

   num_pipes = atoi(optarg);
               ^
---
 test/bench_cascade.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/bench_cascade.c b/test/bench_cascade.c
index 08b7f94..2b9a60f 100644
--- a/test/bench_cascade.c
+++ b/test/bench_cascade.c
@@ -144,7 +144,7 @@ main(int argc, char **argv)
 	while ((c = getopt(argc, argv, "n:")) != -1) {
 		switch (c) {
 		case 'n':
-			num_pipes = atoi(optarg);
+			num_pipes = (int) strtol(optarg, NULL, 10);
 			break;
 		default:
 			fprintf(stderr, "Illegal argument \"%c\"\n", c);
-- 
1.7.7.5 (Apple Git-26)


From 49ec85ba2024439f35f2f2fab168cc459c158869 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:21:12 -0400
Subject: [PATCH 24/40] libevent-2.0.18-stable/test/regress_ssl.c: line 173:  
 INT06: Use strtol() et al. to convert a string token
 to an integer

 n = atoi(line);
     ^
---
 test/regress_ssl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress_ssl.c b/test/regress_ssl.c
index a2b7f05..b491923 100644
--- a/test/regress_ssl.c
+++ b/test/regress_ssl.c
@@ -170,7 +170,7 @@ respond_to_number(struct bufferevent *bev, void *ctx)
 	line = evbuffer_readln(b, NULL, EVBUFFER_EOL_LF);
 	if (! line)
 		return;
-	n = atoi(line);
+	n = (int) strtol(line, NULL, 10);
 	if (n <= 0)
 		TT_FAIL(("Bad number: %s", line));
 	TT_BLATHER(("The number was %d", n));
-- 
1.7.7.5 (Apple Git-26)


From a0515902eae948291fbf12f20798c2631f071a2a Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:23:02 -0400
Subject: [PATCH 25/40] libevent-2.0.18-stable/test/regress_testutils.c: line
 159:   INT06: Use strtol() et al. to convert a string
 token to an integer

  int err = atoi(tab->ans);
            ^
---
 test/regress_testutils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress_testutils.c b/test/regress_testutils.c
index 9b3046e..6cf1a61 100644
--- a/test/regress_testutils.c
+++ b/test/regress_testutils.c
@@ -156,7 +156,7 @@ regress_dns_server_cb(struct evdns_server_request *req, void *data)
 	++tab->seen;
 
 	if (!strcmp(tab->anstype, "err")) {
-		int err = atoi(tab->ans);
+		int err = (int) strtol(tab->ans, NULL, 10);
 		tt_assert(! evdns_server_request_respond(req, err));
 		return;
 	} else if (!strcmp(tab->anstype, "errsoa")) {
-- 
1.7.7.5 (Apple Git-26)


From 3223d0e5710fac6e98c0b2388e3b95b2a9bf2d6a Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:23:55 -0400
Subject: [PATCH 26/40] libevent-2.0.18-stable/test/regress_testutils.c: line
 163:   INT06: Use strtol() et al. to convert a string
 token to an integer

  int err = atoi(tab->ans);
            ^
---
 test/regress_testutils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress_testutils.c b/test/regress_testutils.c
index 6cf1a61..3c68b8f 100644
--- a/test/regress_testutils.c
+++ b/test/regress_testutils.c
@@ -160,7 +160,7 @@ regress_dns_server_cb(struct evdns_server_request *req, void *data)
 		tt_assert(! evdns_server_request_respond(req, err));
 		return;
 	} else if (!strcmp(tab->anstype, "errsoa")) {
-		int err = atoi(tab->ans);
+		int err = (int) strtol(tab->ans, NULL, 10);
 		char soa_record[] =
 			"\x04" "dns1" "\x05" "icann" "\x03" "org" "\0"
 			"\x0a" "hostmaster" "\x05" "icann" "\x03" "org" "\0"
-- 
1.7.7.5 (Apple Git-26)


From 10cd8ca97f53f0c4223dac1b97f5fbb8e59b4ac0 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:27:25 -0400
Subject: [PATCH 27/40] libevent-2.0.18-stable/devpoll.c: line 273:   INT13:
 Use bitwise operators only on unsigned operands

 if ((res & (POLLIN|POLLOUT)) != (POLLIN|POLLOUT)) {
      ^
---
 devpoll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/devpoll.c b/devpoll.c
index f99cc01..63ed558 100644
--- a/devpoll.c
+++ b/devpoll.c
@@ -251,7 +251,7 @@ static int
 devpoll_del(struct event_base *base, int fd, short old, short events, void *p)
 {
 	struct devpollop *devpollop = base->evbase;
-	int res;
+	unsigned int res;
 	(void)p;
 
 	res = 0;
-- 
1.7.7.5 (Apple Git-26)


From adc017d33ef316695b1e69bf10eea99166a6d704 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:29:25 -0400
Subject: [PATCH 28/40] libevent-2.0.18-stable/devpoll.c: line 203:   INT13:
 Use bitwise operators only on unsigned operands

  if (what & POLLHUP)
      ^
---
 devpoll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/devpoll.c b/devpoll.c
index 63ed558..3db9371 100644
--- a/devpoll.c
+++ b/devpoll.c
@@ -198,7 +198,7 @@ devpoll_dispatch(struct event_base *base, struct timeval *tv)
 
 	for (i = 0; i < res; i++) {
 		int which = 0;
-		int what = events[i].revents;
+		unsigned int what = events[i].revents;
 
 		if (what & POLLHUP)
 			what |= POLLIN | POLLOUT;
-- 
1.7.7.5 (Apple Git-26)


From d8f7fcfe2a07ae8bb1d4a0734ab5bf90a55b4431 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:30:14 -0400
Subject: [PATCH 29/40] libevent-2.0.18-stable/epoll.c: line 427:   INT13: Use
 bitwise operators only on unsigned operands

  if (what & (EPOLLHUP|EPOLLERR)) {
      ^
---
 epoll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/epoll.c b/epoll.c
index 4c5c3da..52ac7f4 100644
--- a/epoll.c
+++ b/epoll.c
@@ -421,7 +421,7 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
 	EVUTIL_ASSERT(res <= epollop->nevents);
 
 	for (i = 0; i < res; i++) {
-		int what = events[i].events;
+		unsigned int what = events[i].events;
 		short ev = 0;
 
 		if (what & (EPOLLHUP|EPOLLERR)) {
-- 
1.7.7.5 (Apple Git-26)


From 401cba4ad29d7919cd599309757dd6abe3549473 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:31:31 -0400
Subject: [PATCH 30/40] libevent-2.0.18-stable/event.c: line 1848:   INT13:
 Use bitwise operators only on unsigned operands

 if (tv != NULL && (flags & event & EV_TIMEOUT)) {
                    ^
---
 event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/event.c b/event.c
index 5c17917..1382e48 100644
--- a/event.c
+++ b/event.c
@@ -1831,7 +1831,7 @@ event_priority_set(struct event *ev, int pri)
 int
 event_pending(const struct event *ev, short event, struct timeval *tv)
 {
-	int flags = 0;
+	unsigned int flags = 0;
 
 	_event_debug_assert_is_setup(ev);
 
-- 
1.7.7.5 (Apple Git-26)


From 40c64fb4053ea228d502af4e85b0e7dee022d22f Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:32:11 -0400
Subject: [PATCH 31/40] libevent-2.0.18-stable/evutil.c: line 1697:   INT13:
 Use bitwise operators only on unsigned operands

  addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
                        ^

libevent-2.0.18-stable/evutil.c: line 1697:
  INT13: Use bitwise operators only on unsigned operands

  addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
                                  ^

libevent-2.0.18-stable/evutil.c: line 1697:
  INT13: Use bitwise operators only on unsigned operands

  addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
                                            ^

libevent-2.0.18-stable/evutil.c: line 1697:
  INT13: Use bitwise operators only on unsigned operands

  addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
                                                    ^
---
 evutil.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/evutil.c b/evutil.c
index 7815900..a7e1ae9 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1685,15 +1685,15 @@ evutil_inet_pton(int af, const char *src, void *dst)
 	return inet_pton(af, src, dst);
 #else
 	if (af == AF_INET) {
-		int a,b,c,d;
+		unsigned int a,b,c,d;
 		char more;
 		struct in_addr *addr = dst;
-		if (sscanf(src, "%d.%d.%d.%d%c", &a,&b,&c,&d,&more) != 4)
+		if (sscanf(src, "%u.%u.%u.%u%c", &a,&b,&c,&d,&more) != 4)
 			return 0;
-		if (a < 0 || a > 255) return 0;
-		if (b < 0 || b > 255) return 0;
-		if (c < 0 || c > 255) return 0;
-		if (d < 0 || d > 255) return 0;
+		if (a > 255) return 0;
+		if (b > 255) return 0;
+		if (c > 255) return 0;
+		if (d > 255) return 0;
 		addr->s_addr = htonl((a<<24) | (b<<16) | (c<<8) | d);
 		return 1;
 #ifdef AF_INET6
-- 
1.7.7.5 (Apple Git-26)


From 8592d1815f9cbe54a5ff559f293636f250302d00 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:33:52 -0400
Subject: [PATCH 32/40] libevent-2.0.18-stable/evutil.c: line 1729:   INT13:
 Use bitwise operators only on unsigned operands

   words[6] = (byte1<<8) | byte2;
               ^

libevent-2.0.18-stable/evutil.c: line 1729:
  INT13: Use bitwise operators only on unsigned operands

   words[6] = (byte1<<8) | byte2;
                           ^

libevent-2.0.18-stable/evutil.c: line 1730:
  INT13: Use bitwise operators only on unsigned operands

   words[7] = (byte3<<8) | byte4;
               ^

libevent-2.0.18-stable/evutil.c: line 1730:
  INT13: Use bitwise operators only on unsigned operands

   words[7] = (byte3<<8) | byte4;
                           ^
---
 evutil.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/evutil.c b/evutil.c
index a7e1ae9..95078c8 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1708,7 +1708,7 @@ evutil_inet_pton(int af, const char *src, void *dst)
 		else if (!dot)
 			eow = src+strlen(src);
 		else {
-			int byte1,byte2,byte3,byte4;
+			unsigned int byte1,byte2,byte3,byte4;
 			char more;
 			for (eow = dot-1; eow >= src && EVUTIL_ISDIGIT(*eow); --eow)
 				;
@@ -1716,7 +1716,7 @@ evutil_inet_pton(int af, const char *src, void *dst)
 
 			/* We use "scanf" because some platform inet_aton()s are too lax
 			 * about IPv4 addresses of the form "1.2.3" */
-			if (sscanf(eow, "%d.%d.%d.%d%c",
+			if (sscanf(eow, "%u.%u.%u.%u%c",
 					   &byte1,&byte2,&byte3,&byte4,&more) != 4)
 				return 0;
 
-- 
1.7.7.5 (Apple Git-26)


From 1c8fd426dd2fa39067a956b08ce2e2c61cccb4ea Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:37:14 -0400
Subject: [PATCH 33/40] libevent-2.0.18-stable/evutil.c: line 344:   INT13:
 Use bitwise operators only on unsigned operands

 if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
                        ^
---
 evutil.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/evutil.c b/evutil.c
index 95078c8..4668bd2 100644
--- a/evutil.c
+++ b/evutil.c
@@ -336,11 +336,15 @@ int
 evutil_make_socket_closeonexec(evutil_socket_t fd)
 {
 #if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
-	int flags;
-	if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
+	unsigned int flags;
+	int save_errno = errno;
+	errno = 0;
+	flags = fcntl(fd, F_GETFD, NULL);
+	if (errno != 0) {
 		event_warn("fcntl(%d, F_GETFD)", fd);
 		return -1;
 	}
+	errno = save_errno;
 	if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
 		event_warn("fcntl(%d, F_SETFD)", fd);
 		return -1;
-- 
1.7.7.5 (Apple Git-26)


From 42751bd5337245ce02525f5ebd419c5fb8b3ccf5 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:38:52 -0400
Subject: [PATCH 34/40] libevent-2.0.18-stable/evutil.c: line 311:   INT13:
 Use bitwise operators only on unsigned operands

  if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
                         ^
---
 evutil.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/evutil.c b/evutil.c
index 4668bd2..73eb264 100644
--- a/evutil.c
+++ b/evutil.c
@@ -303,11 +303,15 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
 	}
 #else
 	{
-		int flags;
-		if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
+		unsigned int flags;
+		int save_errno = errno;
+		errno = 0;
+		flags = fcntl(fd, F_GETFL, NULL);
+		if (errno != 0) {
 			event_warn("fcntl(%d, F_GETFL)", fd);
 			return -1;
 		}
+		errno = save_errno;
 		if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
 			event_warn("fcntl(%d, F_SETFL)", fd);
 			return -1;
-- 
1.7.7.5 (Apple Git-26)


From 9162a9b98a7f77168c190194812a8e82fb9cf54d Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:40:30 -0400
Subject: [PATCH 35/40] libevent-2.0.18-stable/poll.c: line 195:   INT13: Use
 bitwise operators only on unsigned operands

  if (what & (POLLHUP|POLLERR))
      ^
---
 poll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/poll.c b/poll.c
index 04d311b..f594b06 100644
--- a/poll.c
+++ b/poll.c
@@ -182,7 +182,7 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
 
 	i = random() % nfds;
 	for (j = 0; j < nfds; j++) {
-		int what;
+		unsigned int what;
 		if (++i == nfds)
 			i = 0;
 		what = event_set[i].revents;
-- 
1.7.7.5 (Apple Git-26)


From 3d3bec993f8788376be83c2fd15b9a22fd6623fb Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:43:24 -0400
Subject: [PATCH 36/40] libevent-2.0.18-stable/test/regress.gen.c: line 488:  
 INT13: Use bitwise operators only on unsigned
 operands

  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
                                         ^
---
 test/regress.gen.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress.gen.c b/test/regress.gen.c
index 141f4f4..18599bd 100644
--- a/test/regress.gen.c
+++ b/test/regress.gen.c
@@ -79,7 +79,7 @@ msg_run_expand_to_hold_more(struct msg *msg)
 {
   int tobe_allocated = msg->run_num_allocated;
   struct run** new_data = NULL;
-  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
+  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated*2;
   new_data = (struct run**) realloc(msg->run_data,
       tobe_allocated * sizeof(struct run*));
   if (new_data == NULL)
-- 
1.7.7.5 (Apple Git-26)


From 37f34501f72e90c0be20b82f4832879794e8047d Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:44:04 -0400
Subject: [PATCH 37/40] libevent-2.0.18-stable/test/regress.gen.c: line 82:  
 INT13: Use bitwise operators only on unsigned
 operands

  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
                                         ^
---
 test/regress.gen.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/regress.gen.c b/test/regress.gen.c
index 18599bd..cf3096f 100644
--- a/test/regress.gen.c
+++ b/test/regress.gen.c
@@ -485,7 +485,7 @@ kill_how_often_expand_to_hold_more(struct kill *msg)
 {
   int tobe_allocated = msg->how_often_num_allocated;
   ev_uint32_t* new_data = NULL;
-  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
+  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated*2;
   new_data = (ev_uint32_t*) realloc(msg->how_often_data,
       tobe_allocated * sizeof(ev_uint32_t));
   if (new_data == NULL)
-- 
1.7.7.5 (Apple Git-26)


From d0724c502a5353a2b4fd639efcca38616675ccb7 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:44:57 -0400
Subject: [PATCH 38/40] libevent-2.0.18-stable/test/regress.gen.c: line 799:  
 INT13: Use bitwise operators only on unsigned
 operands

  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
                                         ^

libevent-2.0.18-stable/test/regress.gen.c: line 836:
  INT13: Use bitwise operators only on unsigned operands

  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
                                         ^
---
 test/regress.gen.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/regress.gen.c b/test/regress.gen.c
index cf3096f..1f8e059 100644
--- a/test/regress.gen.c
+++ b/test/regress.gen.c
@@ -796,7 +796,7 @@ run_notes_expand_to_hold_more(struct run *msg)
 {
   int tobe_allocated = msg->notes_num_allocated;
   char ** new_data = NULL;
-  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
+  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated*2;
   new_data = (char **) realloc(msg->notes_data,
       tobe_allocated * sizeof(char *));
   if (new_data == NULL)
@@ -833,7 +833,7 @@ run_other_numbers_expand_to_hold_more(struct run *msg)
 {
   int tobe_allocated = msg->other_numbers_num_allocated;
   ev_uint32_t* new_data = NULL;
-  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated << 1;
+  tobe_allocated = !tobe_allocated ? 1 : tobe_allocated*2;
   new_data = (ev_uint32_t*) realloc(msg->other_numbers_data,
       tobe_allocated * sizeof(ev_uint32_t));
   if (new_data == NULL)
-- 
1.7.7.5 (Apple Git-26)


From 5f0d362d3cd7b8326a64a33437746788436d947e Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:48:59 -0400
Subject: [PATCH 39/40] libevent-2.0.18-stable/sample/http-server.c: line 225:
   INT20: Do not perform integer arithmetic inline
 with memory allocation

  pattern = malloc(dirlen+3);
                         ^
---
 sample/http-server.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sample/http-server.c b/sample/http-server.c
index fb45579..6dd2a68 100644
--- a/sample/http-server.c
+++ b/sample/http-server.c
@@ -210,6 +210,7 @@ send_document_cb(struct evhttp_request *req, void *arg)
 		HANDLE d;
 		WIN32_FIND_DATAA ent;
 		char *pattern;
+		size_t pattern_size;
 		size_t dirlen;
 #else
 		DIR *d;
@@ -222,7 +223,8 @@ send_document_cb(struct evhttp_request *req, void *arg)
 
 #ifdef WIN32
 		dirlen = strlen(whole_path);
-		pattern = malloc(dirlen+3);
+		pattern_size = dirlen+3;
+		pattern = malloc(pattern_size);
 		memcpy(pattern, whole_path, dirlen);
 		pattern[dirlen] = '\\';
 		pattern[dirlen+1] = '*';
-- 
1.7.7.5 (Apple Git-26)


From c82646bb6108fb37e8c6b3d1dca6dcfe288de741 Mon Sep 17 00:00:00 2001
From: Mansour Moufid <mansourmoufid@gmail.com>
Date: Thu, 5 Apr 2012 18:50:18 -0400
Subject: [PATCH 40/40] libevent-2.0.18-stable/test/regress.c: line 2202:  
 INT20: Do not perform integer arithmetic inline with
 memory allocation

 char *mem = malloc(len+16);
                       ^
---
 test/regress.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/regress.c b/test/regress.c
index 2d48583..0ebc9a9 100644
--- a/test/regress.c
+++ b/test/regress.c
@@ -2199,7 +2199,8 @@ check_dummy_mem_ok(void *_mem)
 static void *
 dummy_malloc(size_t len)
 {
-	char *mem = malloc(len+16);
+	size_t mem_size = len+16;
+	char *mem = malloc(mem_size);
 	memcpy(mem, "{[<guardedram>]}", 16);
 	return mem+16;
 }
-- 
1.7.7.5 (Apple Git-26)

