Additional bugfixes and add comments to patches

This commit is contained in:
dcoppa 2012-11-07 14:53:59 +00:00
parent adbcad4656
commit b24e1df035
13 changed files with 904 additions and 24 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.12 2012/11/06 11:50:04 dcoppa Exp $
# $OpenBSD: Makefile,v 1.13 2012/11/07 14:53:59 dcoppa Exp $
COMMENT= UPnP A/V media server
DISTNAME= ushare-1.1a
REVISION= 7
REVISION= 8
EXTRACT_SUFX= .tar.bz2
CATEGORIES= net multimedia

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-configure,v 1.2 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-configure,v 1.3 2012/11/07 14:53:59 dcoppa Exp $
Unbreak build with libupnp>=1.6.17
--- configure.orig Sun Dec 9 14:03:36 2007
+++ configure Fri Nov 2 16:07:09 2012
@@ -642,7 +642,7 @@ echolog "Checking for libthreadutil ..."

View File

@ -1,12 +1,16 @@
$OpenBSD: patch-src_cds_c,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_cds_c,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
--- src/cds.c.orig Sun Dec 9 14:03:36 2007
+++ src/cds.c Fri Nov 2 16:10:37 2012
@@ -20,6 +20,8 @@
+++ src/cds.c Wed Nov 7 13:07:32 2012
@@ -19,7 +19,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
#include <upnp/upnp.h>
#include <upnp/upnptools.h>

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-src_cms_c,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_cms_c,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
--- src/cms.c.orig Sun Dec 9 14:03:36 2007
+++ src/cms.c Fri Nov 2 16:10:37 2012
@@ -20,6 +20,7 @@

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-src_ctrl_telnet_h,v 1.1.1.1 2010/03/22 22:26:59 ajacoutot Exp $
$OpenBSD: patch-src_ctrl_telnet_h,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
--- src/ctrl_telnet.h.orig Tue Feb 9 13:07:37 2010
+++ src/ctrl_telnet.h Tue Feb 9 13:08:36 2010
@@ -25,6 +25,7 @@

View File

@ -1,4 +1,9 @@
$OpenBSD: patch-src_http_c,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_http_c,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
Unbreak build with libupnp>=1.6.17
--- src/http.c.orig Sun Dec 9 14:03:36 2007
+++ src/http.c Fri Nov 2 16:13:38 2012
@@ -25,6 +25,7 @@

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-src_http_h,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_http_h,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Unbreak build with libupnp>=1.6.17
--- src/http.h.orig Sun Dec 9 14:03:36 2007
+++ src/http.h Fri Nov 2 16:13:38 2012
@@ -25,6 +25,13 @@

View File

