changed indentation style
This commit is contained in:
parent
f791ceb308
commit
45d8cb8136
|
@ -12,3 +12,5 @@ doc
|
|||
# Editor related
|
||||
*.kate-swp
|
||||
.vscode
|
||||
*.c~
|
||||
*.h~
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
- Static global variables: lower case letters
|
||||
- Function names: TypeName_verb or verb_noun
|
||||
- Type names: camel case with the first letter capitalised, e.g. CamelCase
|
||||
- Indentation style: ``indent -linux $SOURCE_FILES``
|
||||
- Indentation style: ``indent -kr -nut *.c *.h``
|
||||
|
|
39
src/cache.c
39
src/cache.c
|
@ -119,8 +119,7 @@ void CacheSystem_init(const char *path, int url_supplied)
|
|||
*/
|
||||
sonic_path = path_append(META_DIR, "rest/");
|
||||
if (mkdir
|
||||
(sonic_path,
|
||||
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
(sonic_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
&& (errno != EEXIST)) {
|
||||
lprintf(fatal, "mkdir(): %s\n", strerror(errno));
|
||||
}
|
||||
|
@ -131,8 +130,7 @@ void CacheSystem_init(const char *path, int url_supplied)
|
|||
*/
|
||||
sonic_path = path_append(DATA_DIR, "rest/");
|
||||
if (mkdir
|
||||
(sonic_path,
|
||||
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
(sonic_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
&& (errno != EEXIST)) {
|
||||
lprintf(fatal, "mkdir(): %s\n", strerror(errno));
|
||||
}
|
||||
|
@ -256,8 +254,7 @@ static int Meta_write(Cache * cf)
|
|||
* These things really should not be zero!!!
|
||||
*/
|
||||
if (!cf->content_length || !cf->blksz || !cf->segbc) {
|
||||
lprintf(error,
|
||||
"Warning: content_length: %ld, blksz: %d, segbc: \
|
||||
lprintf(error, "Warning: content_length: %ld, blksz: %d, segbc: \
|
||||
%ld\n", cf->content_length, cf->blksz, cf->segbc);
|
||||
}
|
||||
|
||||
|
@ -370,14 +367,12 @@ static long Data_read(Cache * cf, uint8_t * buf, off_t len, off_t offset)
|
|||
byte_read = fread(buf, sizeof(uint8_t), len, cf->dfp);
|
||||
if (byte_read != len) {
|
||||
lprintf(debug,
|
||||
"fread(): requested %ld, returned %ld!\n",
|
||||
len, byte_read);
|
||||
"fread(): requested %ld, returned %ld!\n", len, byte_read);
|
||||
if (feof(cf->dfp)) {
|
||||
/*
|
||||
* reached EOF
|
||||
*/
|
||||
lprintf(error,
|
||||
"fread(): reached the end of the file!\n");
|
||||
lprintf(error, "fread(): reached the end of the file!\n");
|
||||
}
|
||||
if (ferror(cf->dfp)) {
|
||||
/*
|
||||
|
@ -405,7 +400,8 @@ static long Data_read(Cache * cf, uint8_t * buf, off_t len, off_t offset)
|
|||
* - -1 when the data file does not exist
|
||||
* - otherwise, the number of bytes written.
|
||||
*/
|
||||
static long Data_write(Cache * cf, const uint8_t * buf, off_t len, off_t offset)
|
||||
static long Data_write(Cache * cf, const uint8_t * buf, off_t len,
|
||||
off_t offset)
|
||||
{
|
||||
if (len == 0) {
|
||||
/*
|
||||
|
@ -563,14 +559,12 @@ static int Cache_exist(const char *fn)
|
|||
if (no_meta) {
|
||||
lprintf(warning, "Cache file partially missing.\n");
|
||||
if (unlink(datafn)) {
|
||||
lprintf(error, "unlink(): %s\n",
|
||||
strerror(errno));
|
||||
lprintf(error, "unlink(): %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
if (no_data) {
|
||||
if (unlink(metafn)) {
|
||||
lprintf(error, "unlink(): %s\n",
|
||||
strerror(errno));
|
||||
lprintf(error, "unlink(): %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -761,8 +755,7 @@ Cache *Cache_open(const char *fn)
|
|||
if (Cache_exist(fn)) {
|
||||
|
||||
lprintf(cache_lock_debug,
|
||||
"thread %x: unlocking cf_lock;\n",
|
||||
pthread_self());
|
||||
"thread %x: unlocking cf_lock;\n", pthread_self());
|
||||
PTHREAD_MUTEX_UNLOCK(&cf_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -770,8 +763,7 @@ Cache *Cache_open(const char *fn)
|
|||
if (Cache_exist(link->sonic_id)) {
|
||||
|
||||
lprintf(cache_lock_debug,
|
||||
"thread %x: unlocking cf_lock;\n",
|
||||
pthread_self());
|
||||
"thread %x: unlocking cf_lock;\n", pthread_self());
|
||||
PTHREAD_MUTEX_UNLOCK(&cf_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1015,12 +1007,10 @@ Cache_read(Cache * cf, char *const output_buf, const off_t len,
|
|||
* download thread. Send it off and unlock the I/O
|
||||
*/
|
||||
send =
|
||||
Data_read(cf, (uint8_t *) output_buf, len,
|
||||
offset_start);
|
||||
Data_read(cf, (uint8_t *) output_buf, len, offset_start);
|
||||
|
||||
lprintf(cache_lock_debug,
|
||||
"thread %x: unlocking w_lock;\n",
|
||||
pthread_self());
|
||||
"thread %x: unlocking w_lock;\n", pthread_self());
|
||||
PTHREAD_MUTEX_UNLOCK(&cf->w_lock);
|
||||
|
||||
goto bgdl;
|
||||
|
@ -1075,8 +1065,7 @@ error.\n", recv, cf->blksz);
|
|||
*/
|
||||
if (!pthread_mutex_trylock(&cf->bgt_lock)) {
|
||||
lprintf(cache_lock_debug,
|
||||
"thread %x: trylocked bgt_lock;\n",
|
||||
pthread_self());
|
||||
"thread %x: trylocked bgt_lock;\n", pthread_self());
|
||||
cf->next_dl_offset = next_dl_offset;
|
||||
if (pthread_create(&cf->bgt, NULL, Cache_bgdl, cf)) {
|
||||
lprintf(error,
|
||||
|
|
60
src/link.c
60
src/link.c
|
@ -96,7 +96,8 @@ LinkTable *LinkSystem_init(const char *raw_url)
|
|||
void LinkTable_add(LinkTable * linktbl, Link * link)
|
||||
{
|
||||
linktbl->num++;
|
||||
linktbl->links = realloc(linktbl->links, linktbl->num * sizeof(Link *));
|
||||
linktbl->links =
|
||||
realloc(linktbl->links, linktbl->num * sizeof(Link *));
|
||||
if (!linktbl->links) {
|
||||
lprintf(fatal, "realloc() failure!\n");
|
||||
}
|
||||
|
@ -166,10 +167,8 @@ static int linknames_equal(char *linkname, const char *linkname_new)
|
|||
*/
|
||||
if (!strncmp
|
||||
(linkname, linkname_new, strnlen(linkname, MAX_FILENAME_LEN))) {
|
||||
size_t linkname_new_len =
|
||||
strnlen(linkname_new, MAX_FILENAME_LEN);
|
||||
if ((linkname_new_len - strnlen(linkname, MAX_FILENAME_LEN) ==
|
||||
1)
|
||||
size_t linkname_new_len = strnlen(linkname_new, MAX_FILENAME_LEN);
|
||||
if ((linkname_new_len - strnlen(linkname, MAX_FILENAME_LEN) == 1)
|
||||
&& (linkname_new[linkname_new_len - 1] == '/')) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -188,7 +187,8 @@ static void HTML_to_LinkTable(GumboNode * node, LinkTable * linktbl)
|
|||
}
|
||||
GumboAttribute *href;
|
||||
if (node->v.element.tag == GUMBO_TAG_A &&
|
||||
(href = gumbo_get_attribute(&node->v.element.attributes, "href"))) {
|
||||
(href =
|
||||
gumbo_get_attribute(&node->v.element.attributes, "href"))) {
|
||||
/*
|
||||
* if it is valid, copy the link onto the heap
|
||||
*/
|
||||
|
@ -370,8 +370,7 @@ static void LinkTable_fill(LinkTable * linktbl)
|
|||
CURL *c = curl_easy_init();
|
||||
unescaped_linkname = curl_easy_unescape(c, this_link->linkname,
|
||||
0, NULL);
|
||||
strncpy(this_link->linkname, unescaped_linkname,
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(this_link->linkname, unescaped_linkname, MAX_FILENAME_LEN);
|
||||
curl_free(unescaped_linkname);
|
||||
curl_easy_cleanup(c);
|
||||
}
|
||||
|
@ -455,8 +454,7 @@ DataStruct Link_to_DataStruct(Link * head_link)
|
|||
sleep(CONFIG.http_wait_sec);
|
||||
} else if (http_resp != HTTP_OK) {
|
||||
lprintf(warning,
|
||||
"cannot retrieve URL: %s, HTTP %ld\n",
|
||||
url, http_resp);
|
||||
"cannot retrieve URL: %s, HTTP %ld\n", url, http_resp);
|
||||
buf.size = 0;
|
||||
curl_easy_cleanup(curl);
|
||||
return buf;
|
||||
|
@ -507,7 +505,8 @@ LinkTable *LinkTable_new(const char *url)
|
|||
int skip_fill = 0;
|
||||
char *unescaped_path;
|
||||
CURL *c = curl_easy_init();
|
||||
unescaped_path = curl_easy_unescape(c, url + ROOT_LINK_OFFSET, 0, NULL);
|
||||
unescaped_path =
|
||||
curl_easy_unescape(c, url + ROOT_LINK_OFFSET, 0, NULL);
|
||||
if (CACHE_SYSTEM_INIT) {
|
||||
CacheDir_create(unescaped_path);
|
||||
LinkTable *disk_linktbl;
|
||||
|
@ -590,11 +589,9 @@ int LinkTable_disk_save(LinkTable * linktbl, const char *dirn)
|
|||
for (int i = 0; i < linktbl->num; i++) {
|
||||
fwrite(linktbl->links[i]->linkname, sizeof(char),
|
||||
MAX_FILENAME_LEN, fp);
|
||||
fwrite(linktbl->links[i]->f_url, sizeof(char), MAX_PATH_LEN,
|
||||
fp);
|
||||
fwrite(linktbl->links[i]->f_url, sizeof(char), MAX_PATH_LEN, fp);
|
||||
fwrite(&linktbl->links[i]->type, sizeof(LinkType), 1, fp);
|
||||
fwrite(&linktbl->links[i]->content_length, sizeof(size_t), 1,
|
||||
fp);
|
||||
fwrite(&linktbl->links[i]->content_length, sizeof(size_t), 1, fp);
|
||||
fwrite(&linktbl->links[i]->time, sizeof(long), 1, fp);
|
||||
}
|
||||
|
||||
|
@ -641,8 +638,7 @@ LinkTable *LinkTable_disk_open(const char *dirn)
|
|||
MAX_FILENAME_LEN, fp);
|
||||
fread(linktbl->links[i]->f_url, sizeof(char), MAX_PATH_LEN, fp);
|
||||
fread(&linktbl->links[i]->type, sizeof(LinkType), 1, fp);
|
||||
fread(&linktbl->links[i]->content_length, sizeof(size_t), 1,
|
||||
fp);
|
||||
fread(&linktbl->links[i]->content_length, sizeof(size_t), 1, fp);
|
||||
fread(&linktbl->links[i]->time, sizeof(long), 1, fp);
|
||||
if (feof(fp)) {
|
||||
/*
|
||||
|
@ -676,8 +672,7 @@ LinkTable *path_to_Link_LinkTable_new(const char *path)
|
|||
next_table = LinkTable_new(link->f_url);
|
||||
} else if (CONFIG.mode == SONIC) {
|
||||
if (!CONFIG.sonic_id3) {
|
||||
next_table =
|
||||
sonic_LinkTable_new_index(link->sonic_id);
|
||||
next_table = sonic_LinkTable_new_index(link->sonic_id);
|
||||
} else {
|
||||
next_table =
|
||||
sonic_LinkTable_new_id3(link->sonic_depth,
|
||||
|
@ -715,8 +710,7 @@ static Link *path_to_Link_recursive(char *path, LinkTable * linktbl)
|
|||
*/
|
||||
for (int i = 1; i < linktbl->num; i++) {
|
||||
if (!strncmp
|
||||
(path, linktbl->links[i]->linkname,
|
||||
MAX_FILENAME_LEN)) {
|
||||
(path, linktbl->links[i]->linkname, MAX_FILENAME_LEN)) {
|
||||
/*
|
||||
* We found our link
|
||||
*/
|
||||
|
@ -740,40 +734,33 @@ static Link *path_to_Link_recursive(char *path, LinkTable * linktbl)
|
|||
char *next_path = slash + 1;
|
||||
for (int i = 1; i < linktbl->num; i++) {
|
||||
if (!strncmp
|
||||
(path, linktbl->links[i]->linkname,
|
||||
MAX_FILENAME_LEN)) {
|
||||
(path, linktbl->links[i]->linkname, MAX_FILENAME_LEN)) {
|
||||
/*
|
||||
* The next sub-directory exists
|
||||
*/
|
||||
LinkTable *next_table =
|
||||
linktbl->links[i]->next_table;
|
||||
LinkTable *next_table = linktbl->links[i]->next_table;
|
||||
if (!next_table) {
|
||||
if (CONFIG.mode == NORMAL) {
|
||||
next_table =
|
||||
LinkTable_new(linktbl->links
|
||||
[i]->f_url);
|
||||
LinkTable_new(linktbl->links[i]->f_url);
|
||||
} else if (CONFIG.mode == SONIC) {
|
||||
if (!CONFIG.sonic_id3) {
|
||||
next_table =
|
||||
sonic_LinkTable_new_index
|
||||
(linktbl->links
|
||||
[i]->sonic_id);
|
||||
(linktbl->links[i]->sonic_id);
|
||||
} else {
|
||||
next_table =
|
||||
sonic_LinkTable_new_id3
|
||||
(linktbl->links
|
||||
[i]->sonic_depth,
|
||||
linktbl->links
|
||||
[i]->sonic_id);
|
||||
linktbl->links[i]->sonic_id);
|
||||
}
|
||||
} else {
|
||||
lprintf(fatal,
|
||||
"Invalid CONFIG.mode\n");
|
||||
lprintf(fatal, "Invalid CONFIG.mode\n");
|
||||
}
|
||||
}
|
||||
linktbl->links[i]->next_table = next_table;
|
||||
return path_to_Link_recursive(next_path,
|
||||
next_table);
|
||||
return path_to_Link_recursive(next_path, next_table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -800,7 +787,8 @@ Link *path_to_Link(const char *path)
|
|||
}
|
||||
|
||||
long
|
||||
path_download(const char *path, char *output_buf, size_t size, off_t offset)
|
||||
path_download(const char *path, char *output_buf, size_t size,
|
||||
off_t offset)
|
||||
{
|
||||
if (!path) {
|
||||
lprintf(fatal, "\npath_download(): NULL path supplied\n");
|
||||
|
|
23
src/main.c
23
src/main.c
|
@ -90,7 +90,8 @@ int main(int argc, char **argv)
|
|||
* The second last remaining argument is the URL
|
||||
*/
|
||||
char *base_url = argv[argc - 2];
|
||||
if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) {
|
||||
if (strncmp(base_url, "http://", 7)
|
||||
&& strncmp(base_url, "https://", 8)) {
|
||||
fprintf(stderr, "Error: Please supply a valid URL.\n");
|
||||
print_help(argv[0], 0);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -123,8 +124,7 @@ void parse_config_file(char ***argv, int *argc)
|
|||
if (!xdg_config_home) {
|
||||
char *home = getenv("HOME");
|
||||
char *xdg_config_home_default = "/.config";
|
||||
xdg_config_home =
|
||||
path_append(home, xdg_config_home_default);
|
||||
xdg_config_home = path_append(home, xdg_config_home_default);
|
||||
}
|
||||
full_path = path_append(xdg_config_home, "/httpdirfs/config");
|
||||
} else {
|
||||
|
@ -145,28 +145,21 @@ void parse_config_file(char ***argv, int *argc)
|
|||
char *space;
|
||||
space = strchr(buf, ' ');
|
||||
if (!space) {
|
||||
*argv =
|
||||
realloc(*argv,
|
||||
*argc * sizeof(char **));
|
||||
(*argv)[*argc - 1] =
|
||||
strndup(buf, buf_len);
|
||||
*argv = realloc(*argv, *argc * sizeof(char **));
|
||||
(*argv)[*argc - 1] = strndup(buf, buf_len);
|
||||
} else {
|
||||
(*argc)++;
|
||||
*argv =
|
||||
realloc(*argv,
|
||||
*argc * sizeof(char **));
|
||||
*argv = realloc(*argv, *argc * sizeof(char **));
|
||||
/*
|
||||
* Only copy up to the space character
|
||||
*/
|
||||
(*argv)[*argc - 2] =
|
||||
strndup(buf, space - buf);
|
||||
(*argv)[*argc - 2] = strndup(buf, space - buf);
|
||||
/*
|
||||
* Starts copying after the space
|
||||
*/
|
||||
(*argv)[*argc - 1] = strndup(space + 1,
|
||||
buf_len -
|
||||
(space +
|
||||
1 - buf));
|
||||
(space + 1 - buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,8 +229,7 @@ int curl_multi_perform_once(void)
|
|||
if (maxfd == -1) {
|
||||
usleep(100 * 1000);
|
||||
} else {
|
||||
if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout) <
|
||||
0) {
|
||||
if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout) < 0) {
|
||||
lprintf(error, "select(): %s.\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +353,8 @@ void transfer_nonblocking(CURL * curl)
|
|||
}
|
||||
|
||||
size_t
|
||||
write_memory_callback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
write_memory_callback(void *contents, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
DataStruct *mem = (DataStruct *) userp;
|
||||
|
|
|
@ -35,7 +35,8 @@ void transfer_nonblocking(CURL * curl);
|
|||
|
||||
/** \brief callback function for file transfer */
|
||||
size_t
|
||||
write_memory_callback(void *contents, size_t size, size_t nmemb, void *userp);
|
||||
write_memory_callback(void *contents, size_t size, size_t nmemb,
|
||||
void *userp);
|
||||
|
||||
/**
|
||||
* \brief check if a HTTP response code corresponds to a temporary failure
|
||||
|
|
36
src/sonic.c
36
src/sonic.c
|
@ -63,8 +63,7 @@ static char *sonic_gen_auth_str(void)
|
|||
{
|
||||
if (!CONFIG.sonic_insecure) {
|
||||
char *salt = generate_salt();
|
||||
size_t pwd_len =
|
||||
strnlen(SONIC_CONFIG.password, MAX_FILENAME_LEN);
|
||||
size_t pwd_len = strnlen(SONIC_CONFIG.password, MAX_FILENAME_LEN);
|
||||
size_t pwd_salt_len = pwd_len + strnlen(salt, MAX_FILENAME_LEN);
|
||||
char *pwd_salt = CALLOC(pwd_salt_len + 1, sizeof(char));
|
||||
strncat(pwd_salt, SONIC_CONFIG.password, MAX_FILENAME_LEN);
|
||||
|
@ -206,7 +205,8 @@ XML_parser_general(void *data, const char *elem, const char **attr)
|
|||
* The new table should be a level 4 song table
|
||||
*/
|
||||
link->sonic_depth = 4;
|
||||
} else if (!strcmp(elem, "song") && linktbl->links[0]->sonic_depth == 4) {
|
||||
} else if (!strcmp(elem, "song")
|
||||
&& linktbl->links[0]->sonic_depth == 4) {
|
||||
link = CALLOC(1, sizeof(Link));
|
||||
link->type = LINK_FILE;
|
||||
} else {
|
||||
|
@ -224,8 +224,7 @@ XML_parser_general(void *data, const char *elem, const char **attr)
|
|||
char *suffix = "";
|
||||
for (int i = 0; attr[i]; i += 2) {
|
||||
if (!strcmp("id", attr[i])) {
|
||||
link->sonic_id =
|
||||
CALLOC(MAX_FILENAME_LEN + 1, sizeof(char));
|
||||
link->sonic_id = CALLOC(MAX_FILENAME_LEN + 1, sizeof(char));
|
||||
strncpy(link->sonic_id, attr[i + 1], MAX_FILENAME_LEN);
|
||||
id_set = 1;
|
||||
continue;
|
||||
|
@ -238,11 +237,9 @@ XML_parser_general(void *data, const char *elem, const char **attr)
|
|||
*/
|
||||
char *s = strrchr(attr[i + 1], '/');
|
||||
if (s) {
|
||||
strncpy(link->linkname, s + 1,
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->linkname, s + 1, MAX_FILENAME_LEN);
|
||||
} else {
|
||||
strncpy(link->linkname, attr[i + 1],
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->linkname, attr[i + 1], MAX_FILENAME_LEN);
|
||||
}
|
||||
linkname_set = 1;
|
||||
continue;
|
||||
|
@ -256,8 +253,7 @@ XML_parser_general(void *data, const char *elem, const char **attr)
|
|||
if (!linkname_set) {
|
||||
if (!strcmp("title", attr[i])
|
||||
|| !strcmp("name", attr[i])) {
|
||||
strncpy(link->linkname, attr[i + 1],
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->linkname, attr[i + 1], MAX_FILENAME_LEN);
|
||||
linkname_set = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -371,7 +367,8 @@ LinkTable *sonic_LinkTable_new_index(const char *id)
|
|||
} else {
|
||||
url = sonic_gen_url_first_part("getIndexes");
|
||||
}
|
||||
LinkTable *linktbl = sonic_url_to_LinkTable(url, XML_parser_general, 0);
|
||||
LinkTable *linktbl =
|
||||
sonic_url_to_LinkTable(url, XML_parser_general, 0);
|
||||
FREE(url);
|
||||
return linktbl;
|
||||
}
|
||||
|
@ -408,8 +405,7 @@ XML_parser_id3_root(void *data, const char *elem, const char **attr)
|
|||
link->type = LINK_DIR;
|
||||
for (int i = 0; attr[i]; i += 2) {
|
||||
if (!strcmp("name", attr[i])) {
|
||||
strncpy(link->linkname, attr[i + 1],
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->linkname, attr[i + 1], MAX_FILENAME_LEN);
|
||||
linkname_set = 1;
|
||||
/*
|
||||
* Allocate a new LinkTable
|
||||
|
@ -435,8 +431,7 @@ XML_parser_id3_root(void *data, const char *elem, const char **attr)
|
|||
link->sonic_depth = 3;
|
||||
for (int i = 0; attr[i]; i += 2) {
|
||||
if (!strcmp("name", attr[i])) {
|
||||
strncpy(link->linkname, attr[i + 1],
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->linkname, attr[i + 1], MAX_FILENAME_LEN);
|
||||
linkname_set = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -444,8 +439,7 @@ XML_parser_id3_root(void *data, const char *elem, const char **attr)
|
|||
if (!strcmp("id", attr[i])) {
|
||||
link->sonic_id =
|
||||
CALLOC(MAX_FILENAME_LEN + 1, sizeof(char));
|
||||
strncpy(link->sonic_id, attr[i + 1],
|
||||
MAX_FILENAME_LEN);
|
||||
strncpy(link->sonic_id, attr[i + 1], MAX_FILENAME_LEN);
|
||||
id_set = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -485,8 +479,7 @@ LinkTable *sonic_LinkTable_new_id3(int depth, const char *id)
|
|||
*/
|
||||
case 3:
|
||||
url = sonic_getArtist_link(id);
|
||||
linktbl =
|
||||
sonic_url_to_LinkTable(url, XML_parser_general, depth);
|
||||
linktbl = sonic_url_to_LinkTable(url, XML_parser_general, depth);
|
||||
FREE(url);
|
||||
break;
|
||||
/*
|
||||
|
@ -494,8 +487,7 @@ LinkTable *sonic_LinkTable_new_id3(int depth, const char *id)
|
|||
*/
|
||||
case 4:
|
||||
url = sonic_getAlbum_link(id);
|
||||
linktbl =
|
||||
sonic_url_to_LinkTable(url, XML_parser_general, depth);
|
||||
linktbl = sonic_url_to_LinkTable(url, XML_parser_general, depth);
|
||||
FREE(url);
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue