- Fix drumkit name parsing from drumkit.xml by adding <componentList> support
- Fix compile warning on compar_kit()
This commit is contained in:
parent
3d8e11423b
commit
17383c6a99
@ -87,6 +87,7 @@ struct kit_info {
|
|||||||
struct hp_info {
|
struct hp_info {
|
||||||
char scan_only;
|
char scan_only;
|
||||||
char in_info;
|
char in_info;
|
||||||
|
char in_component_list;
|
||||||
char in_instrument_list;
|
char in_instrument_list;
|
||||||
char in_instrument;
|
char in_instrument;
|
||||||
char in_layer;
|
char in_layer;
|
||||||
@ -105,6 +106,12 @@ startElement(void *userData, const char *name, const char **atts)
|
|||||||
struct hp_info* info = (struct hp_info*)userData;
|
struct hp_info* info = (struct hp_info*)userData;
|
||||||
info->cur_off = 0;
|
info->cur_off = 0;
|
||||||
if (info->in_info) {
|
if (info->in_info) {
|
||||||
|
if (!info->in_component_list) {
|
||||||
|
if (!strcmp(name,"componentList")) {
|
||||||
|
info->in_component_list = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (info->in_instrument) {
|
if (info->in_instrument) {
|
||||||
if (!strcmp(name,"layer") && !info->scan_only) {
|
if (!strcmp(name,"layer") && !info->scan_only) {
|
||||||
info->in_layer = 1;
|
info->in_layer = 1;
|
||||||
@ -122,6 +129,8 @@ startElement(void *userData, const char *name, const char **atts)
|
|||||||
if (!strcmp(name,"instrumentList"))
|
if (!strcmp(name,"instrumentList"))
|
||||||
info->in_instrument_list = 1;
|
info->in_instrument_list = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!strcmp(name,"drumkit_info"))
|
if (!strcmp(name,"drumkit_info"))
|
||||||
info->in_info = 1;
|
info->in_info = 1;
|
||||||
@ -135,7 +144,7 @@ endElement(void *userData, const char *name)
|
|||||||
if (info->cur_off == MAX_CHAR_DATA) info->cur_off--;
|
if (info->cur_off == MAX_CHAR_DATA) info->cur_off--;
|
||||||
info->cur_buf[info->cur_off]='\0';
|
info->cur_buf[info->cur_off]='\0';
|
||||||
|
|
||||||
if (info->in_info && !info->in_instrument_list && !strcmp(name,"name"))
|
if (info->in_info && !info->in_component_list && !info->in_instrument_list && !strcmp(name,"name"))
|
||||||
info->kit_info->name = strdup(info->cur_buf);
|
info->kit_info->name = strdup(info->cur_buf);
|
||||||
if (info->scan_only && info->in_info && !info->in_instrument_list && !strcmp(name,"info"))
|
if (info->scan_only && info->in_info && !info->in_instrument_list && !strcmp(name,"info"))
|
||||||
info->kit_info->desc = strdup(info->cur_buf);
|
info->kit_info->desc = strdup(info->cur_buf);
|
||||||
@ -187,6 +196,7 @@ endElement(void *userData, const char *name)
|
|||||||
info->cur_instrument = NULL;
|
info->cur_instrument = NULL;
|
||||||
info->in_instrument = 0;
|
info->in_instrument = 0;
|
||||||
}
|
}
|
||||||
|
if (info->in_component_list && !strcmp(name,"componentList")) info->in_component_list = 0;
|
||||||
if (info->in_instrument_list && !strcmp(name,"instrumentList")) info->in_instrument_list = 0;
|
if (info->in_instrument_list && !strcmp(name,"instrumentList")) info->in_instrument_list = 0;
|
||||||
if (info->in_info && !strcmp(name,"drumkit_info")) info->in_info = 0;
|
if (info->in_info && !strcmp(name,"drumkit_info")) info->in_info = 0;
|
||||||
}
|
}
|
||||||
@ -232,7 +242,7 @@ static char* expand_path(char* path, char* buf) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int *compar_kit(const void *p1, const void *p2)
|
static int compar_kit(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return (int) strcmp( (* (scanned_kit **) p1)->name, (* (scanned_kit **) p2)->name);
|
return (int) strcmp( (* (scanned_kit **) p1)->name, (* (scanned_kit **) p2)->name);
|
||||||
}
|
}
|
||||||
@ -339,7 +349,7 @@ kits* scan_kits() {
|
|||||||
cp = 0;
|
cp = 0;
|
||||||
struct kit_list * cur_k = scanned_kits;
|
struct kit_list * cur_k = scanned_kits;
|
||||||
while(cur_k) {
|
while(cur_k) {
|
||||||
//printf("found kit: %s\nat:%s\n\n",cur_k->skit->name,cur_k->skit->path);
|
// printf("found kit: %s\nat:%s\n\n",cur_k->skit->name,cur_k->skit->path);
|
||||||
cur_k = cur_k->next;
|
cur_k = cur_k->next;
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user