@ -1,15 +1,19 @@
$OpenBSD: patch-src_mime_c,v 1.2 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_mime_c,v 1.3 2012/11/07 14:53:59 dcoppa Exp $
--- src/mime.c.orig Sun Dec 9 14:03:36 2007
+++ src/mime.c Fri Nov 2 16:10:37 2012
@@ -21,6 +21,7 @@
+++ src/mime.c Wed Nov 7 14:33:56 2012
@@ -19,6 +19,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include "mime.h"
#include "ushare.h"
@@ -56,7 +57,7 @@ const struct mime_type_t MIME_Type_List[] = {
@@ -53,10 +54,11 @@ const struct mime_type_t MIME_Type_List[] = {
{ "mpeg2", UPNP_VIDEO, "http-get:*:video/mpeg2:"},
{ "m4v", UPNP_VIDEO, "http-get:*:video/mp4:"},
{ "m4p", UPNP_VIDEO, "http-get:*:video/mp4:"},
+ { "mp4", UPNP_VIDEO, "http-get:*:video/mp4:"},
{ "mp4ps", UPNP_VIDEO, "http-get:*:video/x-nerodigital-ps:"},
{ "ts", UPNP_VIDEO, "http-get:*:video/mpeg2:"},
{ "ogm", UPNP_VIDEO, "http-get:*:video/mpeg:"},
@ -18,3 +22,20 @@ $OpenBSD: patch-src_mime_c,v 1.2 2012/11/06 11:50:04 dcoppa Exp $
{ "rmvb", UPNP_VIDEO, "http-get:*:video/mpeg:"},
{ "mov", UPNP_VIDEO, "http-get:*:video/quicktime:"},
{ "hdmov", UPNP_VIDEO, "http-get:*:video/quicktime:"},
@@ -79,7 +81,6 @@ const struct mime_type_t MIME_Type_List[] = {
{ "mp1", UPNP_AUDIO, "http-get:*:audio/mp1:"},
{ "mp2", UPNP_AUDIO, "http-get:*:audio/mp2:"},
{ "mp3", UPNP_AUDIO, "http-get:*:audio/mpeg:"},
- { "mp4", UPNP_AUDIO, "http-get:*:audio/mp4:"},
{ "m4a", UPNP_AUDIO, "http-get:*:audio/mp4:"},
{ "ogg", UPNP_AUDIO, "http-get:*:audio/x-ogg:"},
{ "wav", UPNP_AUDIO, "http-get:*:audio/wav:"},
@@ -144,7 +145,7 @@ char *mime_get_protocol (struct mime_type_t *mime)
if (!mime)
return NULL;
- sprintf (protocol, mime->mime_protocol);
+ sprintf (protocol, "%s", mime->mime_protocol);
strcat (protocol, "*");
return strdup (protocol);
}

View File

@ -1,12 +1,16 @@
$OpenBSD: patch-src_presentation_c,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_presentation_c,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
--- src/presentation.c.orig Sun Dec 9 14:03:36 2007
+++ src/presentation.c Fri Nov 2 16:10:37 2012
@@ -19,6 +19,8 @@
+++ src/presentation.c Wed Nov 7 13:16:26 2012
@@ -18,7 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
#if HAVE_LANGINFO_CODESET
# include <langinfo.h>

View File

@ -0,0 +1,725 @@
$OpenBSD: patch-src_redblack_c,v 1.1 2012/11/07 14:53:59 dcoppa Exp $
redblack.h:45:1: warning: "RB_ENTRY" redefined
/usr/include/sys/tree.h:305:1: warning: this is the location of the previous definition
--- src/redblack.c.orig Sun Dec 9 14:03:36 2007
+++ src/redblack.c Wed Nov 7 15:45:17 2012
@@ -39,20 +39,20 @@ static char rcsid[]="$Id: redblack.c,v 1.9 2003/10/24
enum nodecolour { BLACK, RED };
-struct RB_ENTRY(node)
+struct USHARE_RB_ENTRY(node)
{
- struct RB_ENTRY(node) *left; /* Left down */
- struct RB_ENTRY(node) *right; /* Right down */
- struct RB_ENTRY(node) *up; /* Up */
+ struct USHARE_RB_ENTRY(node) *left; /* Left down */
+ struct USHARE_RB_ENTRY(node) *right; /* Right down */
+ struct USHARE_RB_ENTRY(node) *up; /* Up */
enum nodecolour colour; /* Node colour */
#ifdef RB_INLINE
- RB_ENTRY(data_t) key; /* User's key (and data) */
+ USHARE_RB_ENTRY(data_t) key; /* User's key (and data) */
#define RB_GET(x,y) &x->y
-#define RB_SET(x,y,v) x->y = *(v)
+#define USHARE_RB_SET(x,y,v) x->y = *(v)
#else
- const RB_ENTRY(data_t) *key; /* Pointer to user's key (and data) */
+ const USHARE_RB_ENTRY(data_t) *key; /* Pointer to user's key (and data) */
#define RB_GET(x,y) x->y
-#define RB_SET(x,y,v) x->y = v
+#define USHARE_RB_SET(x,y,v) x->y = v
#endif /* RB_INLINE */
};
@@ -63,50 +63,50 @@ struct RB_ENTRY(node)
** Initialization of the last field in this initializer is left implicit
** because it could be of any type. We count on the compiler to zero it.
*/
-struct RB_ENTRY(node) RB_ENTRY(_null)={&RB_ENTRY(_null), &RB_ENTRY(_null), &RB_ENTRY(_null), BLACK, &RB_ENTRY(_null)};
-#define RBNULL (&RB_ENTRY(_null))
+struct USHARE_RB_ENTRY(node) USHARE_RB_ENTRY(_null)={&USHARE_RB_ENTRY(_null), &USHARE_RB_ENTRY(_null), &USHARE_RB_ENTRY(_null), BLACK, &USHARE_RB_ENTRY(_null)};
+#define RBNULL (&USHARE_RB_ENTRY(_null))
#if defined(USE_SBRK)
-static struct RB_ENTRY(node) *RB_ENTRY(_alloc)();
-static void RB_ENTRY(_free)(struct RB_ENTRY(node) *);
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_alloc)();
+static void USHARE_RB_ENTRY(_free)(struct USHARE_RB_ENTRY(node) *);
#else
-static struct RB_ENTRY(node) *RB_ENTRY(_alloc)() {return (struct RB_ENTRY(node) *) malloc(sizeof(struct RB_ENTRY(node)));}
-static void RB_ENTRY(_free)(struct RB_ENTRY(node) *x) {free(x);}
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_alloc)() {return (struct USHARE_RB_ENTRY(node) *) malloc(sizeof(struct USHARE_RB_ENTRY(node)));}
+static void USHARE_RB_ENTRY(_free)(struct USHARE_RB_ENTRY(node) *x) {free(x);}
#endif
/* These functions are always needed */
-static void RB_ENTRY(_left_rotate)(struct RB_ENTRY(node) **, struct RB_ENTRY(node) *);
-static void RB_ENTRY(_right_rotate)(struct RB_ENTRY(node) **, struct RB_ENTRY(node) *);
-static struct RB_ENTRY(node) *RB_ENTRY(_successor)(const struct RB_ENTRY(node) *);
-static struct RB_ENTRY(node) *RB_ENTRY(_predecessor)(const struct RB_ENTRY(node) *);
-static struct RB_ENTRY(node) *RB_ENTRY(_traverse)(int, const RB_ENTRY(data_t) * , struct RB_ENTRY(tree) *);
+static void USHARE_RB_ENTRY(_left_rotate)(struct USHARE_RB_ENTRY(node) **, struct USHARE_RB_ENTRY(node) *);
+static void USHARE_RB_ENTRY(_right_rotate)(struct USHARE_RB_ENTRY(node) **, struct USHARE_RB_ENTRY(node) *);
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_successor)(const struct USHARE_RB_ENTRY(node) *);
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_predecessor)(const struct USHARE_RB_ENTRY(node) *);
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_traverse)(int, const USHARE_RB_ENTRY(data_t) * , struct USHARE_RB_ENTRY(tree) *);
/* These functions may not be needed */
#ifndef no_lookup
-static struct RB_ENTRY(node) *RB_ENTRY(_lookup)(int, const RB_ENTRY(data_t) * , struct RB_ENTRY(tree) *);
+static struct USHARE_RB_ENTRY(node) *USHARE_RB_ENTRY(_lookup)(int, const USHARE_RB_ENTRY(data_t) * , struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_destroy
-static void RB_ENTRY(_destroy)(struct RB_ENTRY(node) *);
+static void USHARE_RB_ENTRY(_destroy)(struct USHARE_RB_ENTRY(node) *);
#endif
#ifndef no_delete
-static void RB_ENTRY(_delete)(struct RB_ENTRY(node) **, struct RB_ENTRY(node) *);
-static void RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **, struct RB_ENTRY(node) *);
+static void USHARE_RB_ENTRY(_delete)(struct USHARE_RB_ENTRY(node) **, struct USHARE_RB_ENTRY(node) *);
+static void USHARE_RB_ENTRY(_delete_fix)(struct USHARE_RB_ENTRY(node) **, struct USHARE_RB_ENTRY(node) *);
#endif
#ifndef no_walk
-static void RB_ENTRY(_walk)(const struct RB_ENTRY(node) *, void (*)(const RB_ENTRY(data_t) *, const VISIT, const int, void *), void *, int);
+static void USHARE_RB_ENTRY(_walk)(const struct USHARE_RB_ENTRY(node) *, void (*)(const USHARE_RB_ENTRY(data_t) *, const VISIT, const int, void *), void *, int);
#endif
#ifndef no_readlist
-static RBLIST *RB_ENTRY(_openlist)(const struct RB_ENTRY(node) *);
-static const RB_ENTRY(data_t) * RB_ENTRY(_readlist)(RBLIST *);
-static void RB_ENTRY(_closelist)(RBLIST *);
+static RBLIST *USHARE_RB_ENTRY(_openlist)(const struct USHARE_RB_ENTRY(node) *);
+static const USHARE_RB_ENTRY(data_t) * USHARE_RB_ENTRY(_readlist)(RBLIST *);
+static void USHARE_RB_ENTRY(_closelist)(RBLIST *);
#endif
/*
@@ -133,18 +133,18 @@ static void RB_ENTRY(_closelist)(RBLIST *);
* Returns a pointer to the top of the tree.
*/
#ifndef RB_CUSTOMIZE
-RB_STATIC struct RB_ENTRY(tree) *
+RB_STATIC struct USHARE_RB_ENTRY(tree) *
rbinit(int (*cmp)(const void *, const void *, const void *), const void *config)
#else
-RB_STATIC struct RB_ENTRY(tree) *RB_ENTRY(init)(void)
+RB_STATIC struct USHARE_RB_ENTRY(tree) *USHARE_RB_ENTRY(init)(void)
#endif /* RB_CUSTOMIZE */
{
- struct RB_ENTRY(tree) *retval;
+ struct USHARE_RB_ENTRY(tree) *retval;
char c;
c=rcsid[0]; /* This does nothing but shutup the -Wall */
- if ((retval=(struct RB_ENTRY(tree) *) malloc(sizeof(struct RB_ENTRY(tree))))==NULL)
+ if ((retval=(struct USHARE_RB_ENTRY(tree) *) malloc(sizeof(struct USHARE_RB_ENTRY(tree))))==NULL)
return(NULL);
#ifndef RB_CUSTOMIZE
@@ -158,38 +158,38 @@ RB_STATIC struct RB_ENTRY(tree) *RB_ENTRY(init)(void)
#ifndef no_destroy
RB_STATIC void
-RB_ENTRY(destroy)(struct RB_ENTRY(tree) *rbinfo)
+USHARE_RB_ENTRY(destroy)(struct USHARE_RB_ENTRY(tree) *rbinfo)
{
if (rbinfo==NULL)
return;
if (rbinfo->rb_root!=RBNULL)
- RB_ENTRY(_destroy)(rbinfo->rb_root);
+ USHARE_RB_ENTRY(_destroy)(rbinfo->rb_root);
free(rbinfo);
}
#endif /* no_destroy */
#ifndef no_search
-RB_STATIC const RB_ENTRY(data_t) *
-RB_ENTRY(search)(const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+RB_STATIC const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(search)(const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x;
+ struct USHARE_RB_ENTRY(node) *x;
if (rbinfo==NULL)
return(NULL);
- x=RB_ENTRY(_traverse)(1, key, rbinfo);
+ x=USHARE_RB_ENTRY(_traverse)(1, key, rbinfo);
return((x==RBNULL) ? NULL : RB_GET(x, key));
}
#endif /* no_search */
#ifndef no_find
-RB_STATIC const RB_ENTRY(data_t) *
-RB_ENTRY(find)(const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+RB_STATIC const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(find)(const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x;
+ struct USHARE_RB_ENTRY(node) *x;
if (rbinfo==NULL)
return(NULL);
@@ -198,23 +198,23 @@ RB_ENTRY(find)(const RB_ENTRY(data_t) *key, struct RB_
if (rbinfo->rb_root==RBNULL)
return(NULL);
- x=RB_ENTRY(_traverse)(0, key, rbinfo);
+ x=USHARE_RB_ENTRY(_traverse)(0, key, rbinfo);
return((x==RBNULL) ? NULL : RB_GET(x, key));
}
#endif /* no_find */
#ifndef no_delete
-RB_STATIC const RB_ENTRY(data_t) *
-RB_ENTRY(delete)(const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+RB_STATIC const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(delete)(const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x;
- const RB_ENTRY(data_t) * y;
+ struct USHARE_RB_ENTRY(node) *x;
+ const USHARE_RB_ENTRY(data_t) * y;
if (rbinfo==NULL)
return(NULL);
- x=RB_ENTRY(_traverse)(0, key, rbinfo);
+ x=USHARE_RB_ENTRY(_traverse)(0, key, rbinfo);
if (x==RBNULL)
{
@@ -223,7 +223,7 @@ RB_ENTRY(delete)(const RB_ENTRY(data_t) *key, struct R
else
{
y=RB_GET(x, key);
- RB_ENTRY(_delete)(&rbinfo->rb_root, x);
+ USHARE_RB_ENTRY(_delete)(&rbinfo->rb_root, x);
return(y);
}
@@ -232,55 +232,55 @@ RB_ENTRY(delete)(const RB_ENTRY(data_t) *key, struct R
#ifndef no_walk
RB_STATIC void
-RB_ENTRY(walk)(const struct RB_ENTRY(tree) *rbinfo, void (*action)(const RB_ENTRY(data_t) *, const VISIT, const int, void *), void *arg)
+USHARE_RB_ENTRY(walk)(const struct USHARE_RB_ENTRY(tree) *rbinfo, void (*action)(const USHARE_RB_ENTRY(data_t) *, const VISIT, const int, void *), void *arg)
{
if (rbinfo==NULL)
return;
- RB_ENTRY(_walk)(rbinfo->rb_root, action, arg, 0);
+ USHARE_RB_ENTRY(_walk)(rbinfo->rb_root, action, arg, 0);
}
#endif /* no_walk */
#ifndef no_readlist
RB_STATIC RBLIST *
-RB_ENTRY(openlist)(const struct RB_ENTRY(tree) *rbinfo)
+USHARE_RB_ENTRY(openlist)(const struct USHARE_RB_ENTRY(tree) *rbinfo)
{
if (rbinfo==NULL)
return(NULL);
- return(RB_ENTRY(_openlist)(rbinfo->rb_root));
+ return(USHARE_RB_ENTRY(_openlist)(rbinfo->rb_root));
}
-RB_STATIC const RB_ENTRY(data_t) *
-RB_ENTRY(readlist)(RBLIST *rblistp)
+RB_STATIC const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(readlist)(RBLIST *rblistp)
{
if (rblistp==NULL)
return(NULL);
- return(RB_ENTRY(_readlist)(rblistp));
+ return(USHARE_RB_ENTRY(_readlist)(rblistp));
}
RB_STATIC void
-RB_ENTRY(closelist)(RBLIST *rblistp)
+USHARE_RB_ENTRY(closelist)(RBLIST *rblistp)
{
if (rblistp==NULL)
return;
- RB_ENTRY(_closelist)(rblistp);
+ USHARE_RB_ENTRY(_closelist)(rblistp);
}
#endif /* no_readlist */
#ifndef no_lookup
-RB_STATIC const RB_ENTRY(data_t) *
-RB_ENTRY(lookup)(int mode, const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+RB_STATIC const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(lookup)(int mode, const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x;
+ struct USHARE_RB_ENTRY(node) *x;
/* If we have a NULL root (empty tree) then just return NULL */
if (rbinfo==NULL || rbinfo->rb_root==NULL)
return(NULL);
- x=RB_ENTRY(_lookup)(mode, key, rbinfo);
+ x=USHARE_RB_ENTRY(_lookup)(mode, key, rbinfo);
return((x==RBNULL) ? NULL : RB_GET(x, key));
}
@@ -291,10 +291,10 @@ RB_ENTRY(lookup)(int mode, const RB_ENTRY(data_t) *key
/* Search for and if not found and insert is true, will add a new
** node in. Returns a pointer to the new node, or the node found
*/
-static struct RB_ENTRY(node) *
-RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+static struct USHARE_RB_ENTRY(node) *
+USHARE_RB_ENTRY(_traverse)(int insert, const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x,*y,*z;
+ struct USHARE_RB_ENTRY(node) *x,*y,*z;
int cmp;
int found=0;
int cmpmods();
@@ -324,13 +324,13 @@ RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t)
if (found || !insert)
return(x);
- if ((z=RB_ENTRY(_alloc)())==NULL)
+ if ((z=USHARE_RB_ENTRY(_alloc)())==NULL)
{
/* Whoops, no memory */
return(RBNULL);
}
- RB_SET(z, key, key);
+ USHARE_RB_SET(z, key, key);
z->up=y;
if (y==RBNULL)
{
@@ -391,7 +391,7 @@ RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t)
{
/* Move up to our parent */
x=x->up;
- RB_ENTRY(_left_rotate)(&rbinfo->rb_root, x);
+ USHARE_RB_ENTRY(_left_rotate)(&rbinfo->rb_root, x);
}
/* make our parent black */
@@ -399,7 +399,7 @@ RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t)
/* make our grandparent red */
x->up->up->colour = RED;
/* right rotate our grandparent */
- RB_ENTRY(_right_rotate)(&rbinfo->rb_root, x->up->up);
+ USHARE_RB_ENTRY(_right_rotate)(&rbinfo->rb_root, x->up->up);
}
}
else
@@ -422,12 +422,12 @@ RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t)
if (x == x->up->left)
{
x=x->up;
- RB_ENTRY(_right_rotate)(&rbinfo->rb_root, x);
+ USHARE_RB_ENTRY(_right_rotate)(&rbinfo->rb_root, x);
}
x->up->colour = BLACK;
x->up->up->colour = RED;
- RB_ENTRY(_left_rotate)(&rbinfo->rb_root, x->up->up);
+ USHARE_RB_ENTRY(_left_rotate)(&rbinfo->rb_root, x->up->up);
}
}
}
@@ -441,10 +441,10 @@ RB_ENTRY(_traverse)(int insert, const RB_ENTRY(data_t)
#ifndef no_lookup
/* Search for a key according to mode (see redblack.h)
*/
-static struct RB_ENTRY(node) *
-RB_ENTRY(_lookup)(int mode, const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
+static struct USHARE_RB_ENTRY(node) *
+USHARE_RB_ENTRY(_lookup)(int mode, const USHARE_RB_ENTRY(data_t) *key, struct USHARE_RB_ENTRY(tree) *rbinfo)
{
- struct RB_ENTRY(node) *x,*y;
+ struct USHARE_RB_ENTRY(node) *x,*y;
int cmp=0;
int found=0;
@@ -503,7 +503,7 @@ RB_ENTRY(_lookup)(int mode, const RB_ENTRY(data_t) *ke
if (mode==RB_LUGTEQ || (!found && mode==RB_LUGREAT))
{
if (cmp>0)
- return(RB_ENTRY(_successor)(y));
+ return(USHARE_RB_ENTRY(_successor)(y));
else
return(y);
}
@@ -511,16 +511,16 @@ RB_ENTRY(_lookup)(int mode, const RB_ENTRY(data_t) *ke
if (mode==RB_LULTEQ || (!found && mode==RB_LULESS))
{
if (cmp<0)
- return(RB_ENTRY(_predecessor)(y));
+ return(USHARE_RB_ENTRY(_predecessor)(y));
else
return(y);
}
if (mode==RB_LUNEXT || (found && mode==RB_LUGREAT))
- return(RB_ENTRY(_successor)(x));
+ return(USHARE_RB_ENTRY(_successor)(x));
if (mode==RB_LUPREV || (found && mode==RB_LULESS))
- return(RB_ENTRY(_predecessor)(x));
+ return(USHARE_RB_ENTRY(_predecessor)(x));
/* Shouldn't get here */
return(RBNULL);
@@ -533,15 +533,15 @@ RB_ENTRY(_lookup)(int mode, const RB_ENTRY(data_t) *ke
* only useful as part of a complete tree destroy.
*/
static void
-RB_ENTRY(_destroy)(struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(_destroy)(struct USHARE_RB_ENTRY(node) *x)
{
if (x!=RBNULL)
{
if (x->left!=RBNULL)
- RB_ENTRY(_destroy)(x->left);
+ USHARE_RB_ENTRY(_destroy)(x->left);
if (x->right!=RBNULL)
- RB_ENTRY(_destroy)(x->right);
- RB_ENTRY(_free)(x);
+ USHARE_RB_ENTRY(_destroy)(x->right);
+ USHARE_RB_ENTRY(_free)(x);
}
}
#endif /* no_destroy */
@@ -561,9 +561,9 @@ RB_ENTRY(_destroy)(struct RB_ENTRY(node) *x)
*/
static void
-RB_ENTRY(_left_rotate)(struct RB_ENTRY(node) **rootp, struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(_left_rotate)(struct USHARE_RB_ENTRY(node) **rootp, struct USHARE_RB_ENTRY(node) *x)
{
- struct RB_ENTRY(node) *y;
+ struct USHARE_RB_ENTRY(node) *y;
assert(x!=RBNULL);
assert(x->right!=RBNULL);
@@ -606,9 +606,9 @@ RB_ENTRY(_left_rotate)(struct RB_ENTRY(node) **rootp,
}
static void
-RB_ENTRY(_right_rotate)(struct RB_ENTRY(node) **rootp, struct RB_ENTRY(node) *y)
+USHARE_RB_ENTRY(_right_rotate)(struct USHARE_RB_ENTRY(node) **rootp, struct USHARE_RB_ENTRY(node) *y)
{
- struct RB_ENTRY(node) *x;
+ struct USHARE_RB_ENTRY(node) *x;
assert(y!=RBNULL);
assert(y->left!=RBNULL);
@@ -652,10 +652,10 @@ RB_ENTRY(_right_rotate)(struct RB_ENTRY(node) **rootp,
/* Return a pointer to the smallest key greater than x
*/
-static struct RB_ENTRY(node) *
-RB_ENTRY(_successor)(const struct RB_ENTRY(node) *x)
+static struct USHARE_RB_ENTRY(node) *
+USHARE_RB_ENTRY(_successor)(const struct USHARE_RB_ENTRY(node) *x)
{
- struct RB_ENTRY(node) *y;
+ struct USHARE_RB_ENTRY(node) *y;
if (x->right!=RBNULL)
{
@@ -683,10 +683,10 @@ RB_ENTRY(_successor)(const struct RB_ENTRY(node) *x)
/* Return a pointer to the largest key smaller than x
*/
-static struct RB_ENTRY(node) *
-RB_ENTRY(_predecessor)(const struct RB_ENTRY(node) *x)
+static struct USHARE_RB_ENTRY(node) *
+USHARE_RB_ENTRY(_predecessor)(const struct USHARE_RB_ENTRY(node) *x)
{
- struct RB_ENTRY(node) *y;
+ struct USHARE_RB_ENTRY(node) *y;
if (x->left!=RBNULL)
{
@@ -716,14 +716,14 @@ RB_ENTRY(_predecessor)(const struct RB_ENTRY(node) *x)
/* Delete the node z, and free up the space
*/
static void
-RB_ENTRY(_delete)(struct RB_ENTRY(node) **rootp, struct RB_ENTRY(node) *z)
+USHARE_RB_ENTRY(_delete)(struct USHARE_RB_ENTRY(node) **rootp, struct USHARE_RB_ENTRY(node) *z)
{
- struct RB_ENTRY(node) *x, *y;
+ struct USHARE_RB_ENTRY(node) *x, *y;
if (z->left == RBNULL || z->right == RBNULL)
y=z;
else
- y=RB_ENTRY(_successor)(z);
+ y=USHARE_RB_ENTRY(_successor)(z);
if (y->left != RBNULL)
x=y->left;
@@ -746,20 +746,20 @@ RB_ENTRY(_delete)(struct RB_ENTRY(node) **rootp, struc
if (y!=z)
{
- RB_SET(z, key, RB_GET(y, key));
+ USHARE_RB_SET(z, key, RB_GET(y, key));
}
if (y->colour == BLACK)
- RB_ENTRY(_delete_fix)(rootp, x);
+ USHARE_RB_ENTRY(_delete_fix)(rootp, x);
- RB_ENTRY(_free)(y);
+ USHARE_RB_ENTRY(_free)(y);
}
/* Restore the reb-black properties after a delete */
static void
-RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(_delete_fix)(struct USHARE_RB_ENTRY(node) **rootp, struct USHARE_RB_ENTRY(node) *x)
{
- struct RB_ENTRY(node) *w;
+ struct USHARE_RB_ENTRY(node) *w;
while (x!=*rootp && x->colour==BLACK)
{
@@ -785,7 +785,7 @@ RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, s
{
w->left->colour=BLACK;
w->colour=RED;
- RB_ENTRY(_right_rotate)(rootp, w);
+ USHARE_RB_ENTRY(_right_rotate)(rootp, w);
w=x->up->right;
}
@@ -793,7 +793,7 @@ RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, s
w->colour=x->up->colour;
x->up->colour = BLACK;
w->right->colour = BLACK;
- RB_ENTRY(_left_rotate)(rootp, x->up);
+ USHARE_RB_ENTRY(_left_rotate)(rootp, x->up);
x=*rootp;
}
}
@@ -804,7 +804,7 @@ RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, s
{
w->colour=BLACK;
x->up->colour=RED;
- RB_ENTRY(_right_rotate)(rootp, x->up);
+ USHARE_RB_ENTRY(_right_rotate)(rootp, x->up);
w=x->up->left;
}
@@ -819,14 +819,14 @@ RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, s
{
w->right->colour=BLACK;
w->colour=RED;
- RB_ENTRY(_left_rotate)(rootp, w);
+ USHARE_RB_ENTRY(_left_rotate)(rootp, w);
w=x->up->left;
}
w->colour=x->up->colour;
x->up->colour = BLACK;
w->left->colour = BLACK;
- RB_ENTRY(_right_rotate)(rootp, x->up);
+ USHARE_RB_ENTRY(_right_rotate)(rootp, x->up);
x=*rootp;
}
}
@@ -838,7 +838,7 @@ RB_ENTRY(_delete_fix)(struct RB_ENTRY(node) **rootp, s
#ifndef no_walk
static void
-RB_ENTRY(_walk)(const struct RB_ENTRY(node) *x, void (*action)(const RB_ENTRY(data_t) *, const VISIT, const int, void *), void *arg, int level)
+USHARE_RB_ENTRY(_walk)(const struct USHARE_RB_ENTRY(node) *x, void (*action)(const USHARE_RB_ENTRY(data_t) *, const VISIT, const int, void *), void *arg, int level)
{
if (x==RBNULL)
return;
@@ -852,11 +852,11 @@ RB_ENTRY(_walk)(const struct RB_ENTRY(node) *x, void (
{
(*action)(RB_GET(x, key), preorder, level, arg);
- RB_ENTRY(_walk)(x->left, action, arg, level+1);
+ USHARE_RB_ENTRY(_walk)(x->left, action, arg, level+1);
(*action)(RB_GET(x, key), postorder, level, arg);
- RB_ENTRY(_walk)(x->right, action, arg, level+1);
+ USHARE_RB_ENTRY(_walk)(x->right, action, arg, level+1);
(*action)(RB_GET(x, key), endorder, level, arg);
}
@@ -865,7 +865,7 @@ RB_ENTRY(_walk)(const struct RB_ENTRY(node) *x, void (
#ifndef no_readlist
static RBLIST *
-RB_ENTRY(_openlist)(const struct RB_ENTRY(node) *rootp)
+USHARE_RB_ENTRY(_openlist)(const struct USHARE_RB_ENTRY(node) *rootp)
{
RBLIST *rblistp;
@@ -887,15 +887,15 @@ RB_ENTRY(_openlist)(const struct RB_ENTRY(node) *rootp
return(rblistp);
}
-static const RB_ENTRY(data_t) *
-RB_ENTRY(_readlist)(RBLIST *rblistp)
+static const USHARE_RB_ENTRY(data_t) *
+USHARE_RB_ENTRY(_readlist)(RBLIST *rblistp)
{
- const RB_ENTRY(data_t) *key=NULL;
+ const USHARE_RB_ENTRY(data_t) *key=NULL;
if (rblistp!=NULL && rblistp->nextp!=RBNULL)
{
key=RB_GET(rblistp->nextp, key);
- rblistp->nextp=RB_ENTRY(_successor)(rblistp->nextp);
+ rblistp->nextp=USHARE_RB_ENTRY(_successor)(rblistp->nextp);
}
return(key);
@@ -913,27 +913,27 @@ rb_closelist(RBLIST *rblistp)
/* Allocate space for our nodes, allowing us to get space from
** sbrk in larger chucks.
*/
-static struct RB_ENTRY(node) *rbfreep=NULL;
+static struct USHARE_RB_ENTRY(node) *rbfreep=NULL;
-#define RB_ENTRY(NODE)ALLOC_CHUNK_SIZE 1000
-static struct RB_ENTRY(node) *
-RB_ENTRY(_alloc)()
+#define USHARE_RB_ENTRY(NODE)ALLOC_CHUNK_SIZE 1000
+static struct USHARE_RB_ENTRY(node) *
+USHARE_RB_ENTRY(_alloc)()
{
- struct RB_ENTRY(node) *x;
+ struct USHARE_RB_ENTRY(node) *x;
int i;
if (rbfreep==NULL)
{
/* must grab some more space */
- rbfreep=(struct RB_ENTRY(node) *) sbrk(sizeof(struct RB_ENTRY(node)) * RB_ENTRY(NODE)ALLOC_CHUNK_SIZE);
+ rbfreep=(struct USHARE_RB_ENTRY(node) *) sbrk(sizeof(struct USHARE_RB_ENTRY(node)) * USHARE_RB_ENTRY(NODE)ALLOC_CHUNK_SIZE);
- if (rbfreep==(struct RB_ENTRY(node) *) -1)
+ if (rbfreep==(struct USHARE_RB_ENTRY(node) *) -1)
{
return(NULL);
}
/* tie them together in a linked list (use the up pointer) */
- for (i=0, x=rbfreep; i<RB_ENTRY(NODE)ALLOC_CHUNK_SIZE-1; i++, x++)
+ for (i=0, x=rbfreep; i<USHARE_RB_ENTRY(NODE)ALLOC_CHUNK_SIZE-1; i++, x++)
{
x->up = (x+1);
}
@@ -952,7 +952,7 @@ RB_ENTRY(_alloc)()
** N.B. RB_ENTRY(node) need not have been allocated through rb_alloc()
*/
static void
-RB_ENTRY(_free)(struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(_free)(struct USHARE_RB_ENTRY(node) *x)
{
#ifdef RB_FREE
RB_FREE(ACCESS(x, key));
@@ -965,7 +965,7 @@ RB_ENTRY(_free)(struct RB_ENTRY(node) *x)
#if 0
int
-RB_ENTRY(_check)(struct RB_ENTRY(node) *rootp)
+USHARE_RB_ENTRY(_check)(struct USHARE_RB_ENTRY(node) *rootp)
{
if (rootp==NULL || rootp==RBNULL)
return(0);
@@ -977,15 +977,15 @@ RB_ENTRY(_check)(struct RB_ENTRY(node) *rootp)
return(1);
}
- if (RB_ENTRY(_check)1(rootp))
+ if (USHARE_RB_ENTRY(_check)1(rootp))
{
- RB_ENTRY(dumptree)(rootp, 0);
+ USHARE_RB_ENTRY(dumptree)(rootp, 0);
return(1);
}
- if (RB_ENTRY(count_black)(rootp)==-1)
+ if (USHARE_RB_ENTRY(count_black)(rootp)==-1)
{
- RB_ENTRY(dumptree)(rootp, 0);
+ USHARE_RB_ENTRY(dumptree)(rootp, 0);
return(-1);
}
@@ -993,7 +993,7 @@ RB_ENTRY(_check)(struct RB_ENTRY(node) *rootp)
}
int
-RB_ENTRY(_check1)(struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(_check1)(struct USHARE_RB_ENTRY(node) *x)
{
if (x->left==NULL || x->right==NULL)
{
@@ -1036,15 +1036,15 @@ RB_ENTRY(_check1)(struct RB_ENTRY(node) *x)
return(0);
}
-RB_ENTRY(count_black)(struct RB_ENTRY(node) *x)
+USHARE_RB_ENTRY(count_black)(struct USHARE_RB_ENTRY(node) *x)
{
int nleft, nright;
if (x==RBNULL)
return(1);
- nleft=RB_ENTRY(count_black)(x->left);
- nright=RB_ENTRY(count_black)(x->right);
+ nleft=USHARE_RB_ENTRY(count_black)(x->left);
+ nright=USHARE_RB_ENTRY(count_black)(x->right);
if (nleft==-1 || nright==-1)
return(-1);
@@ -1063,7 +1063,7 @@ RB_ENTRY(count_black)(struct RB_ENTRY(node) *x)
return(nleft);
}
-RB_ENTRY(dumptree)(struct RB_ENTRY(node) *x, int n)
+USHARE_RB_ENTRY(dumptree)(struct USHARE_RB_ENTRY(node) *x, int n)
{
char *prkey();
@@ -1079,8 +1079,8 @@ RB_ENTRY(dumptree)(struct RB_ENTRY(node) *x, int n)
(x->colour==BLACK) ? "BLACK" : "RED",
prkey(RB_GET(x, key)));
- RB_ENTRY(dumptree)(x->left, n);
- RB_ENTRY(dumptree)(x->right, n);
+ USHARE_RB_ENTRY(dumptree)(x->left, n);
+ USHARE_RB_ENTRY(dumptree)(x->right, n);
}
}
#endif

View File

@ -0,0 +1,103 @@
$OpenBSD: patch-src_redblack_h,v 1.1 2012/11/07 14:53:59 dcoppa Exp $
redblack.h:45:1: warning: "RB_ENTRY" redefined
/usr/include/sys/tree.h:305:1: warning: this is the location of the previous definition
--- src/redblack.h.orig Sun Dec 9 14:03:36 2007
+++ src/redblack.h Wed Nov 7 15:36:42 2012
@@ -42,7 +42,7 @@
#define rbdata_t void
#define RB_CMP(s, t, e) (*rbinfo->rb_cmp)(s, t, e)
#undef RB_INLINE
-#define RB_ENTRY(name) rb##name
+#define USHARE_RB_ENTRY(name) rb##name
#endif /* RB_CUSTOMIZE */
#ifndef RB_STATIC
@@ -71,14 +71,14 @@ typedef enum
}
VISIT;
-struct RB_ENTRY(lists) {
-const struct RB_ENTRY(node) *rootp;
-const struct RB_ENTRY(node) *nextp;
+struct USHARE_RB_ENTRY(lists) {
+const struct USHARE_RB_ENTRY(node) *rootp;
+const struct USHARE_RB_ENTRY(node) *nextp;
};
-#define RBLIST struct RB_ENTRY(lists)
+#define RBLIST struct USHARE_RB_ENTRY(lists)
-struct RB_ENTRY(tree) {
+struct USHARE_RB_ENTRY(tree) {
#ifndef RB_CUSTOMIZE
/* comparison routine */
int (*rb_cmp)(const void *, const void *, const void *);
@@ -86,51 +86,51 @@ int (*rb_cmp)(const void *, const void *, const void *
const void *rb_config;
/* root of tree */
#endif /* RB_CUSTOMIZE */
-struct RB_ENTRY(node) *rb_root;
+struct USHARE_RB_ENTRY(node) *rb_root;
};
#ifndef RB_CUSTOMIZE
-RB_STATIC struct RB_ENTRY(tree) *rbinit(int (*)(const void *, const void *, const void *),
+RB_STATIC struct USHARE_RB_ENTRY(tree) *rbinit(int (*)(const void *, const void *, const void *),
const void *);
#else
-RB_STATIC struct RB_ENTRY(tree) *RB_ENTRY(init)(void);
+RB_STATIC struct USHARE_RB_ENTRY(tree) *USHARE_RB_ENTRY(init)(void);
#endif /* RB_CUSTOMIZE */
#ifndef no_delete
-RB_STATIC const RB_ENTRY(data_t) *RB_ENTRY(delete)(const RB_ENTRY(data_t) *, struct RB_ENTRY(tree) *);
+RB_STATIC const USHARE_RB_ENTRY(data_t) *USHARE_RB_ENTRY(delete)(const USHARE_RB_ENTRY(data_t) *, struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_find
-RB_STATIC const RB_ENTRY(data_t) *RB_ENTRY(find)(const RB_ENTRY(data_t) *, struct RB_ENTRY(tree) *);
+RB_STATIC const USHARE_RB_ENTRY(data_t) *USHARE_RB_ENTRY(find)(const USHARE_RB_ENTRY(data_t) *, struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_lookup
-RB_STATIC const RB_ENTRY(data_t) *RB_ENTRY(lookup)(int, const RB_ENTRY(data_t) *, struct RB_ENTRY(tree) *);
+RB_STATIC const USHARE_RB_ENTRY(data_t) *USHARE_RB_ENTRY(lookup)(int, const USHARE_RB_ENTRY(data_t) *, struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_search
-RB_STATIC const RB_ENTRY(data_t) *RB_ENTRY(search)(const RB_ENTRY(data_t) *, struct RB_ENTRY(tree) *);
+RB_STATIC const USHARE_RB_ENTRY(data_t) *USHARE_RB_ENTRY(search)(const USHARE_RB_ENTRY(data_t) *, struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_destroy
-RB_STATIC void RB_ENTRY(destroy)(struct RB_ENTRY(tree) *);
+RB_STATIC void USHARE_RB_ENTRY(destroy)(struct USHARE_RB_ENTRY(tree) *);
#endif
#ifndef no_walk
-RB_STATIC void RB_ENTRY(walk)(const struct RB_ENTRY(tree) *,
- void (*)(const RB_ENTRY(data_t) *, const VISIT, const int, void *),
+RB_STATIC void USHARE_RB_ENTRY(walk)(const struct USHARE_RB_ENTRY(tree) *,
+ void (*)(const USHARE_RB_ENTRY(data_t) *, const VISIT, const int, void *),
void *);
#endif
#ifndef no_readlist
-RB_STATIC RBLIST *RB_ENTRY(openlist)(const struct RB_ENTRY(tree) *);
-RB_STATIC const RB_ENTRY(data_t) *RB_ENTRY(readlist)(RBLIST *);
-RB_STATIC void RB_ENTRY(closelist)(RBLIST *);
+RB_STATIC RBLIST *USHARE_RB_ENTRY(openlist)(const struct USHARE_RB_ENTRY(tree) *);
+RB_STATIC const USHARE_RB_ENTRY(data_t) *USHARE_RB_ENTRY(readlist)(RBLIST *);
+RB_STATIC void USHARE_RB_ENTRY(closelist)(RBLIST *);
#endif
/* Some useful macros */
-#define rbmin(rbinfo) RB_ENTRY(lookup)(RB_LUFIRST, NULL, (rbinfo))
-#define rbmax(rbinfo) RB_ENTRY(lookup)(RB_LULAST, NULL, (rbinfo))
+#define rbmin(rbinfo) USHARE_RB_ENTRY(lookup)(RB_LUFIRST, NULL, (rbinfo))
+#define rbmax(rbinfo) USHARE_RB_ENTRY(lookup)(RB_LULAST, NULL, (rbinfo))
#define _REDBLACK_H
#endif /* _REDBLACK_H */

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-src_services_c,v 1.1 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_services_c,v 1.2 2012/11/07 14:53:59 dcoppa Exp $
Add missing headers
--- src/services.c.orig Sun Dec 9 14:03:36 2007
+++ src/services.c Fri Nov 2 16:10:37 2012
@@ -20,6 +20,7 @@

View File

@ -1,4 +1,7 @@
$OpenBSD: patch-src_ushare_c,v 1.3 2012/11/06 11:50:04 dcoppa Exp $
$OpenBSD: patch-src_ushare_c,v 1.4 2012/11/07 14:53:59 dcoppa Exp $
Unbreak build with libupnp>=1.6.17
--- src/ushare.c.orig Sun Dec 9 14:03:36 2007
+++ src/ushare.c Fri Nov 2 16:13:38 2012
@@ -28,6 +28,10 @@