diff --git a/common.c b/common.c index 29cded7f..026ef50c 100644 --- a/common.c +++ b/common.c @@ -144,22 +144,6 @@ void inform(const char *format, ...) { daemon_log(LOG_INFO, "%s", s); } -#ifdef HAVE_LIBMBEDTLS -char *base64_enc(uint8_t *input, int length) { - char *buf = NULL; - size_t dlen = 0; - int rc = mbedtls_base64_encode(NULL, 0, &dlen, input, length); - if (rc && (rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)) - debug(1, "Error %d getting length of base64 encode.", rc); - else { - buf = (char *)malloc(dlen); - rc = mbedtls_base64_encode((unsigned char *)buf, dlen, &dlen, input, length); - if (rc != 0) - debug(1, "Error %d encoding base64.", rc); - } - return buf; -} - // The following two functions are adapted slightly and with thanks from Jonathan Leffler's sample // code at // https://stackoverflow.com/questions/675039/how-can-i-create-directory-tree-in-c-linux @@ -208,6 +192,22 @@ int mkpath(const char *path, mode_t mode) { return (status); } +#ifdef HAVE_LIBMBEDTLS +char *base64_enc(uint8_t *input, int length) { + char *buf = NULL; + size_t dlen = 0; + int rc = mbedtls_base64_encode(NULL, 0, &dlen, input, length); + if (rc && (rc != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)) + debug(1, "Error %d getting length of base64 encode.", rc); + else { + buf = (char *)malloc(dlen); + rc = mbedtls_base64_encode((unsigned char *)buf, dlen, &dlen, input, length); + if (rc != 0) + debug(1, "Error %d encoding base64.", rc); + } + return buf; +} + uint8_t *base64_dec(char *input, int *outlen) { // slight problem here is that Apple cut the padding off their challenges. We must restore it // before passing it in to the decoder, it seems diff --git a/shairport.c b/shairport.c index e4b58f6f..5de5f940 100644 --- a/shairport.c +++ b/shairport.c @@ -390,7 +390,9 @@ int parse_options(int argc, char **argv) { config.airplay_volume = -18.0; // if no volume is ever set, default to initial default value if // nothing else comes in first. config.fixedLatencyOffset = 11025; // this sounds like it works properly. +#ifdef HAVE_METADATA_HUB config.cover_art_cache_dir = "/tmp/shairport-sync/.cache/coverart"; +#endif config_setting_t *setting; const char *str = 0;