From 3d7998a44299c69e7d721c4c5a20ddc32cec562b Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 4 Aug 2009 15:24:23 +0200 Subject: Use "static" keyword for functions --- libezxml/src/ezxml.c | 181 ++++++++++++++++++++++++------------------------- libezxml/src/ezxml.h | 35 ---------- libpiano/src/main.c | 4 +- libpiano/src/xml.c | 29 ++++---- libwaitress/src/main.c | 8 +-- libwardrobe/src/main.c | 4 +- libwardrobe/src/md5.c | 12 ++-- libwardrobe/src/md5.h | 3 +- src/player.c | 14 ++-- src/settings.c | 2 +- src/ui_act.c | 4 +- src/ui_readline.c | 8 +-- 12 files changed, 135 insertions(+), 169 deletions(-) diff --git a/libezxml/src/ezxml.c b/libezxml/src/ezxml.c index 17c8997..4ba607a 100644 --- a/libezxml/src/ezxml.c +++ b/libezxml/src/ezxml.c @@ -53,6 +53,70 @@ struct ezxml_root { // additional data for the root tag char *EZXML_NIL[] = { NULL }; // empty, null terminated array of strings +// sets a flag for the given tag and returns the tag +static ezxml_t ezxml_set_flag(ezxml_t xml, short flag) { + if (xml) xml->flags |= flag; + return xml; +} + +// inserts an existing tag into an ezxml structure +static ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off) +{ + ezxml_t cur, prev, head; + + xml->next = xml->sibling = xml->ordered = NULL; + xml->off = off; + xml->parent = dest; + + if ((head = dest->child)) { // already have sub tags + if (head->off <= off) { // not first subtag + for (cur = head; cur->ordered && cur->ordered->off <= off; + cur = cur->ordered); + xml->ordered = cur->ordered; + cur->ordered = xml; + } + else { // first subtag + xml->ordered = head; + dest->child = xml; + } + + for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name); + prev = cur, cur = cur->sibling); // find tag type + if (cur && cur->off <= off) { // not first of type + while (cur->next && cur->next->off <= off) cur = cur->next; + xml->next = cur->next; + cur->next = xml; + } + else { // first tag of this type + if (prev && cur) prev->sibling = cur->sibling; // remove old first + xml->next = cur; // old first tag is now next + for (cur = head, prev = NULL; cur && cur->off <= off; + prev = cur, cur = cur->sibling); // new sibling insert point + xml->sibling = cur; + if (prev) prev->sibling = xml; + } + } + else dest->child = xml; // only sub tag + + return xml; +} + +// Adds a child tag. off is the offset of the child tag relative to the start +// of the parent tag's character content. Returns the child tag. +static ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off) +{ + ezxml_t child; + + if (! xml) return NULL; + child = (ezxml_t)memset(malloc(sizeof(struct ezxml)), '\0', + sizeof(struct ezxml)); + child->name = (char *)name; + child->attr = EZXML_NIL; + child->txt = ""; + + return ezxml_insert(child, xml, off); +} + // returns the first child tag with the given name or NULL if not found ezxml_t ezxml_child(ezxml_t xml, const char *name) { @@ -61,6 +125,21 @@ ezxml_t ezxml_child(ezxml_t xml, const char *name) return xml; } +// returns a new empty ezxml structure with the given root tag name +static ezxml_t ezxml_new(const char *name) +{ + static char *ent[] = { "lt;", "<", "gt;", ">", "quot;", """, + "apos;", "'", "amp;", "&", NULL }; + ezxml_root_t root = (ezxml_root_t)memset(malloc(sizeof(struct ezxml_root)), + '\0', sizeof(struct ezxml_root)); + root->xml.name = (char *)name; + root->cur = &root->xml; + strcpy(root->err, root->xml.txt = ""); + root->ent = memcpy(malloc(sizeof(ent)), ent, sizeof(ent)); + root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL); + return &root->xml; +} + // returns the Nth tag with the same name in the same subsection or NULL if not // found ezxml_t ezxml_idx(ezxml_t xml, int idx) @@ -87,7 +166,7 @@ const char *ezxml_attr(ezxml_t xml, const char *attr) } // same as ezxml_get but takes an already initialized va_list -ezxml_t ezxml_vget(ezxml_t xml, va_list ap) +static ezxml_t ezxml_vget(ezxml_t xml, va_list ap) { char *name = va_arg(ap, char *); int idx = -1; @@ -117,7 +196,7 @@ ezxml_t ezxml_get(ezxml_t xml, ...) } // set an error string and return root -ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...) +static ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...) { va_list ap; int line = 1; @@ -139,7 +218,7 @@ ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...) // for cdata sections, ' ' for attribute normalization, or '*' for non-cdata // attribute normalization. Returns s, or if the decoded string is longer than // s, returns a malloced string that must be freed. -char *ezxml_decode(char *s, char **ent, char t) +static char *ezxml_decode(char *s, char **ent, char t) { char *e, *r = s, *m = s; long b, c, d, l; @@ -202,7 +281,7 @@ char *ezxml_decode(char *s, char **ent, char t) } // called when parser finds start of new tag -void ezxml_open_tag(ezxml_root_t root, char *name, char **attr) +static void ezxml_open_tag(ezxml_root_t root, char *name, char **attr) { ezxml_t xml = root->cur; @@ -214,7 +293,7 @@ void ezxml_open_tag(ezxml_root_t root, char *name, char **attr) } // called when parser finds character content between open and closing tag -void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t) +static void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t) { ezxml_t xml = root->cur; char *m = s; @@ -238,7 +317,7 @@ void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t) } // called when parser finds closing tag -ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s) +static ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s) { if (! root->cur || ! root->cur->name || strcmp(name, root->cur->name)) return ezxml_err(root, s, "unexpected closing tag ", name); @@ -249,7 +328,7 @@ ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s) // checks for circular entity references, returns non-zero if no circular // references are found, zero otherwise -int ezxml_ent_ok(char *name, char *s, char **ent) +static int ezxml_ent_ok(char *name, char *s, char **ent) { int i; @@ -263,7 +342,7 @@ int ezxml_ent_ok(char *name, char *s, char **ent) } // called when the parser finds a processing instruction -void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len) +static void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len) { int i = 0, j = 1; char *target = s; @@ -300,7 +379,7 @@ void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len) } // called when the parser finds an internal doctype subset -short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len) +static short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len) { char q, *c, *t, *n = NULL, *v, **ent, **pe; int i, j; @@ -403,7 +482,7 @@ short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len) // Converts a UTF-16 string to UTF-8. Returns a new string that must be freed // or NULL if no conversion was needed. -char *ezxml_str2utf8(char **s, size_t *len) +static char *ezxml_str2utf8(char **s, size_t *len) { char *u; size_t l = 0, sl, max = *len; @@ -435,7 +514,7 @@ char *ezxml_str2utf8(char **s, size_t *len) } // frees a tag attribute list -void ezxml_free_attr(char **attr) { +static void ezxml_free_attr(char **attr) { int i = 0; char *m; @@ -630,83 +709,3 @@ const char *ezxml_error(ezxml_t xml) return (xml) ? ((ezxml_root_t)xml)->err : ""; } -// returns a new empty ezxml structure with the given root tag name -ezxml_t ezxml_new(const char *name) -{ - static char *ent[] = { "lt;", "<", "gt;", ">", "quot;", """, - "apos;", "'", "amp;", "&", NULL }; - ezxml_root_t root = (ezxml_root_t)memset(malloc(sizeof(struct ezxml_root)), - '\0', sizeof(struct ezxml_root)); - root->xml.name = (char *)name; - root->cur = &root->xml; - strcpy(root->err, root->xml.txt = ""); - root->ent = memcpy(malloc(sizeof(ent)), ent, sizeof(ent)); - root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL); - return &root->xml; -} - -// inserts an existing tag into an ezxml structure -ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off) -{ - ezxml_t cur, prev, head; - - xml->next = xml->sibling = xml->ordered = NULL; - xml->off = off; - xml->parent = dest; - - if ((head = dest->child)) { // already have sub tags - if (head->off <= off) { // not first subtag - for (cur = head; cur->ordered && cur->ordered->off <= off; - cur = cur->ordered); - xml->ordered = cur->ordered; - cur->ordered = xml; - } - else { // first subtag - xml->ordered = head; - dest->child = xml; - } - - for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name); - prev = cur, cur = cur->sibling); // find tag type - if (cur && cur->off <= off) { // not first of type - while (cur->next && cur->next->off <= off) cur = cur->next; - xml->next = cur->next; - cur->next = xml; - } - else { // first tag of this type - if (prev && cur) prev->sibling = cur->sibling; // remove old first - xml->next = cur; // old first tag is now next - for (cur = head, prev = NULL; cur && cur->off <= off; - prev = cur, cur = cur->sibling); // new sibling insert point - xml->sibling = cur; - if (prev) prev->sibling = xml; - } - } - else dest->child = xml; // only sub tag - - return xml; -} - -// Adds a child tag. off is the offset of the child tag relative to the start -// of the parent tag's character content. Returns the child tag. -ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off) -{ - ezxml_t child; - - if (! xml) return NULL; - child = (ezxml_t)memset(malloc(sizeof(struct ezxml)), '\0', - sizeof(struct ezxml)); - child->name = (char *)name; - child->attr = EZXML_NIL; - child->txt = ""; - - return ezxml_insert(child, xml, off); -} - -// sets a flag for the given tag and returns the tag -ezxml_t ezxml_set_flag(ezxml_t xml, short flag) -{ - if (xml) xml->flags |= flag; - return xml; -} - diff --git a/libezxml/src/ezxml.h b/libezxml/src/ezxml.h index edd0810..0ee2513 100644 --- a/libezxml/src/ezxml.h +++ b/libezxml/src/ezxml.h @@ -90,39 +90,4 @@ void ezxml_free(ezxml_t xml); // returns parser error message or empty string if none const char *ezxml_error(ezxml_t xml); -// returns a new empty ezxml structure with the given root tag name -ezxml_t ezxml_new(const char *name); - -// wrapper for ezxml_new() that strdup()s name -#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM) - -// Adds a child tag. off is the offset of the child tag relative to the start -// of the parent tag's character content. Returns the child tag. -ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off); - -// wrapper for ezxml_add_child() that strdup()s name -#define ezxml_add_child_d(xml, name, off) \ - ezxml_set_flag(ezxml_add_child(xml, strdup(name), off), EZXML_NAMEM) - -// sets the character content for the given tag and returns the tag -ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt); - -// wrapper for ezxml_set_txt() that strdup()s txt -#define ezxml_set_txt_d(xml, txt) \ - ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM) - -// Sets the given tag attribute or adds a new attribute if not found. A value -// of NULL will remove the specified attribute. Returns the tag given. -ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value); - -// Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL -#define ezxml_set_attr_d(xml, name, value) \ - ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), strdup(name), strdup(value)) - -// sets a flag for the given tag and returns the tag -ezxml_t ezxml_set_flag(ezxml_t xml, short flag); - -// inserts an existing tag into an ezxml structure -ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off); - #endif // _EZXML_H diff --git a/libpiano/src/main.c b/libpiano/src/main.c index 29ef542..01e055b 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -42,7 +42,7 @@ THE SOFTWARE. #define PIANO_RECV_BUFFER 100*1024 /* prototypes */ -PianoReturn_t PianoAddFeedback (PianoHandle_t *, const char *, const char *, +static PianoReturn_t PianoAddFeedback (PianoHandle_t *, const char *, const char *, const char *, const char *, const char *, PianoSongRating_t); const char *PianoAudioFormatToString (PianoAudioFormat_t); @@ -335,7 +335,7 @@ PianoReturn_t PianoMoveSong (PianoHandle_t *ph, * @param song focus trait id or NULL * @param rating */ -PianoReturn_t PianoAddFeedback (PianoHandle_t *ph, const char *stationId, +static PianoReturn_t PianoAddFeedback (PianoHandle_t *ph, const char *stationId, const char *songMusicId, const char *songMatchingSeed, const char *songUserSeed, const char *songFocusTraitId, PianoSongRating_t rating) { diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index b9b9a96..463caa7 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -31,9 +31,9 @@ THE SOFTWARE. #include "config.h" #include "main.h" -void PianoXmlStructParser (const ezxml_t structRoot, - void (*callback) (const char *, const ezxml_t, void *), void *data); -char *PianoXmlGetNodeText (const ezxml_t node); +static void PianoXmlStructParser (const ezxml_t, + void (*callback) (const char *, const ezxml_t, void *), void *); +static char *PianoXmlGetNodeText (const ezxml_t); /* parse fault and get fault type * @param xml content @@ -41,7 +41,8 @@ char *PianoXmlGetNodeText (const ezxml_t node); * @param return error string * @return nothing */ -void PianoXmlIsFaultCb (const char *key, const ezxml_t value, void *data) { +static void PianoXmlIsFaultCb (const char *key, const ezxml_t value, + void *data) { PianoReturn_t *ret = data; char *valueStr = PianoXmlGetNodeText (value); char *matchStart, *matchEnd, *matchStr; @@ -101,7 +102,7 @@ void PianoXmlIsFaultCb (const char *key, const ezxml_t value, void *data) { * @param document root of xml doc * @return _RET_OK or fault code (_RET_*) */ -PianoReturn_t PianoXmlIsFault (ezxml_t xmlDoc) { +static PianoReturn_t PianoXmlIsFault (ezxml_t xmlDoc) { PianoReturn_t ret; if ((xmlDoc = ezxml_child (xmlDoc, "fault")) != NULL) { @@ -128,7 +129,7 @@ PianoReturn_t PianoXmlIsFault (ezxml_t xmlDoc) { * freed soon * @param extra data for callback */ -void PianoXmlStructParser (const ezxml_t structRoot, +static void PianoXmlStructParser (const ezxml_t structRoot, void (*callback) (const char *, const ezxml_t, void *), void *data) { ezxml_t curNode, keyNode, valueNode; char *key; @@ -158,7 +159,7 @@ void PianoXmlStructParser (const ezxml_t structRoot, * @param returns document root * @return _OK or error */ -PianoReturn_t PianoXmlInitDoc (char *xmlStr, ezxml_t *xmlDoc) { +static PianoReturn_t PianoXmlInitDoc (char *xmlStr, ezxml_t *xmlDoc) { PianoReturn_t ret; if ((*xmlDoc = ezxml_parse_str (xmlStr, strlen (xmlStr))) == NULL) { @@ -177,7 +178,7 @@ PianoReturn_t PianoXmlInitDoc (char *xmlStr, ezxml_t *xmlDoc) { * or subnodes, just ignore them * @param xml node */ -char *PianoXmlGetNodeText (const ezxml_t node) { +static char *PianoXmlGetNodeText (const ezxml_t node) { char *retTxt = NULL; retTxt = ezxml_txt (node); @@ -194,7 +195,7 @@ char *PianoXmlGetNodeText (const ezxml_t node) { * @param pointer to userinfo structure * @return nothing */ -void PianoXmlParseUserinfoCb (const char *key, const ezxml_t value, +static void PianoXmlParseUserinfoCb (const char *key, const ezxml_t value, void *data) { PianoUserInfo_t *user = data; char *valueStr = PianoXmlGetNodeText (value); @@ -208,7 +209,7 @@ void PianoXmlParseUserinfoCb (const char *key, const ezxml_t value, } } -void PianoXmlParseStationsCb (const char *key, const ezxml_t value, +static void PianoXmlParseStationsCb (const char *key, const ezxml_t value, void *data) { PianoStation_t *station = data; char *valueStr = PianoXmlGetNodeText (value); @@ -224,7 +225,7 @@ void PianoXmlParseStationsCb (const char *key, const ezxml_t value, } } -void PianoXmlParsePlaylistCb (const char *key, const ezxml_t value, +static void PianoXmlParsePlaylistCb (const char *key, const ezxml_t value, void *data) { PianoSong_t *song = data; char *valueStr = PianoXmlGetNodeText (value); @@ -302,7 +303,7 @@ PianoReturn_t PianoXmlParseUserinfo (PianoHandle_t *ph, char *xml) { return PIANO_RET_OK; } -void PianoXmlParseQuickMixStationsCb (const char *key, const ezxml_t value, +static void PianoXmlParseQuickMixStationsCb (const char *key, const ezxml_t value, void *data) { char ***retIds = data; char **ids = NULL; @@ -513,7 +514,7 @@ PianoReturn_t PianoXmlParseSimple (char *xml) { /* xml struct parser callback, used in PianoXmlParseSearchCb */ -void PianoXmlParseSearchArtistCb (const char *key, const ezxml_t value, +static void PianoXmlParseSearchArtistCb (const char *key, const ezxml_t value, void *data) { PianoArtist_t *artist = data; char *valueStr = PianoXmlGetNodeText (value); @@ -528,7 +529,7 @@ void PianoXmlParseSearchArtistCb (const char *key, const ezxml_t value, /* callback for xml struct parser used in PianoXmlParseSearch, "switch" for * PianoXmlParseSearchArtistCb and PianoXmlParsePlaylistCb */ -void PianoXmlParseSearchCb (const char *key, const ezxml_t value, +static void PianoXmlParseSearchCb (const char *key, const ezxml_t value, void *data) { PianoSearchResult_t *searchResult = data; ezxml_t curNode; diff --git a/libwaitress/src/main.c b/libwaitress/src/main.c index a54c864..dbf1a74 100644 --- a/libwaitress/src/main.c +++ b/libwaitress/src/main.c @@ -54,7 +54,7 @@ inline void WaitressFree (WaitressHandle_t *waith) { * @param Waitress handle * @return true|false */ -inline char WaitressProxyEnabled (const WaitressHandle_t *waith) { +static inline char WaitressProxyEnabled (const WaitressHandle_t *waith) { return *waith->proxyHost != '\0' && *waith->proxyPort != '\0'; } @@ -178,7 +178,7 @@ inline void WaitressSetHPP (WaitressHandle_t *waith, const char *host, * @param data size * @param buffer structure */ -char WaitressFetchBufCb (void *recvData, size_t recvDataSize, void *extraData) { +static char WaitressFetchBufCb (void *recvData, size_t recvDataSize, void *extraData) { char *recvBytes = recvData; WaitressFetchBufCbBuffer_t *buffer = extraData; @@ -222,7 +222,7 @@ WaitressReturn_t WaitressFetchBuf (WaitressHandle_t *waith, char *buf, * @param timeout (microseconds) * @return WAITRESS_RET_OK, WAITRESS_RET_TIMEOUT or WAITRESS_RET_ERR */ -WaitressReturn_t WaitressPollWrite (int sockfd, const char *buf, size_t count, +static WaitressReturn_t WaitressPollWrite (int sockfd, const char *buf, size_t count, struct pollfd *sockpoll, int timeout) { int pollres = -1; @@ -248,7 +248,7 @@ WaitressReturn_t WaitressPollWrite (int sockfd, const char *buf, size_t count, * @param read () return value/written bytes * @return WAITRESS_RET_OK, WAITRESS_RET_TIMEOUT, WAITRESS_RET_ERR */ -WaitressReturn_t WaitressPollRead (int sockfd, char *buf, size_t count, +static WaitressReturn_t WaitressPollRead (int sockfd, char *buf, size_t count, struct pollfd *sockpoll, int timeout, ssize_t *retSize) { int pollres = -1; diff --git a/libwardrobe/src/main.c b/libwardrobe/src/main.c index 1be8e92..a734c26 100644 --- a/libwardrobe/src/main.c +++ b/libwardrobe/src/main.c @@ -87,7 +87,7 @@ void WardrobeDestroy (WardrobeHandle_t *wh) { * @param wardrobe handle * @return _OK or error */ -WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { +static WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { /* md5 hash length + long integer max + NULL */ char url[WARDROBE_URL_SIZE], tmp[32+55+1], *tmpDigest, *pwDigest, ret[WARDROBE_HTTP_RECV_SIZE], postUrl[1024]; @@ -154,7 +154,7 @@ WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { * @param song * @return _OK or error */ -WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh, +static WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh, const WardrobeSong_t *ws) { char postContent[WARDROBE_HTTP_SEND_SIZE]; char *urlencArtist, *urlencTitle, *urlencAlbum, ret[WARDROBE_HTTP_RECV_SIZE]; diff --git a/libwardrobe/src/md5.c b/libwardrobe/src/md5.c index d41b5c9..4b8d038 100644 --- a/libwardrobe/src/md5.c +++ b/libwardrobe/src/md5.c @@ -51,9 +51,9 @@ typedef struct { unsigned char buffer[64]; /* input buffer */ } MD5_CTX; -void MD5Init (MD5_CTX *); -void MD5Update (MD5_CTX *, unsigned char *, unsigned int); -void MD5Final (unsigned char [16], MD5_CTX *); +static void MD5Init (MD5_CTX *); +static void MD5Update (MD5_CTX *, unsigned char *, unsigned int); +static void MD5Final (unsigned char [16], MD5_CTX *); static void MD5Transform (unsigned long int [4], unsigned char [64]); static void Encode (unsigned char *, unsigned long int *, unsigned int); @@ -101,7 +101,7 @@ Rotation is separate from addition to prevent recomputation. /* MD5 initialization. Begins an MD5 operation, writing a new context. * @param context */ -void MD5Init (MD5_CTX *context) { +static void MD5Init (MD5_CTX *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; @@ -117,7 +117,7 @@ void MD5Init (MD5_CTX *context) { * @param input block * @param length of input block */ -void MD5Update (MD5_CTX *context, unsigned char *input, +static void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen) { unsigned int i, index, partLen; @@ -156,7 +156,7 @@ void MD5Update (MD5_CTX *context, unsigned char *input, * @param message digest * @param context */ -void MD5Final (unsigned char digest[16], MD5_CTX *context) { +static void MD5Final (unsigned char digest[16], MD5_CTX *context) { unsigned char bits[8]; unsigned int index, padLen; diff --git a/libwardrobe/src/md5.h b/libwardrobe/src/md5.h index 5499524..26909d2 100644 --- a/libwardrobe/src/md5.h +++ b/libwardrobe/src/md5.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2008 Lars-Dominik Braun +Copyright (c) 2008-2009 Lars-Dominik Braun Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -23,3 +23,4 @@ THE SOFTWARE. #define WARDROBE_MD5_DIGEST_LEN 32 char *WardrobeMd5Calc (char *string); + diff --git a/src/player.c b/src/player.c index f983308..8af4b8d 100644 --- a/src/player.c +++ b/src/player.c @@ -55,7 +55,7 @@ THE SOFTWARE. * @param apply this gain * @return this * yourvalue = newgain value */ -inline unsigned int computeReplayGainScale (float applyGain) { +static inline unsigned int computeReplayGainScale (float applyGain) { return pow (10.0, applyGain / 20.0) * RG_SCALE_FACTOR; } @@ -64,7 +64,7 @@ inline unsigned int computeReplayGainScale (float applyGain) { * @param replaygain scale (calculated by computeReplayGainScale) * @return scaled value */ -inline signed short int applyReplayGain (signed short int value, +static inline signed short int applyReplayGain (signed short int value, unsigned int scale) { int tmpReplayBuf = value * scale; /* avoid clipping */ @@ -83,7 +83,7 @@ inline signed short int applyReplayGain (signed short int value, * @param data size * @return 1 on success, 0 when buffer overflow occured */ -inline int BarPlayerBufferFill (struct audioPlayer *player, char *data, +static inline int BarPlayerBufferFill (struct audioPlayer *player, char *data, size_t dataSize) { /* fill buffer */ if (player->bufferFilled + dataSize > sizeof (player->buffer)) { @@ -102,7 +102,7 @@ inline int BarPlayerBufferFill (struct audioPlayer *player, char *data, * @param player structure * @return nothing at all */ -inline void BarPlayerBufferMove (struct audioPlayer *player) { +static inline void BarPlayerBufferMove (struct audioPlayer *player) { /* move remaining bytes to buffer beginning */ memmove (player->buffer, player->buffer + player->bufferRead, (player->bufferFilled - player->bufferRead)); @@ -117,7 +117,7 @@ inline void BarPlayerBufferMove (struct audioPlayer *player) { * @param extra data (player data) * @return received bytes or less on error */ -char BarPlayerAACCb (void *ptr, size_t size, void *stream) { +static char BarPlayerAACCb (void *ptr, size_t size, void *stream) { char *data = ptr; struct audioPlayer *player = stream; @@ -284,7 +284,7 @@ char BarPlayerAACCb (void *ptr, size_t size, void *stream) { * @param mad fixed * @return short int */ -inline signed short int BarPlayerMadToShort (mad_fixed_t fixed) { +static inline signed short int BarPlayerMadToShort (mad_fixed_t fixed) { /* Clipping */ if (fixed >= MAD_F_ONE) { return SHRT_MAX; @@ -296,7 +296,7 @@ inline signed short int BarPlayerMadToShort (mad_fixed_t fixed) { return (signed short int) (fixed >> (MAD_F_FRACBITS - 15)); } -char BarPlayerMp3Cb (void *ptr, size_t size, void *stream) { +static char BarPlayerMp3Cb (void *ptr, size_t size, void *stream) { char *data = ptr; struct audioPlayer *player = stream; size_t i; diff --git a/src/settings.c b/src/settings.c index 077be60..341510f 100644 --- a/src/settings.c +++ b/src/settings.c @@ -97,7 +97,7 @@ void BarSettingsDestroy (BarSettings_t *settings) { * @param shortcut to be copied * @param destination settings structure */ -void BarSettingsAppendKey (BarKeyShortcut_t *shortcut, +static void BarSettingsAppendKey (BarKeyShortcut_t *shortcut, BarSettings_t *settings) { BarKeyShortcut_t *tmp = calloc (1, sizeof (*tmp)); diff --git a/src/ui_act.c b/src/ui_act.c index 60525ff..ea7a235 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -42,7 +42,7 @@ THE SOFTWARE. /* helper to _really_ skip a song (unlock mutex, quit player) * @param player handle */ -inline void BarUiDoSkipSong (struct audioPlayer *player) { +static inline void BarUiDoSkipSong (struct audioPlayer *player) { player->doQuit = 1; pthread_mutex_unlock (&player->pauseMutex); } @@ -52,7 +52,7 @@ inline void BarUiDoSkipSong (struct audioPlayer *player) { * @param transform this station * @return 0 = error, 1 = everything went well */ -int BarTransformIfShared (PianoHandle_t *ph, PianoStation_t *station) { +static int BarTransformIfShared (PianoHandle_t *ph, PianoStation_t *station) { /* shared stations must be transformed */ if (!station->isCreator) { BarUiMsg (MSG_INFO, "Transforming station... "); diff --git a/src/ui_readline.c b/src/ui_readline.c index 3ce1d17..f804eab 100644 --- a/src/ui_readline.c +++ b/src/ui_readline.c @@ -25,7 +25,7 @@ THE SOFTWARE. #include #include -inline void BarReadlineMoveLeft (char *buf, size_t *bufPos, +static inline void BarReadlineMoveLeft (char *buf, size_t *bufPos, size_t *bufLen) { char *tmpBuf = &buf[*bufPos-1]; while (tmpBuf < &buf[*bufLen]) { @@ -36,15 +36,15 @@ inline void BarReadlineMoveLeft (char *buf, size_t *bufPos, --(*bufLen); } -inline char BarReadlineIsAscii (char b) { +static inline char BarReadlineIsAscii (char b) { return !(b & (1 << 7)); } -inline char BarReadlineIsUtf8Start (char b) { +static inline char BarReadlineIsUtf8Start (char b) { return (b & (1 << 7)) && (b & (1 << 6)); } -inline char BarReadlineIsUtf8Content (char b) { +static inline char BarReadlineIsUtf8Content (char b) { return (b & (1 << 7)) && !(b & (1 << 6)); } -- cgit v1.2.3