Add UNUSED(arg) macro to remove unused argument warning.

This commit is contained in:
Thomas Bernard 2012-05-01 11:47:37 +02:00
parent db982e1740
commit ad95793e93
9 changed files with 70 additions and 9 deletions

View File

@ -2,6 +2,7 @@ $Id: Changelog.txt,v 1.278 2012/04/30 21:21:32 nanard Exp $
2012/04/30:
Clean up settings of CFLAGS in Makefile's
Add UNUSED(arg) macro to remove unused argument warning.
Fix error handling in upnpevents.c (was causing segfault on Solaris !)
2012/04/26:

View File

@ -1,4 +1,4 @@
/* $Id: miniupnpdctl.c,v 1.9 2012/02/04 23:34:39 nanard Exp $ */
/* $Id: miniupnpdctl.c,v 1.10 2012/04/30 21:08:00 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -14,6 +14,8 @@
#include <sys/un.h>
#include <signal.h>
#include "macros.h"
#if 0
static void sighandler(int sig)
{
@ -30,6 +32,8 @@ main(int argc, char * * argv)
int l;
int s;
struct sockaddr_un addr;
UNUSED(argc);
UNUSED(argv);
/*signal(SIGINT, sighandler);*/
s = socket(AF_UNIX, SOCK_STREAM, 0);

View File

