From 13d36533b5567f735f53ace921218320571edd54 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 10 Apr 2015 15:47:28 -0700 Subject: [PATCH] cleanup: Declare some unshared functions static. --- minissdp.c | 2 +- tivo_beacon.c | 2 +- tivo_utils.c | 2 +- upnpsoap.c | 102 +++++++++++++++++++++++++------------------------- upnpsoap.h | 6 --- 5 files changed, 54 insertions(+), 60 deletions(-) diff --git a/minissdp.c b/minissdp.c index ba9a861..60d69ec 100644 --- a/minissdp.c +++ b/minissdp.c @@ -307,7 +307,7 @@ SendSSDPNotifies(int s, const char *host, unsigned short port, } } -void +static void ParseUPnPClient(char *location) { char buf[8192]; diff --git a/tivo_beacon.c b/tivo_beacon.c index 20aba28..f2f80aa 100644 --- a/tivo_beacon.c +++ b/tivo_beacon.c @@ -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; diff --git a/tivo_utils.c b/tivo_utils.c index 699837c..111e9b6 100644 --- a/tivo_utils.c +++ b/tivo_utils.c @@ -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; diff --git a/upnpsoap.c b/upnpsoap.c index 0a71863..77fc468 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -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:Client" + "UPnPError" + "" + "" + "%d" + "%s" + "" + "" + "" + "" + ""; + + 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:Client" - "UPnPError" - "" - "" - "%d" - "%s" - "" - "" - "" - "" - ""; - - 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); -} - diff --git a/upnpsoap.h b/upnpsoap.h index 484f512..b3e94a0 100644 --- a/upnpsoap.h +++ b/upnpsoap.h @@ -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