summaryrefslogtreecommitdiff
path: root/evutil.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-11-01 13:43:43 -0400
committerNick Mathewson <nickm@torproject.org>2010-11-01 13:43:43 -0400
commit7484df61c981fc33db2152f75ddac689791b9929 (patch)
tree2eac3c92cb8555235d01695cbb8fe148ae66b5c8 /evutil.c
parentb6a158ca22359831475e4cb10498063f72b07823 (diff)
downloadlibevent-7484df61c981fc33db2152f75ddac689791b9929.tar.gz
Fix even more win64 warnings
Diffstat (limited to 'evutil.c')
-rw-r--r--evutil.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/evutil.c b/evutil.c
index 9bf0d92d..6c34d6b1 100644
--- a/evutil.c
+++ b/evutil.c
@@ -83,8 +83,8 @@
#define open _open
#define read _read
#define close _close
-#define fstat _fstat
-#define stat _stat
+#define fstat _fstati64
+#define stat _stati64
#endif
/**
@@ -131,7 +131,12 @@ evutil_read_file(const char *filename, char **content_out, size_t *len_out,
return -2;
}
read_so_far = 0;
- while ((r = read(fd, mem+read_so_far, st.st_size - read_so_far)) > 0) {
+#ifdef WIN32
+#define N_TO_READ(x) ((x) > INT_MAX) ? INT_MAX : ((int)(x))
+#else
+#defien N_TO_READ(x) (x)
+#endif
+ while ((r = read(fd, mem+read_so_far, N_TO_READ(st.st_size - read_so_far))) > 0) {
read_so_far += r;
if (read_so_far >= (size_t)st.st_size)
break;
@@ -1717,7 +1722,7 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
if (!(cp = strchr(ip_as_string, ']'))) {
return -1;
}
- len = cp-(ip_as_string + 1);
+ len = (int) ( cp-(ip_as_string + 1) );
if (len > (int)sizeof(buf)-1) {
return -1;
}