@ -1,4 +1,4 @@
/* $Id: natpmp.c,v 1.28 2012/02/04 23:34:39 nanard Exp $ */
/* $Id: natpmp.c,v 1.30 2012/04/30 21:08:00 nanard Exp $ */
/* MiniUPnP project
* (c) 2007-2012 Thomas Bernard
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
@ -14,6 +14,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "macros.h"
#include "config.h"
#include "natpmp.h"
#include "upnpglobalvars.h"
@ -74,6 +76,7 @@ static void FillPublicAddressResponse(unsigned char * resp, in_addr_t senderaddr
{
#ifndef MULTIPLE_EXTERNAL_IP
char tmp[16];
UNUSED(senderaddr);
if(use_ext_ip_addr) {
inet_pton(AF_INET, use_ext_ip_addr, resp+8);
@ -91,6 +94,7 @@ static void FillPublicAddressResponse(unsigned char * resp, in_addr_t senderaddr
}
#else
struct lan_addr_s * lan_addr;
for(lan_addr = lan_addrs.lh_first; lan_addr != NULL; lan_addr = lan_addr->list.le_next) {
if( (senderaddr & lan_addr->mask.s_addr)
== (lan_addr->addr.s_addr & lan_addr->mask.s_addr)) {

View File

@ -1,4 +1,4 @@
/* $Id: iptcrdr.c,v 1.48 2012/03/05 20:36:19 nanard Exp $ */
/* $Id: iptcrdr.c,v 1.49 2012/04/30 21:08:02 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
@ -56,6 +56,8 @@
#define IPT_ALIGN XT_ALIGN
#endif
#include "../macros.h"
#include "../config.h"
#include "iptcrdr.h"
#include "../upnpglobalvars.h"
@ -204,7 +206,10 @@ add_redirect_rule2(const char * ifname,
const char * iaddr, unsigned short iport, int proto,
const char * desc, unsigned int timestamp)
{
int r = addnatrule(proto, eport, iaddr, iport, rhost);
int r;
UNUSED(ifname);
r = addnatrule(proto, eport, iaddr, iport, rhost);
if(r >= 0)
add_redirect_desc(eport, proto, desc, timestamp);
return r;
@ -216,6 +221,10 @@ add_filter_rule2(const char * ifname,
unsigned short eport, unsigned short iport,
int proto, const char * desc)
{
UNUSED(ifname);
UNUSED(eport);
UNUSED(desc);
return add_filter_rule(proto, rhost, iaddr, iport);
}
@ -235,6 +244,7 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto,
const struct ipt_entry_target * target;
const struct ip_nat_multi_range * mr;
const struct ipt_entry_match *match;
UNUSED(ifname);
h = iptc_init("nat");
if(!h)
@ -332,6 +342,7 @@ get_redirect_rule_by_index(int index,
const struct ipt_entry_target * target;
const struct ip_nat_multi_range * mr;
const struct ipt_entry_match *match;
UNUSED(ifname);
h = iptc_init("nat");
if(!h)

View File

@ -1,4 +1,4 @@
/* $Id: obsdrdr.c,v 1.73 2012/04/18 20:45:12 nanard Exp $ */
/* $Id: obsdrdr.c,v 1.74 2012/05/01 09:20:43 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -55,6 +55,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "../macros.h"
#include "../config.h"
#include "obsdrdr.h"
#include "../upnpglobalvars.h"
@ -327,6 +328,10 @@ add_filter_rule2(const char * ifname,
int proto, const char * desc)
{
#ifndef PF_ENABLE_FILTER_RULES
UNUSED(ifname);
UNUSED(rhost); UNUSED(iaddr);
UNUSED(eport); UNUSED(iport);
UNUSED(proto); UNUSED(desc);
return 0;
#else
int r;
@ -460,6 +465,8 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto,
#ifndef PF_NEWSTYLE
struct pfioc_pooladdr pp;
#endif
UNUSED(ifname);
if(dev<0) {
syslog(LOG_ERR, "pf device is not open");
return -1;
@ -559,6 +566,8 @@ delete_redirect_rule(const char * ifname, unsigned short eport, int proto)
{
int i, n;
struct pfioc_rule pr;
UNUSED(ifname);
if(dev<0) {
syslog(LOG_ERR, "pf device is not open");
return -1;
@ -611,6 +620,7 @@ int
delete_filter_rule(const char * ifname, unsigned short eport, int proto)
{
#ifndef PF_ENABLE_FILTER_RULES
UNUSED(ifname); UNUSED(eport); UNUSED(proto);
return 0;
#else
int i, n;

View File

@ -1,4 +1,4 @@
/* $Id: testupnpdescgen.c,v 1.27 2012/02/04 23:34:39 nanard Exp $ */
/* $Id: testupnpdescgen.c,v 1.29 2012/04/30 21:08:00 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -13,6 +13,7 @@
#include <sys/types.h>
#include <errno.h>
#include "macros.h"
#include "config.h"
#include "upnpdescgen.h"
@ -33,6 +34,7 @@ int ipv6fc_inbound_pinhole_allowed = 1;
int getifaddr(const char * ifname, char * buf, int len)
{
UNUSED(ifname);
strncpy(buf, "1.2.3.4", len);
return 0;
}
@ -44,6 +46,7 @@ int upnp_get_portmapping_number_of_entries(void)
int get_wan_connection_status(const char * ifname)
{
UNUSED(ifname);
return 2;
}
@ -54,6 +57,7 @@ xml_pretty_print(const char * s, int len, FILE * f)
int n = 0, i;
int elt_close = 0;
int c, indent = 0;
if(!s)
return n;
while(len > 0)
@ -121,6 +125,8 @@ main(int argc, char * * argv)
char * s;
int l;
FILE * f;
UNUSED(argc);
UNUSED(argv);
if(mkdir("testdescs", 0777) < 0) {
if(errno != EEXIST) {

View File

@ -1,4 +1,4 @@
/* $Id: upnpredirect.c,v 1.77 2012/04/27 06:48:44 nanard Exp $ */
/* $Id: upnpredirect.c,v 1.79 2012/04/30 21:08:00 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -18,6 +18,7 @@
#include <ctype.h>
#include <unistd.h>
#include "macros.h"
#include "config.h"
#include "upnpredirect.h"
#include "upnpglobalvars.h"
@ -766,6 +767,7 @@ upnp_get_pinhole_info(unsigned short uid,
int r;
unsigned int timestamp;
u_int64_t packets_tmp, bytes_tmp;
r = get_pinhole(uid, raddr, raddrlen, rport,
iaddr, iaddrlen, iport, proto, &timestamp,
&packets_tmp, &bytes_tmp);
@ -783,6 +785,10 @@ upnp_get_pinhole_info(unsigned short uid,
}
return r;
#else
UNUSED(uid);
UNUSED(raddr); UNUSED(raddrlen); UNUSED(rport);
UNUSED(iaddr); UNUSED(iaddrlen); UNUSED(iport);
UNUSED(proto); UNUSED(leasetime); UNUSED(packets);
return -42; /* not implemented */
#endif
}
@ -792,9 +798,12 @@ upnp_update_inboundpinhole(unsigned short uid, unsigned int leasetime)
{
#ifdef USE_PF
unsigned int timestamp;
timestamp = time(NULL) + leasetime;
return update_pinhole(uid, timestamp);
#else
UNUSED(uid); UNUSED(leasetime);
return -42; /* not implemented */
#endif
}
@ -805,10 +814,13 @@ upnp_delete_inboundpinhole(unsigned short uid)
#ifdef USE_PF
return delete_pinhole(uid);
#else
UNUSED(uid);
return -1;
#endif
}
#if 0
/*
* Result:
* 1: Found Result
@ -1025,6 +1037,7 @@ upnp_check_pinhole_working(const char * uid,
return -42; /* to be implemented */
#endif
}
#endif
int
upnp_clean_expired_pinholes(unsigned int * next_timestamp)
@ -1032,6 +1045,8 @@ upnp_clean_expired_pinholes(unsigned int * next_timestamp)
#ifdef USE_PF
return clean_pinhole_list(next_timestamp);
#else
UNUSED(next_timestamp);
return 0; /* nothing to do */
#endif
}

