aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-12-07 14:12:17 -0500
committerNick Mathewson <nickm@torproject.org>2012-12-07 14:12:17 -0500
commit3fa9151f2610fdad23df02b2b914881286b22480 (patch)
treeef9f91dfb3c886a59cc591739dc7ddb6f8a703a5
parentcd4f56a37c3513cdca3463c3638067380af29219 (diff)
parent4458fd0cd8fa259f0ee8195e1aa86d5b7c6f8919 (diff)
downloadtor-3fa9151f2610fdad23df02b2b914881286b22480.tar
tor-3fa9151f2610fdad23df02b2b914881286b22480.tar.gz
Merge branch 'win64-7260'
Conflicts: src/or/dns.c
-rw-r--r--changes/bug72603
-rw-r--r--configure.ac2
-rw-r--r--src/common/compat.c3
-rw-r--r--src/common/compat.h15
-rw-r--r--src/common/procmon.c37
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/connection_edge.c14
-rw-r--r--src/or/connection_or.c20
-rw-r--r--src/or/control.c3
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/dns.c15
-rw-r--r--src/or/main.c2
-rw-r--r--src/or/relay.c6
-rw-r--r--src/test/test_addr.c2
-rw-r--r--src/test/test_containers.c8
-rw-r--r--src/test/test_crypto.c6
-rw-r--r--src/test/test_util.c10
-rw-r--r--src/win32/orconfig.h6
18 files changed, 104 insertions, 52 deletions
diff --git a/changes/bug7260 b/changes/bug7260
new file mode 100644
index 000000000..8eb54c381
--- /dev/null
+++ b/changes/bug7260
@@ -0,0 +1,3 @@
+ o Minor bugfixes:
+ - Compile on win64 using mingw64. Fixes bug 7260; patches from "yayooo".
+
diff --git a/configure.ac b/configure.ac
index 9963a97d4..9ddbbe2c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,6 +318,7 @@ AC_CHECK_FUNCS(
sysconf \
uname \
vasprintf \
+ _vscprintf
)
if test "$enable_threads" = "yes"; then
@@ -784,6 +785,7 @@ AC_CHECK_SIZEOF(__int64)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(pid_t)
AC_CHECK_TYPES([uint, u_char, ssize_t])
diff --git a/src/common/compat.c b/src/common/compat.c
index 89f9cfa3d..d0e516c2c 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -425,11 +425,10 @@ tor_vasprintf(char **strp, const char *fmt, va_list args)
else
*strp = strp_tmp;
return r;
-#elif defined(_MSC_VER)
+#elif defined(HAVE__VSCPRINTF)
/* On Windows, _vsnprintf won't tell us the length of the string if it
* overflows, so we need to use _vcsprintf to tell how much to allocate */
int len, r;
- char *res;
len = _vscprintf(fmt, args);
if (len < 0) {
*strp = NULL;
diff --git a/src/common/compat.h b/src/common/compat.h
index 9ad03d33c..9c544fa30 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -239,6 +239,19 @@ size_t strlcpy(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
#define I64_FORMAT "%lld"
#endif
+#if (SIZEOF_INTPTR_T == SIZEOF_INT)
+#define INTPTR_T_FORMAT "%d"
+#define INTPTR_PRINTF_ARG(x) ((int)(x))
+#elif (SIZEOF_INTPTR_T == SIZEOF_LONG)
+#define INTPTR_T_FORMAT "%ld"
+#define INTPTR_PRINTF_ARG(x) ((long)(x))
+#elif (SIZEOF_INTPTR_T == 8)
+#define INTPTR_T_FORMAT I64_FORMAT
+#define INTPTR_PRINTF_ARG(x) I64_PRINTF_ARG(x)
+#else
+#error Unknown: SIZEOF_INTPTR_T
+#endif
+
/** Represents an mmaped file. Allocated via tor_mmap_file; freed with
* tor_munmap_file. */
typedef struct tor_mmap_t {
@@ -403,11 +416,13 @@ typedef int socklen_t;
* any inadvertant checks for the socket being <= 0 or > 0 will probably
* still work. */
#define tor_socket_t intptr_t
+#define TOR_SOCKET_T_FORMAT INTPTR_T_FORMAT
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
#define TOR_INVALID_SOCKET INVALID_SOCKET
#else
/** Type used for a network socket. */
#define tor_socket_t int
+#define TOR_SOCKET_T_FORMAT "%d"
/** Macro: true iff 's' is a possible value for a valid initialized socket. */
#define SOCKET_OK(s) ((s) >= 0)
/** Error/uninitialized value for a tor_socket_t. */
diff --git a/src/common/procmon.c b/src/common/procmon.c
index 36b1a4855..08fcfec49 100644
--- a/src/common/procmon.c
+++ b/src/common/procmon.c
@@ -25,9 +25,21 @@
#ifdef _WIN32
#include <windows.h>
+#endif
-/* Windows does not define pid_t, but _getpid() returns an int. */
+#if (0 == SIZEOF_PID_T) && defined(_WIN32)
+/* Windows does not define pid_t sometimes, but _getpid() returns an int.
+ * Everybody else needs to have a pid_t. */
typedef int pid_t;
+#define PID_T_FORMAT "%d"
+#elif (SIZEOF_PID_T == SIZEOF_INT) || (SIZEOF_PID_T == SIZEOF_SHORT)
+#define PID_T_FORMAT "%d"
+#elif (SIZEOF_PID_T == SIZEOF_LONG)
+#define PID_T_FORMAT "%ld"
+#elif (SIZEOF_PID_T == SIZEOF_INT64_T)
+#define PID_T_FORMAT I64_FORMAT
+#else
+#error Unknown: SIZEOF_PID_T
#endif
/* Define to 1 if process-termination monitors on this OS and Libevent
@@ -204,15 +216,17 @@ tor_process_monitor_new(struct event_base *base,
if (procmon->hproc != NULL) {
procmon->poll_hproc = 1;
- log_info(procmon->log_domain, "Successfully opened handle to process %d; "
+ log_info(procmon->log_domain, "Successfully opened handle to process "
+ PID_T_FORMAT"; "
"monitoring it.",
- (int)(procmon->pid));
+ procmon->pid);
} else {
/* If we couldn't get a handle to the process, we'll try again the
* first time we poll. */
- log_info(procmon->log_domain, "Failed to open handle to process %d; will "
+ log_info(procmon->log_domain, "Failed to open handle to process "
+ PID_T_FORMAT"; will "
"try again later.",
- (int)(procmon->pid));
+ procmon->pid);
}
#endif
@@ -257,7 +271,8 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
if (!GetExitCodeProcess(procmon->hproc, &exit_code)) {
char *errmsg = format_win32_error(GetLastError());
log_warn(procmon->log_domain, "Error \"%s\" occurred while polling "
- "handle for monitored process %d; assuming it's dead.",
+ "handle for monitored process "PID_T_FORMAT"; assuming "
+ "it's dead.",
errmsg, procmon->pid);
tor_free(errmsg);
its_dead_jim = 1;
@@ -273,7 +288,7 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
if (procmon->hproc != NULL) {
log_info(procmon->log_domain, "Successfully opened handle to monitored "
- "process %d.",
+ "process "PID_T_FORMAT".",
procmon->pid);
its_dead_jim = 0;
procmon->poll_hproc = 1;
@@ -292,8 +307,8 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
if (!its_dead_jim)
log_info(procmon->log_domain, "Failed to open handle to monitored "
- "process %d, and error code %lu (%s) is not 'invalid "
- "parameter' -- assuming the process is still alive.",
+ "process "PID_T_FORMAT", and error code %lu (%s) is not "
+ "'invalid parameter' -- assuming the process is still alive.",
procmon->pid,
err_code, errmsg);
@@ -307,8 +322,8 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
#endif
log(its_dead_jim ? LOG_NOTICE : LOG_INFO,
- procmon->log_domain, "Monitored process %d is %s.",
- (int)procmon->pid,
+ procmon->log_domain, "Monitored process "PID_T_FORMAT" is %s.",
+ procmon->pid,
its_dead_jim ? "dead" : "still alive");
if (its_dead_jim) {
diff --git a/src/or/connection.c b/src/or/connection.c
index dbcfc41d2..223bbd938 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1514,7 +1514,7 @@ connection_connect(connection_t *conn, const char *address,
/* it succeeded. we're connected. */
log_fn(inprogress?LOG_DEBUG:LOG_INFO, LD_NET,
- "Connection to %s:%u %s (sock %d).",
+ "Connection to %s:%u %s (sock "TOR_SOCKET_T_FORMAT").",
escaped_safe_str_client(address),
port, inprogress?"in progress":"established", s);
conn->s = s;
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 67e382bdb..3f33665e1 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -124,7 +124,8 @@ connection_edge_reached_eof(edge_connection_t *conn)
/* it still has stuff to process. don't let it die yet. */
return 0;
}
- log_info(LD_EDGE,"conn (fd %d) reached eof. Closing.", conn->base_.s);
+ log_info(LD_EDGE,"conn (fd "TOR_SOCKET_T_FORMAT") reached eof. Closing.",
+ conn->base_.s);
if (!conn->base_.marked_for_close) {
/* only mark it if not already marked. it's possible to
* get the 'end' right around when the client hangs up on us. */
@@ -313,11 +314,12 @@ connection_edge_end(edge_connection_t *conn, uint8_t reason)
}
if (circ && !circ->marked_for_close) {
- log_debug(LD_EDGE,"Sending end on conn (fd %d).",conn->base_.s);
+ log_debug(LD_EDGE,"Sending end on conn (fd "TOR_SOCKET_T_FORMAT").",
+ conn->base_.s);
connection_edge_send_command(conn, RELAY_COMMAND_END,
payload, payload_len);
} else {
- log_debug(LD_EDGE,"No circ to send end on conn (fd %d).",
+ log_debug(LD_EDGE,"No circ to send end on conn (fd "TOR_SOCKET_T_FORMAT").",
conn->base_.s);
}
@@ -1810,7 +1812,8 @@ connection_ap_handshake_send_begin(entry_connection_t *ap_conn)
edge_conn->package_window = STREAMWINDOW_START;
edge_conn->deliver_window = STREAMWINDOW_START;
base_conn->state = AP_CONN_STATE_CONNECT_WAIT;
- log_info(LD_APP,"Address/port sent, ap socket %d, n_circ_id %d",
+ log_info(LD_APP,"Address/port sent, ap socket "TOR_SOCKET_T_FORMAT
+ ", n_circ_id %d",
base_conn->s, circ->base_.n_circ_id);
control_event_stream_status(ap_conn, STREAM_EVENT_SENT_CONNECT, 0);
@@ -1911,7 +1914,8 @@ connection_ap_handshake_send_resolve(entry_connection_t *ap_conn)
tor_free(base_conn->address); /* Maybe already set by dnsserv. */
base_conn->address = tor_strdup("(Tor_internal)");
base_conn->state = AP_CONN_STATE_RESOLVE_WAIT;
- log_info(LD_APP,"Address sent for resolve, ap socket %d, n_circ_id %d",
+ log_info(LD_APP,"Address sent for resolve, ap socket "TOR_SOCKET_T_FORMAT
+ ", n_circ_id %d",
base_conn->s, circ->base_.n_circ_id);
control_event_stream_status(ap_conn, STREAM_EVENT_NEW, 0);
control_event_stream_status(ap_conn, STREAM_EVENT_SENT_RESOLVE, 0);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index a50088d57..0a3ea7c34 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -849,7 +849,7 @@ connection_or_group_set_badness(or_connection_t *head, int force)
< now) {
log_info(LD_OR,
"Marking OR conn to %s:%d as too old for new circuits "
- "(fd %d, %d secs old).",
+ "(fd "TOR_SOCKET_T_FORMAT", %d secs old).",
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
(int)(now - or_conn->base_.timestamp_created));
connection_or_mark_bad_for_new_circs(or_conn);
@@ -880,7 +880,7 @@ connection_or_group_set_badness(or_connection_t *head, int force)
* and this one is open but not canonical. Mark it bad. */
log_info(LD_OR,
"Marking OR conn to %s:%d as unsuitable for new circuits: "
- "(fd %d, %d secs old). It is not canonical, and we have "
+ "(fd "TOR_SOCKET_T_FORMAT", %d secs old). It is not canonical, and we have "
"another connection to that OR that is.",
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
(int)(now - or_conn->base_.timestamp_created));
@@ -928,8 +928,9 @@ connection_or_group_set_badness(or_connection_t *head, int force)
if (best->is_canonical) {
log_info(LD_OR,
"Marking OR conn to %s:%d as unsuitable for new circuits: "
- "(fd %d, %d secs old). We have a better canonical one "
- "(fd %d; %d secs old).",
+ "(fd "TOR_SOCKET_T_FORMAT", %d secs old). "
+ "We have a better canonical one "
+ "(fd "TOR_SOCKET_T_FORMAT"; %d secs old).",
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
(int)(now - or_conn->base_.timestamp_created),
best->base_.s, (int)(now - best->base_.timestamp_created));
@@ -938,8 +939,9 @@ connection_or_group_set_badness(or_connection_t *head, int force)
&best->real_addr, CMP_EXACT)) {
log_info(LD_OR,
"Marking OR conn to %s:%d as unsuitable for new circuits: "
- "(fd %d, %d secs old). We have a better one with the "
- "same address (fd %d; %d secs old).",
+ "(fd "TOR_SOCKET_T_FORMAT", %d secs old). We have a better "
+ "one with the "
+ "same address (fd "TOR_SOCKET_T_FORMAT"; %d secs old).",
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
(int)(now - or_conn->base_.timestamp_created),
best->base_.s, (int)(now - best->base_.timestamp_created));
@@ -1241,7 +1243,8 @@ connection_tls_start_handshake(or_connection_t *conn, int receiving)
}
#endif
connection_start_reading(TO_CONN(conn));
- log_debug(LD_HANDSHAKE,"starting TLS handshake on fd %d", conn->base_.s);
+ log_debug(LD_HANDSHAKE,"starting TLS handshake on fd "TOR_SOCKET_T_FORMAT,
+ conn->base_.s);
note_crypto_pk_op(receiving ? TLS_HANDSHAKE_S : TLS_HANDSHAKE_C);
IF_HAS_BUFFEREVENT(TO_CONN(conn), {
@@ -1898,7 +1901,8 @@ connection_or_process_cells_from_inbuf(or_connection_t *conn)
while (1) {
log_debug(LD_OR,
- "%d: starting, inbuf_datalen %d (%d pending in tls object).",
+ TOR_SOCKET_T_FORMAT": starting, inbuf_datalen %d "
+ "(%d pending in tls object).",
conn->base_.s,(int)connection_get_inbuf_len(TO_CONN(conn)),
tor_tls_get_pending_bytes(conn->tls));
if (connection_fetch_var_cell_from_buf(conn, &var_cell)) {
diff --git a/src/or/control.c b/src/or/control.c
index d935265d0..75c9af6f7 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1221,7 +1221,8 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len,
connection_mark_for_close(TO_CONN(conn));
return 0;
ok:
- log_info(LD_CONTROL, "Authenticated control connection (%d)", conn->base_.s);
+ log_info(LD_CONTROL, "Authenticated control connection ("TOR_SOCKET_T_FORMAT
+ ")", conn->base_.s);
send_control_done(conn);
conn->base_.state = CONTROL_CONN_STATE_OPEN;
tor_free(password);
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 119892d71..2164e52a4 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -262,7 +262,7 @@ cpuworker_main(void *data)
log_info(LD_OR,
"CPU worker exiting because of error on connection to Tor "
"process.");
- log_info(LD_OR,"(Error on %d was %s)",
+ log_info(LD_OR,"(Error on "TOR_SOCKET_T_FORMAT" was %s)",
fd, tor_socket_strerror(tor_socket_errno(fd)));
}
goto end;
diff --git a/src/or/dns.c b/src/or/dns.c
index 870494a93..e279fbc3b 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -890,19 +890,19 @@ dns_resolve_impl(edge_connection_t *exitconn, int is_resolve,
pending_connection->next = resolve->pending_connections;
resolve->pending_connections = pending_connection;
*made_connection_pending_out = 1;
- log_debug(LD_EXIT,"Connection (fd %d) waiting for pending DNS "
- "resolve of %s", exitconn->base_.s,
+ log_debug(LD_EXIT,"Connection (fd "TOR_SOCKET_T_FORMAT") waiting "
+ "for pending DNS resolve of %s", exitconn->base_.s,
escaped_safe_str(exitconn->base_.address));
return 0;
case CACHE_STATE_CACHED:
- log_debug(LD_EXIT,"Connection (fd %d) found cachedresult for %s",
+ log_debug(LD_EXIT,"Connection (fd "TOR_SOCKET_T_FORMAT") found "
+ "cached answer for %s",
exitconn->base_.s,
escaped_safe_str(resolve->address));
*resolve_out = resolve;
return set_exitconn_info_from_resolve(exitconn, resolve, hostname_out);
-
case CACHE_STATE_DONE:
log_err(LD_BUG, "Found a 'DONE' dns resolve still in the cache.");
tor_fragile_assert();
@@ -1114,7 +1114,7 @@ connection_dns_remove(edge_connection_t *conn)
if (pend->conn == conn) {
resolve->pending_connections = pend->next;
tor_free(pend);
- log_debug(LD_EXIT, "First connection (fd %d) no longer waiting "
+ log_debug(LD_EXIT, "First connection (fd "TOR_SOCKET_T_FORMAT") no longer waiting "
"for resolve of %s",
conn->base_.s,
escaped_safe_str(conn->base_.address));
@@ -1126,7 +1126,8 @@ connection_dns_remove(edge_connection_t *conn)
pend->next = victim->next;
tor_free(victim);
log_debug(LD_EXIT,
- "Connection (fd %d) no longer waiting for resolve of %s",
+ "Connection (fd "TOR_SOCKET_T_FORMAT") no longer waiting "
+ "for resolve of %s",
conn->base_.s, escaped_safe_str(conn->base_.address));
return; /* more are pending */
}
@@ -1968,7 +1969,7 @@ launch_wildcard_check(int min_len, int max_len, int is_ipv6,
/** Launch attempts to resolve a bunch of known-good addresses (configured in
* ServerDNSTestAddresses). [Callback for a libevent timer] */
static void
-launch_test_addresses(int fd, short event, void *args)
+launch_test_addresses(evutil_socket_t fd, short event, void *args)
{
const or_options_t *options = get_options();
(void)fd;
diff --git a/src/or/main.c b/src/or/main.c
index 446836a19..9972e5957 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -813,7 +813,7 @@ conn_close_if_marked(int i)
}
#endif
- log_debug(LD_NET,"Cleaning up connection (fd %d).",conn->s);
+ log_debug(LD_NET,"Cleaning up connection (fd "TOR_SOCKET_T_FORMAT").",conn->s);
/* If the connection we are about to close was trying to connect to
a proxy server and failed, the client won't be able to use that
diff --git a/src/or/relay.c b/src/or/relay.c
index d862e5834..7f49299e2 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1234,7 +1234,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
}
/* XXX add to this log_fn the exit node's nickname? */
- log_info(domain,"%d: end cell (%s) for stream %d. Removing stream.",
+ log_info(domain,TOR_SOCKET_T_FORMAT": end cell (%s) for stream %d. "
+ "Removing stream.",
conn->base_.s,
stream_end_reason_to_string(reason),
conn->stream_id);
@@ -1556,7 +1557,8 @@ connection_edge_package_raw_inbuf(edge_connection_t *conn, int package_partial,
connection_fetch_from_buf(payload, length, TO_CONN(conn));
}
- log_debug(domain,"(%d) Packaging %d bytes (%d waiting).", conn->base_.s,
+ log_debug(domain,TOR_SOCKET_T_FORMAT": Packaging %d bytes (%d waiting).",
+ conn->base_.s,
(int)length, (int)connection_get_inbuf_len(TO_CONN(conn)));
if (sending_optimistically && !sending_from_optimistic) {
diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 586ceb610..d2b25e5e6 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -38,7 +38,7 @@ test_addr_basic(void)
tor_free(cp);
u32 = 3;
test_assert(!addr_port_lookup(LOG_WARN, "localhost", NULL, &u32, &u16));
- test_eq(cp, NULL);
+ test_eq_ptr(cp, NULL);
test_eq(u32, 0x7f000001u);
test_eq(u16, 0);
tor_free(cp);
diff --git a/src/test/test_containers.c b/src/test/test_containers.c
index 399ef8e90..580c5779f 100644
--- a/src/test/test_containers.c
+++ b/src/test/test_containers.c
@@ -266,7 +266,7 @@ test_container_smartlist_strings(void)
SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
smartlist_clear(sl);
cp_alloc = smartlist_pop_last(sl);
- test_eq(cp_alloc, NULL);
+ test_eq_ptr(cp_alloc, NULL);
/* Test uniq() */
smartlist_split_string(sl,
@@ -677,12 +677,12 @@ test_container_strmap(void)
test_eq(strmap_size(map), 0);
test_assert(strmap_isempty(map));
v = strmap_set(map, "K1", (void*)99);
- test_eq(v, NULL);
+ test_eq_ptr(v, NULL);
test_assert(!strmap_isempty(map));
v = strmap_set(map, "K2", (void*)101);
- test_eq(v, NULL);
+ test_eq_ptr(v, NULL);
v = strmap_set(map, "K1", (void*)100);
- test_eq(v, (void*)99);
+ test_eq_ptr(v, (void*)99);
test_eq_ptr(strmap_get(map,"K1"), (void*)100);
test_eq_ptr(strmap_get(map,"K2"), (void*)101);
test_eq_ptr(strmap_get(map,"K-not-there"), NULL);
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index fd983de00..ed1da3967 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -119,9 +119,9 @@ test_crypto_aes(void *arg)
memset(data2, 0, 1024);
memset(data3, 0, 1024);
env1 = crypto_cipher_new(NULL);
- test_neq(env1, 0);
+ test_neq_ptr(env1, 0);
env2 = crypto_cipher_new(crypto_cipher_get_key(env1));
- test_neq(env2, 0);
+ test_neq_ptr(env2, 0);
/* Try encrypting 512 chars. */
crypto_cipher_encrypt(env1, data2, data1, 512);
@@ -152,7 +152,7 @@ test_crypto_aes(void *arg)
memset(data3, 0, 1024);
env2 = crypto_cipher_new(crypto_cipher_get_key(env1));
- test_neq(env2, 0);
+ test_neq_ptr(env2, NULL);
for (j = 0; j < 1024-16; j += 17) {
crypto_cipher_encrypt(env2, data3+j, data1+j, 17);
}
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 4bbcedd16..3ed2cbb54 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -1005,7 +1005,7 @@ test_util_strmisc(void)
const char *s = "abcdefghijklmnopqrstuvwxyz";
cp = tor_strndup(s, 30);
test_streq(cp, s); /* same string, */
- test_neq(cp, s); /* but different pointers. */
+ test_neq_ptr(cp, s); /* but different pointers. */
tor_free(cp);
cp = tor_strndup(s, 5);
@@ -1015,7 +1015,7 @@ test_util_strmisc(void)
s = "a\0b\0c\0d\0e\0";
cp = tor_memdup(s,10);
test_memeq(cp, s, 10); /* same ram, */
- test_neq(cp, s); /* but different pointers. */
+ test_neq_ptr(cp, s); /* but different pointers. */
tor_free(cp);
}
@@ -1495,7 +1495,7 @@ test_util_mmap(void)
/* Now a zero-length file. */
write_str_to_file(fname1, "", 1);
mapping = tor_mmap_file(fname1);
- test_eq(mapping, NULL);
+ test_eq_ptr(mapping, NULL);
test_eq(ERANGE, errno);
unlink(fname1);
@@ -1889,7 +1889,7 @@ test_util_memarea(void)
/* Make sure we don't overalign. */
p1 = memarea_alloc(area, 1);
p2 = memarea_alloc(area, 1);
- test_eq(p1+sizeof(void*), p2);
+ test_eq_ptr(p1+sizeof(void*), p2);
{
malloced_ptr = tor_malloc(64);
test_assert(!memarea_owns_ptr(area, malloced_ptr));
@@ -1934,7 +1934,7 @@ test_util_memarea(void)
memarea_clear(area);
p1 = memarea_alloc(area, 1);
- test_eq(p1, p1_orig);
+ test_eq_ptr(p1, p1_orig);
memarea_clear(area);
/* Check for running over an area's size. */
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 8fe31a02f..cca73b0a3 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -145,6 +145,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the `_vscprintf' function. */
+#define HAVE__VSCPRINTF 1
+
/* Define to 1 iff NULL is represented by a 0 in memory. */
#define NULL_REP_IS_ZERO_BYTES 1
@@ -190,6 +193,9 @@
/* The size of a `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
+/* The size of `pid_t', as computed by sizeof. */
+#define SIZEOF_PID_T 0
+
/* The size of a `short', as computed by sizeof. */
#define SIZEOF_SHORT 2