mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-02 10:33:23 -05:00
32727bd296
encoded/converted. Characters above x7F were replaced by '?' character although the rfc defines a ISO−8859−1 encoding for descriptive field-content. According to rfc2616 the field-content is defined as follows: <the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, separators, and quoted-string> The TEXT rule is only used for descriptive field contents and values that are not intended to be interpreted by the message parser. Words of *TEXT MAY contain characters from character sets other than ISO- 8859-1 only when encoded according to the rules of RFC 2047. In the previous implementation the icy metadata was converted based on fromcode "ascii". Following incoming icy header field-values should be encoded as "ISO−8859−1" before adding them to the metadata structure. - misc.c unicode_fixup_string enhanced by an additional parameter to define the fromcode - misc.h unicode_fixup_string prototype updated - filescanner.c function fixup_tags updated to stay compatible to the previous implementation using fromcode "ascii" - db.c function unicode_fixup_mfi updated to stay compatible to the previous implementation using fromcode "ascii" - http.c function metadata_header_get enhanced to encode the header field-content as "ISO−8859−1" to comply with rfc2616
96 lines
1.6 KiB
C
96 lines
1.6 KiB
C
|
|
#ifndef __MISC_H__
|
|
#define __MISC_H__
|
|
|
|
#include <stdint.h>
|
|
#include <time.h>
|
|
|
|
struct onekeyval {
|
|
char *name;
|
|
char *value;
|
|
|
|
struct onekeyval *next;
|
|
struct onekeyval *sort;
|
|
};
|
|
|
|
struct keyval {
|
|
struct onekeyval *head;
|
|
struct onekeyval *tail;
|
|
};
|
|
|
|
|
|
int
|
|
safe_atoi32(const char *str, int32_t *val);
|
|
|
|
int
|
|
safe_atou32(const char *str, uint32_t *val);
|
|
|
|
int
|
|
safe_hextou32(const char *str, uint32_t *val);
|
|
|
|
int
|
|
safe_atoi64(const char *str, int64_t *val);
|
|
|
|
int
|
|
safe_atou64(const char *str, uint64_t *val);
|
|
|
|
int
|
|
safe_hextou64(const char *str, uint64_t *val);
|
|
|
|
|
|
/* Key/value functions */
|
|
struct keyval *
|
|
keyval_alloc(void);
|
|
|
|
int
|
|
keyval_add(struct keyval *kv, const char *name, const char *value);
|
|
|
|
int
|
|
keyval_add_size(struct keyval *kv, const char *name, const char *value, size_t size);
|
|
|
|
void
|
|
keyval_remove(struct keyval *kv, const char *name);
|
|
|
|
const char *
|
|
keyval_get(struct keyval *kv, const char *name);
|
|
|
|
void
|
|
keyval_clear(struct keyval *kv);
|
|
|
|
void
|
|
keyval_sort(struct keyval *kv);
|
|
|
|
|
|
char *
|
|
m_realpath(const char *pathname);
|
|
|
|
char *
|
|
unicode_fixup_string(char *str, const char *fromcode);
|
|
|
|
char *
|
|
trimwhitespace(const char *str);
|
|
|
|
uint32_t
|
|
djb_hash(void *data, size_t len);
|
|
|
|
char *
|
|
b64_decode(const char *b64);
|
|
|
|
char *
|
|
b64_encode(uint8_t *in, size_t len);
|
|
|
|
uint64_t
|
|
murmur_hash64(const void *key, int len, uint32_t seed);
|
|
|
|
/* Timer function for platforms without hi-res timers */
|
|
int
|
|
clock_gettime_with_res(clockid_t clock_id, struct timespec *tp, struct timespec *res);
|
|
|
|
struct timespec
|
|
timespec_add(struct timespec time1, struct timespec time2);
|
|
|
|
int
|
|
timespec_cmp(struct timespec time1, struct timespec time2);
|
|
|
|
#endif /* !__MISC_H__ */
|