View File

@ -1,4 +1,4 @@
/* $Id: upnpredirect.h,v 1.32 2012/04/23 21:46:16 nanard Exp $ */
/* $Id: upnpredirect.h,v 1.33 2012/04/30 13:45:34 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -150,8 +150,10 @@ int
upnp_delete_inboundpinhole(unsigned short uid);
/* ... */
#if 0
int
upnp_check_pinhole_working(const char * uid, char * eaddr, char * iaddr, unsigned short * eport, unsigned short * iport, char * protocol, int * rulenum_used);
#endif
/* ? */
int

View File

@ -1,4 +1,4 @@
/* $Id: upnpsoap.c,v 1.106 2012/04/23 22:38:06 nanard Exp $ */
/* $Id: upnpsoap.c,v 1.108 2012/04/30 21:08:01 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard
@ -17,6 +17,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include "macros.h"
#include "config.h"
#include "upnpglobalvars.h"
#include "upnphttp.h"
@ -66,6 +67,8 @@ GetConnectionTypeInfo(struct upnphttp * h, const char * action)
"<NewConnectionType>IP_Routed</NewConnectionType>"
"<NewPossibleConnectionTypes>IP_Routed</NewPossibleConnectionTypes>"
"</u:GetConnectionTypeInfoResponse>";
UNUSED(action);
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);
}
@ -233,6 +236,7 @@ GetNATRSIPStatus(struct upnphttp * h, const char * action)
"<NewRSIPAvailable>0</NewRSIPAvailable>"
"<NewNATEnabled>1</NewNATEnabled>"
"</u:GetNATRSIPStatusResponse>";
UNUSED(action);
/* 2.2.9. RSIPAvailable
* This variable indicates if Realm-specific IP (RSIP) is available
* as a feature on the InternetGatewayDevice. RSIP is being defined
@ -720,6 +724,7 @@ DeletePortMappingRange(struct upnphttp * h, const char * action)
int manage;
unsigned short * port_list;
unsigned int i, number = 0;
UNUSED(action);
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
startport = (unsigned short)atoi(GetValueFromNameValueList(&data, "NewStartPort"));
@ -1006,6 +1011,7 @@ SetConnectionType(struct upnphttp * h, const char * action)
{
const char * connection_type;
struct NameValueParserData data;
UNUSED(action);
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
connection_type = GetValueFromNameValueList(&data, "NewConnectionType");
@ -1019,6 +1025,7 @@ SetConnectionType(struct upnphttp * h, const char * action)
static void
RequestConnection(struct upnphttp * h, const char * action)
{
UNUSED(action);
SoapError(h, 606, "Action not authorized");
}
@ -1026,6 +1033,7 @@ RequestConnection(struct upnphttp * h, const char * action)
static void
ForceTermination(struct upnphttp * h, const char * action)
{
UNUSED(action);
SoapError(h, 606, "Action not authorized");
}