[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r17908: {tor} Backport 17891 and 17892 to fix openbsd build warnings. Also (in tor/branches/tor-0_2_0-patches: doc src/common src/or)
Author: nickm
Date: 2009-01-05 03:12:33 -0500 (Mon, 05 Jan 2009)
New Revision: 17908
Modified:
tor/branches/tor-0_2_0-patches/doc/TODO.020
tor/branches/tor-0_2_0-patches/src/common/torgzip.c
tor/branches/tor-0_2_0-patches/src/common/util.c
tor/branches/tor-0_2_0-patches/src/or/directory.c
Log:
Backport 17891 and 17892 to fix openbsd build warnings. Also backport snarky comments.
Modified: tor/branches/tor-0_2_0-patches/doc/TODO.020
===================================================================
--- tor/branches/tor-0_2_0-patches/doc/TODO.020 2009-01-05 08:07:33 UTC (rev 17907)
+++ tor/branches/tor-0_2_0-patches/doc/TODO.020 2009-01-05 08:12:33 UTC (rev 17908)
@@ -3,8 +3,8 @@
description of the patch.)
Backport for 0.2.0:
- - r17891: Fix a fun OpenBSD warning.
- - r17892: Fix another fun OpenBSD warning.
+ o r17891: Fix a fun OpenBSD warning.
+ o r17892: Fix another fun OpenBSD warning.
Backport for 0.2.0 once better tested:
Xo r16621: Make some DNS code more robust (partial; see also libevent
Modified: tor/branches/tor-0_2_0-patches/src/common/torgzip.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/common/torgzip.c 2009-01-05 08:07:33 UTC (rev 17907)
+++ tor/branches/tor-0_2_0-patches/src/common/torgzip.c 2009-01-05 08:12:33 UTC (rev 17908)
@@ -143,7 +143,16 @@
}
done:
*out_len = stream->total_out;
- if (stream->total_out > out_size + 4097) {
+#ifdef OPENBSD
+ /* "Hey Rocky! Watch me change an unsigned field to a signed field in a
+ * third-party API!"
+ * "Oh, that trick will just make people do unsafe casts to the unsigned
+ * type in their cross-platform code!"
+ * "Don't be foolish. I'm _sure_ they'll have the good sense to make sure
+ * the newly unsigned field isn't negative." */
+ tor_assert(stream->total_out >= 0);
+#endif
+ if (((size_t)stream->total_out) > out_size + 4097) {
/* If we're wasting more than 4k, don't. */
*out = tor_realloc(*out, stream->total_out + 1);
}
Modified: tor/branches/tor-0_2_0-patches/src/common/util.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/common/util.c 2009-01-05 08:07:33 UTC (rev 17907)
+++ tor/branches/tor-0_2_0-patches/src/common/util.c 2009-01-05 08:12:33 UTC (rev 17908)
@@ -73,8 +73,13 @@
#include <malloc/malloc.h>
#endif
#ifdef HAVE_MALLOC_H
+#ifndef OPENBSD
+/* OpenBSD has a malloc.h, but for our purposes, it only exists in order to
+ * scold us for being so stupid as to autodetect its presence. To be fair,
+ * they've done this since 1996, when autoconf was only 5 years old. */
#include <malloc.h>
#endif
+#endif
/* =====
* Memory management
Modified: tor/branches/tor-0_2_0-patches/src/or/directory.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/directory.c 2009-01-05 08:07:33 UTC (rev 17907)
+++ tor/branches/tor-0_2_0-patches/src/or/directory.c 2009-01-05 08:12:33 UTC (rev 17908)
@@ -8,8 +8,10 @@
#include "or.h"
#if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
+#ifndef OPENBSD
#include <malloc.h>
#endif
+#endif
/**
* \file directory.c