diff options
author | bsam <bsam@FreeBSD.org> | 2006-09-29 05:19:50 +0800 |
---|---|---|
committer | bsam <bsam@FreeBSD.org> | 2006-09-29 05:19:50 +0800 |
commit | 6c087009f4e650471af8e1bad93b7377e703bf78 (patch) | |
tree | 7a322144df1d6d3da49780b57bce64f4c0a3b9c4 | |
parent | c381a7902d334faf79a637a91ab41c02b636061b (diff) | |
download | freebsd-ports-gnome-6c087009f4e650471af8e1bad93b7377e703bf78.tar.gz freebsd-ports-gnome-6c087009f4e650471af8e1bad93b7377e703bf78.tar.zst freebsd-ports-gnome-6c087009f4e650471af8e1bad93b7377e703bf78.zip |
- gcc -Wall cleanup patches, contributed by Pietro Cerutti; [1]
- divide proposed files/patch-aa into several files.
PR: 103771 [1]
Submitted by: Dan Pelleg <daniel+mdnsd at pelleg.org> (maintainer) [1]
-rw-r--r-- | dns/mdnsd/Makefile | 4 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-1035.c | 18 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-Makefile | 16 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-mdnsd.c | 113 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-mhttp.c | 57 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-mquery.c | 51 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-sdtxt.c | 27 | ||||
-rw-r--r-- | dns/mdnsd/files/patch-xht.c | 36 | ||||
-rw-r--r-- | dns/mdnsd/pkg-plist | 2 |
9 files changed, 322 insertions, 2 deletions
diff --git a/dns/mdnsd/Makefile b/dns/mdnsd/Makefile index 78aa93f02b8f..76a9cfda5c20 100644 --- a/dns/mdnsd/Makefile +++ b/dns/mdnsd/Makefile @@ -7,6 +7,7 @@ PORTNAME= mdnsd PORTVERSION= 0.7G +PORTREVISION= 1 CATEGORIES= dns MASTER_SITES= http://dotlocal.org/${PORTNAME}/ \ http://web.cs.cmu.edu/~dpelleg/download/ @@ -14,6 +15,9 @@ MASTER_SITES= http://dotlocal.org/${PORTNAME}/ \ MAINTAINER= daniel+mdnsd@pelleg.org COMMENT= Advertise a service via Rendezvous +PLIST_FILES= bin/mhttp\ + bin/mquery + do-install: @${ECHO_MSG} "Installing files" .for i in mhttp mquery diff --git a/dns/mdnsd/files/patch-1035.c b/dns/mdnsd/files/patch-1035.c new file mode 100644 index 000000000000..c523a4268169 --- /dev/null +++ b/dns/mdnsd/files/patch-1035.c @@ -0,0 +1,18 @@ +diff -ruN 1035.c.orig 1035.c +--- 1035.c.orig Tue Feb 18 08:54:33 2003 ++++ 1035.c Mon Sep 25 22:11:14 2006 +@@ -1,4 +1,5 @@ + #include "1035.h" ++#include <stdio.h> + #include <string.h> + + unsigned short int net2short(unsigned char **bufp) +@@ -241,7 +242,7 @@ + if(packet == 0 || m == 0) return; + + // keep all our mem in one (aligned) block for easy freeing +- #define my(x,y) while(m->_len&7) m->_len++; (void*)x = (void*)(m->_packet + m->_len); m->_len += y; ++ #define my(x,y) x = (void *) x; while(m->_len&7) m->_len++; x = (void*)(m->_packet + m->_len); m->_len += y; + + // header stuff bit crap + m->_buf = buf = packet; diff --git a/dns/mdnsd/files/patch-Makefile b/dns/mdnsd/files/patch-Makefile new file mode 100644 index 000000000000..2b817ebc0b78 --- /dev/null +++ b/dns/mdnsd/files/patch-Makefile @@ -0,0 +1,16 @@ +diff -ruN Makefile.orig Makefile +--- Makefile.orig Tue Feb 18 09:00:04 2003 ++++ Makefile Mon Sep 25 22:11:16 2006 +@@ -1,10 +1,10 @@ + all: mquery mhttp + + mhttp: mhttp.c +- gcc -g -o mhttp mhttp.c mdnsd.c 1035.c sdtxt.c xht.c ++ gcc -Wall -g -o mhttp mhttp.c mdnsd.c 1035.c sdtxt.c xht.c + + mquery: mquery.c +- gcc -g -o mquery mquery.c mdnsd.c 1035.c ++ gcc -Wall -g -o mquery mquery.c mdnsd.c 1035.c + + clean: + rm -f mquery mhttp diff --git a/dns/mdnsd/files/patch-mdnsd.c b/dns/mdnsd/files/patch-mdnsd.c new file mode 100644 index 000000000000..2ede853a6ebf --- /dev/null +++ b/dns/mdnsd/files/patch-mdnsd.c @@ -0,0 +1,113 @@ +diff -ruN mdnsd.c.orig mdnsd.c +--- mdnsd.c.orig Tue Feb 18 08:54:46 2003 ++++ mdnsd.c Mon Sep 25 22:11:17 2006 +@@ -1,5 +1,7 @@ + #include "mdnsd.h" ++#include <arpa/inet.h> + #include <string.h> ++#include <stdlib.h> + + // size of query/publish hashes + #define SPRIME 108 +@@ -198,7 +200,7 @@ + struct cached *cur = 0; + q->nexttry = 0; + q->tries = 0; +- while(cur = _c_next(d,cur,q->name,q->type)) ++ while( (cur = _c_next(d,cur,q->name,q->type)) ) + if(q->nexttry == 0 || cur->rr.ttl - 7 < q->nexttry) q->nexttry = cur->rr.ttl - 7; + if(q->nexttry != 0 && q->nexttry < d->checkqlist) d->checkqlist = q->nexttry; + } +@@ -208,7 +210,7 @@ + struct cached *c = 0; + struct query *cur; + int i = _namehash(q->name) % LPRIME; +- while(c = _c_next(d,c,q->name,q->type)) c->q = 0; ++ while( (c = _c_next(d,c,q->name,q->type)) ) c->q = 0; + if(d->qlist == q) d->qlist = q->list; + else { + for(cur=d->qlist;cur->list != q;cur = cur->list); +@@ -288,13 +290,13 @@ + + if(r->class == 32768 + d->class) + { // cache flush +- while(c = _c_next(d,c,r->name,r->type)) c->rr.ttl = 0; ++ while( (c = _c_next(d,c,r->name,r->type)) ) c->rr.ttl = 0; + _c_expire(d,&d->cache[i]); + } + + if(r->ttl == 0) + { // process deletes +- while(c = _c_next(d,c,r->name,r->type)) ++ while( (c = _c_next(d,c,r->name,r->type)) ) + if(_a_match(r,&c->rr)) + { + c->rr.ttl = 0; +@@ -330,7 +332,7 @@ + } + c->next = d->cache[i]; + d->cache[i] = c; +- if(c->q = _q_next(d, 0, r->name, r->type)) ++ if( (c->q = _q_next(d, 0, r->name, r->type)) ) + _q_answer(d,c); + } + +@@ -344,7 +346,11 @@ + + int _r_out(mdnsd d, struct message *m, mdnsdr *list) + { // copy a published record into an outgoing message +- mdnsdr r, next; ++ /* ++ * Unused ++ * mdnsdr next; ++ */ ++ mdnsdr r; + int ret = 0; + while((r = *list) != 0 && message_packet_len(m) + _rr_len(&r->rr) < d->frame) + { +@@ -363,7 +369,10 @@ + + mdnsd mdnsd_new(int class, int frame) + { +- int i; ++ /* ++ * Unused ++ * int i; ++ */ + mdnsd d; + d = (mdnsd)malloc(sizeof(struct mdnsd_struct)); + bzero(d,sizeof(struct mdnsd_struct)); +@@ -401,7 +410,10 @@ + + void mdnsd_free(mdnsd d) + { +- int i; ++ /* ++ * Unused ++ * int i; ++ */ + // loop through all hashes, free everything + // free answers if any + free(d); +@@ -611,8 +623,11 @@ + + struct timeval *mdnsd_sleep(mdnsd d) + { ++ /* ++ * Unused ++ * mdnsdr r; ++ */ + int sec, usec; +- mdnsdr r; + d->sleep.tv_sec = d->sleep.tv_usec = 0; + #define RET while(d->sleep.tv_usec > 1000000) {d->sleep.tv_sec++;d->sleep.tv_usec -= 1000000;} return &d->sleep; + +@@ -665,7 +680,7 @@ + q->next = d->queries[i]; + q->list = d->qlist; + d->qlist = d->queries[i] = q; +- while(cur = _c_next(d,cur,q->name,q->type)) ++ while( (cur = _c_next(d,cur,q->name,q->type)) ) + cur->q = q; // any cached entries should be associated + _q_reset(d,q); + q->nexttry = d->checkqlist = d->now.tv_sec; // new questin, immediately send out diff --git a/dns/mdnsd/files/patch-mhttp.c b/dns/mdnsd/files/patch-mhttp.c new file mode 100644 index 000000000000..372e7fbdbfa3 --- /dev/null +++ b/dns/mdnsd/files/patch-mhttp.c @@ -0,0 +1,57 @@ +diff -ruN mhttp.c.orig mhttp.c +--- mhttp.c.orig Tue Feb 18 08:54:56 2003 ++++ mhttp.c Mon Sep 25 22:11:17 2006 +@@ -1,9 +1,16 @@ ++#include <arpa/inet.h> + #include <sys/types.h> + #include <sys/socket.h> ++#include <sys/uio.h> + #include <netinet/in.h> + #include <fcntl.h> + #include <errno.h> + #include <signal.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <strings.h> ++#include <unistd.h> + + #include "mdnsd.h" + #include "sdtxt.h" +@@ -64,7 +71,8 @@ + mdnsd d; + mdnsdr r; + struct message m; +- unsigned long int ip; ++ //unsigned long int ip; ++ struct in_addr ip; + unsigned short int port; + struct timeval *tv; + int bsize, ssize = sizeof(struct sockaddr_in); +@@ -76,9 +84,9 @@ + int len = 0; + xht h; + +- if(argc < 4) { printf("usage: mhttp 'unique name' 12.34.56.78 80 '/optionalpath'\n"); return; } ++ if(argc < 4) { printf("usage: mhttp 'unique name' 12.34.56.78 80 '/optionalpath'\n"); return 0; } + +- ip = inet_addr(argv[2]); ++ ip.s_addr = inet_addr(argv[2]); + port = atoi(argv[3]); + printf("Announcing .local site named '%s' to %s:%d and extra path '%s'\n",argv[1],inet_ntoa(ip),port,argv[4]); + +@@ -127,12 +135,12 @@ + } + if(bsize < 0 && errno != EAGAIN) { printf("can't read from socket %d: %s\n",errno,strerror(errno)); return 1; } + } +- while(mdnsd_out(d,&m,&ip,&port)) ++ while(mdnsd_out(d,&m,(unsigned long int *)&(ip.s_addr),&port)) + { + bzero(&to, sizeof(to)); + to.sin_family = AF_INET; + to.sin_port = port; +- to.sin_addr.s_addr = ip; ++ to.sin_addr.s_addr = ip.s_addr; + if(sendto(s,message_packet(&m),message_packet_len(&m),0,(struct sockaddr *)&to,sizeof(struct sockaddr_in)) != message_packet_len(&m)) { printf("can't write to socket: %s\n",strerror(errno)); return 1; } + } + if(_shutdown) break; diff --git a/dns/mdnsd/files/patch-mquery.c b/dns/mdnsd/files/patch-mquery.c new file mode 100644 index 000000000000..a5113d96fb1d --- /dev/null +++ b/dns/mdnsd/files/patch-mquery.c @@ -0,0 +1,51 @@ +diff -ruN mquery.c.orig mquery.c +--- mquery.c.orig Tue Feb 18 08:59:49 2003 ++++ mquery.c Mon Sep 25 22:11:18 2006 +@@ -1,21 +1,29 @@ + #include <sys/types.h> + #include <sys/socket.h> ++#include <stdio.h> + #include <netinet/in.h> ++#include <arpa/inet.h> + #include <fcntl.h> + #include <errno.h> ++#include <stdlib.h> ++#include <string.h> ++#include <strings.h> ++#include <unistd.h> + + #include "mdnsd.h" + + // print an answer + int ans(mdnsda a, void *arg) + { ++ struct in_addr ip; + int now; ++ ip.s_addr = a->ip; + if(a->ttl == 0) now = 0; + else now = a->ttl - time(0); + switch(a->type) + { + case QTYPE_A: +- printf("A %s for %d seconds to ip %s\n",a->name,now,inet_ntoa(a->ip)); ++ printf("A %s for %d seconds to ip %s\n",a->name,now,inet_ntoa(ip)); + break; + case QTYPE_PTR: + printf("PTR %s for %d seconds to %s\n",a->name,now,a->rdname); +@@ -26,6 +34,7 @@ + default: + printf("%d %s for %d seconds with %d data\n",a->type,a->name,now,a->rdlen); + } ++ return 0; + } + + // create multicast 224.0.0.251:5353 socket +@@ -74,7 +83,7 @@ + fd_set fds; + int s; + +- if(argc != 3) { printf("usage: mquery 12 _http._tcp.local.\n"); return; } ++ if(argc != 3) { printf("usage: mquery 12 _http._tcp.local.\n"); return 0; } + + d = mdnsd_new(1,1000); + if((s = msock()) == 0) { printf("can't create socket: %s\n",strerror(errno)); return 1; } diff --git a/dns/mdnsd/files/patch-sdtxt.c b/dns/mdnsd/files/patch-sdtxt.c new file mode 100644 index 000000000000..0b52e75e5f8c --- /dev/null +++ b/dns/mdnsd/files/patch-sdtxt.c @@ -0,0 +1,27 @@ +diff -ruN sdtxt.c.orig sdtxt.c +--- sdtxt.c.orig Tue Feb 18 08:55:19 2003 ++++ sdtxt.c Mon Sep 25 22:11:19 2006 +@@ -1,5 +1,5 @@ + #include "sdtxt.h" +- ++#include <stdlib.h> + #include <string.h> + + // the universe is bound in equal parts by arrogance and altruism, any attempt to alter this would be suicide +@@ -21,10 +21,14 @@ + + void _sd2txt_write(xht h, const char *key, void *val, void *arg) + { ++ /* ++ * Unused ++ * int len; ++ */ + unsigned char **txtp = (unsigned char **)arg; + char *cval = (char*)val; +- int len; +- ++ ++ + // copy in lengths, then strings + **txtp = _sd2txt_len(key,(char*)val); + (*txtp)++; diff --git a/dns/mdnsd/files/patch-xht.c b/dns/mdnsd/files/patch-xht.c new file mode 100644 index 000000000000..a3c123b9a014 --- /dev/null +++ b/dns/mdnsd/files/patch-xht.c @@ -0,0 +1,36 @@ +diff -ruN xht.c.orig xht.c +--- xht.c.orig Tue Feb 18 08:57:07 2003 ++++ xht.c Mon Sep 25 22:11:20 2006 +@@ -1,4 +1,6 @@ + #include "xht.h" ++#include <stdlib.h> ++#include <string.h> + + typedef struct xhn_struct + { +@@ -83,13 +85,15 @@ + /* when flag is set, we manage their mem and free em first */ + if(n->flag) + { +- free(n->key); ++ free((void *)n->key); + free(n->val); + } + + n->flag = flag; + n->key = key; + n->val = val; ++ ++ return NULL; + } + + void xht_set(xht h, const char *key, void *val) +@@ -140,7 +144,7 @@ + f = n->next; + if(n->flag) + { +- free(n->key); ++ free((void *)n->key); + free(n->val); + } + free(n); diff --git a/dns/mdnsd/pkg-plist b/dns/mdnsd/pkg-plist index 163cb574f318..e69de29bb2d1 100644 --- a/dns/mdnsd/pkg-plist +++ b/dns/mdnsd/pkg-plist @@ -1,2 +0,0 @@ -bin/mhttp -bin/mquery |