cleanup: Declare some unshared functions static.

This commit is contained in:
Justin Maggard 2015-04-10 15:47:28 -07:00
parent c1bb37a387
commit 13d36533b5
5 changed files with 54 additions and 60 deletions

View File

@ -307,7 +307,7 @@ SendSSDPNotifies(int s, const char *host, unsigned short port,
}
}
void
static void
ParseUPnPClient(char *location)
{
char buf[8192];

View File

@ -176,7 +176,7 @@ sendBeaconMessage(int fd, struct sockaddr_in * client, int len, int broadcast)
*
* Returns true if this was a broadcast beacon msg
*/
int
static int
rcvBeaconMessage(char *beacon)
{
char *tivoConnect = NULL;

View File

@ -123,7 +123,7 @@ seedRandomByte(uint32_t seed)
return sqlite3Prng.s[t];
}
void
static void
seedRandomness(int n, void *pbuf, uint32_t seed)
{
unsigned char *zbuf = pbuf;

View File

@ -78,6 +78,55 @@
# define __SORT_LIMIT
#endif
/* Standard Errors:
*
* errorCode errorDescription Description
* -------- ---------------- -----------
* 401 Invalid Action No action by that name at this service.
* 402 Invalid Args Could be any of the following: not enough in args,
* too many in args, no in arg by that name,
* one or more in args are of the wrong data type.
* 403 Out of Sync Out of synchronization.
* 501 Action Failed May be returned in current state of service
* prevents invoking that action.
* 600-699 TBD Common action errors. Defined by UPnP Forum
* Technical Committee.
* 700-799 TBD Action-specific errors for standard actions.
* Defined by UPnP Forum working committee.
* 800-899 TBD Action-specific errors for non-standard actions.
* Defined by UPnP vendor.
*/
static void
SoapError(struct upnphttp * h, int errCode, const char * errDesc)
{
static const char resp[] =
"<s:Envelope "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body>"
"<s:Fault>"
"<faultcode>s:Client</faultcode>"
"<faultstring>UPnPError</faultstring>"
"<detail>"
"<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">"
"<errorCode>%d</errorCode>"
"<errorDescription>%s</errorDescription>"
"</UPnPError>"
"</detail>"
"</s:Fault>"
"</s:Body>"
"</s:Envelope>";
char body[2048];
int bodylen;
DPRINTF(E_WARN, L_HTTP, "Returning UPnPError %d: %s\n", errCode, errDesc);
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
SendResp_upnphttp(h);
CloseSocket_upnphttp(h);
}
static void
BuildSendAndCloseSoapResp(struct upnphttp * h,
const char * body, int bodylen)
@ -515,7 +564,7 @@ set_filter_flags(char *filter, struct upnphttp *h)
return flags;
}
char *
static char *
parse_sort_criteria(char *sortCriteria, int *error)
{
char *order = NULL;
@ -1337,7 +1386,7 @@ browse_error:
free(str.data);
}
inline void
static inline void
charcat(struct string_s *str, char c)
{
if (str->size <= str->off)
@ -1945,52 +1994,3 @@ ExecuteSoapAction(struct upnphttp * h, const char * action, int n)
SoapError(h, 401, "Invalid Action");
}
/* Standard Errors:
*
* errorCode errorDescription Description
* -------- ---------------- -----------
* 401 Invalid Action No action by that name at this service.
* 402 Invalid Args Could be any of the following: not enough in args,
* too many in args, no in arg by that name,
* one or more in args are of the wrong data type.
* 403 Out of Sync Out of synchronization.
* 501 Action Failed May be returned in current state of service
* prevents invoking that action.
* 600-699 TBD Common action errors. Defined by UPnP Forum
* Technical Committee.
* 700-799 TBD Action-specific errors for standard actions.
* Defined by UPnP Forum working committee.
* 800-899 TBD Action-specific errors for non-standard actions.
* Defined by UPnP vendor.
*/
void
SoapError(struct upnphttp * h, int errCode, const char * errDesc)
{
static const char resp[] =
"<s:Envelope "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body>"
"<s:Fault>"
"<faultcode>s:Client</faultcode>"
"<faultstring>UPnPError</faultstring>"
"<detail>"
"<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">"
"<errorCode>%d</errorCode>"
"<errorDescription>%s</errorDescription>"
"</UPnPError>"
"</detail>"
"</s:Fault>"
"</s:Body>"
"</s:Envelope>";
char body[2048];
int bodylen;
DPRINTF(E_WARN, L_HTTP, "Returning UPnPError %d: %s\n", errCode, errDesc);
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
SendResp_upnphttp(h);
CloseSocket_upnphttp(h);
}

View File

@ -50,11 +50,5 @@ struct Response
void
ExecuteSoapAction(struct upnphttp *, const char *, int);
/* SoapError():
* sends a correct SOAP error with an UPNPError code and
* description */
void
SoapError(struct upnphttp * h, int errCode, const char * errDesc);
#endif