cue_tag: fixed indent and code style
This commit is contained in:
parent
c5cdac9609
commit
5821bd1a21
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#include <libcue/libcue.h>
|
#include <libcue/libcue.h>
|
||||||
|
|
||||||
static struct tag*
|
static struct tag *
|
||||||
cue_tag_cd(struct Cdtext* cdtext, struct Rem* rem)
|
cue_tag_cd(struct Cdtext *cdtext, struct Rem *rem)
|
||||||
{
|
{
|
||||||
char* tmp = NULL;
|
struct tag *tag;
|
||||||
struct tag* tag = NULL;
|
char *tmp;
|
||||||
|
|
||||||
//if (cdtext == NULL)
|
//if (cdtext == NULL)
|
||||||
//return NULL;
|
//return NULL;
|
||||||
@ -17,7 +17,7 @@ cue_tag_cd(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
|
|
||||||
tag_begin_add(tag);
|
tag_begin_add(tag);
|
||||||
|
|
||||||
{ /* TAG_ALBUM_ARTIST */
|
/* TAG_ALBUM_ARTIST */
|
||||||
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ALBUM_ARTIST, tmp);
|
tag_add_item(tag, TAG_ALBUM_ARTIST, tmp);
|
||||||
|
|
||||||
@ -29,9 +29,8 @@ cue_tag_cd(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
|
|
||||||
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ALBUM_ARTIST, tmp);
|
tag_add_item(tag, TAG_ALBUM_ARTIST, tmp);
|
||||||
/* TAG_ALBUM_ARTIST */ }
|
|
||||||
|
|
||||||
{ /* TAG_ARTIST */
|
/* TAG_ARTIST */
|
||||||
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ARTIST, tmp);
|
tag_add_item(tag, TAG_ARTIST, tmp);
|
||||||
|
|
||||||
@ -43,7 +42,6 @@ cue_tag_cd(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
|
|
||||||
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ARTIST, tmp);
|
tag_add_item(tag, TAG_ARTIST, tmp);
|
||||||
/* TAG_ARTIST */ }
|
|
||||||
|
|
||||||
/* TAG_PERFORMER */
|
/* TAG_PERFORMER */
|
||||||
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
||||||
@ -94,11 +92,11 @@ cue_tag_cd(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tag*
|
static struct tag *
|
||||||
cue_tag_track(struct Cdtext* cdtext, struct Rem* rem)
|
cue_tag_track(struct Cdtext *cdtext, struct Rem *rem)
|
||||||
{
|
{
|
||||||
char* tmp = NULL;
|
struct tag *tag;
|
||||||
struct tag* tag = NULL;
|
char *tmp;
|
||||||
|
|
||||||
//if (cdtext == NULL)
|
//if (cdtext == NULL)
|
||||||
//return NULL;
|
//return NULL;
|
||||||
@ -107,7 +105,7 @@ cue_tag_track(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
|
|
||||||
tag_begin_add(tag);
|
tag_begin_add(tag);
|
||||||
|
|
||||||
{ /* TAG_ARTIST */
|
/* TAG_ARTIST */
|
||||||
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
if ((tmp = cdtext_get(PTI_PERFORMER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ARTIST, tmp);
|
tag_add_item(tag, TAG_ARTIST, tmp);
|
||||||
|
|
||||||
@ -119,7 +117,6 @@ cue_tag_track(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
|
|
||||||
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
else if ((tmp = cdtext_get(PTI_ARRANGER, cdtext)) != NULL)
|
||||||
tag_add_item(tag, TAG_ARTIST, tmp);
|
tag_add_item(tag, TAG_ARTIST, tmp);
|
||||||
/* TAG_ARTIST */ }
|
|
||||||
|
|
||||||
/* TAG_TITLE */
|
/* TAG_TITLE */
|
||||||
if ((tmp = cdtext_get(PTI_TITLE, cdtext)) != NULL)
|
if ((tmp = cdtext_get(PTI_TITLE, cdtext)) != NULL)
|
||||||
@ -159,14 +156,11 @@ cue_tag_track(struct Cdtext* cdtext, struct Rem* rem)
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tag*
|
struct tag *
|
||||||
cue_tag_file( FILE* fp,
|
cue_tag_file(FILE *fp, unsigned tnum)
|
||||||
const unsigned int tnum)
|
|
||||||
{
|
{
|
||||||
struct tag* cd_tag = NULL;
|
struct Cd *cd;
|
||||||
struct tag* track_tag = NULL;
|
struct tag *cd_tag, *track_tag;
|
||||||
struct tag* merge_tag = NULL;
|
|
||||||
struct Cd* cd = NULL;
|
|
||||||
|
|
||||||
if (tnum > 256)
|
if (tnum > 256)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -178,49 +172,34 @@ cue_tag_file( FILE* fp,
|
|||||||
|
|
||||||
if (cd == NULL)
|
if (cd == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
|
||||||
{
|
|
||||||
/* tag from CDtext info */
|
|
||||||
cd_tag = cue_tag_cd( cd_get_cdtext(cd),
|
|
||||||
cd_get_rem(cd));
|
|
||||||
|
|
||||||
/* tag from TRACKtext info */
|
/* tag from CDtext info */
|
||||||
track_tag = cue_tag_track( track_get_cdtext( cd_get_track(cd, tnum)),
|
cd_tag = cue_tag_cd(cd_get_cdtext(cd), cd_get_rem(cd));
|
||||||
track_get_rem( cd_get_track(cd, tnum)));
|
|
||||||
|
|
||||||
cd_delete(cd);
|
/* tag from TRACKtext info */
|
||||||
}
|
track_tag = cue_tag_track(track_get_cdtext(cd_get_track(cd, tnum)),
|
||||||
|
track_get_rem(cd_get_track(cd, tnum)));
|
||||||
|
|
||||||
if ((cd_tag != NULL) && (track_tag != NULL))
|
cd_delete(cd);
|
||||||
{
|
|
||||||
merge_tag = tag_merge(cd_tag, track_tag);
|
if (cd_tag != NULL && track_tag != NULL) {
|
||||||
|
struct tag *merge_tag = tag_merge(cd_tag, track_tag);
|
||||||
tag_free(cd_tag);
|
tag_free(cd_tag);
|
||||||
tag_free(track_tag);
|
tag_free(track_tag);
|
||||||
return merge_tag;
|
return merge_tag;
|
||||||
}
|
} else if (cd_tag != NULL)
|
||||||
|
|
||||||
else if (cd_tag != NULL)
|
|
||||||
{
|
|
||||||
return cd_tag;
|
return cd_tag;
|
||||||
}
|
|
||||||
|
|
||||||
else if (track_tag != NULL)
|
else if (track_tag != NULL)
|
||||||
{
|
|
||||||
return track_tag;
|
return track_tag;
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tag*
|
struct tag *
|
||||||
cue_tag_string( char* str,
|
cue_tag_string(char *str, unsigned tnum)
|
||||||
const unsigned int tnum)
|
|
||||||
{
|
{
|
||||||
struct tag* cd_tag = NULL;
|
struct Cd *cd;
|
||||||
struct tag* track_tag = NULL;
|
struct tag *cd_tag, *track_tag;
|
||||||
struct tag* merge_tag = NULL;
|
|
||||||
struct Cd* cd = NULL;
|
|
||||||
|
|
||||||
if (tnum > 256)
|
if (tnum > 256)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -232,37 +211,25 @@ cue_tag_string( char* str,
|
|||||||
|
|
||||||
if (cd == NULL)
|
if (cd == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
|
||||||
{
|
|
||||||
/* tag from CDtext info */
|
|
||||||
cd_tag = cue_tag_cd( cd_get_cdtext(cd),
|
|
||||||
cd_get_rem(cd));
|
|
||||||
|
|
||||||
/* tag from TRACKtext info */
|
/* tag from CDtext info */
|
||||||
track_tag = cue_tag_track( track_get_cdtext( cd_get_track(cd, tnum)),
|
cd_tag = cue_tag_cd(cd_get_cdtext(cd), cd_get_rem(cd));
|
||||||
track_get_rem( cd_get_track(cd, tnum)));
|
|
||||||
|
|
||||||
cd_delete(cd);
|
/* tag from TRACKtext info */
|
||||||
}
|
track_tag = cue_tag_track(track_get_cdtext(cd_get_track(cd, tnum)),
|
||||||
|
track_get_rem(cd_get_track(cd, tnum)));
|
||||||
|
|
||||||
if ((cd_tag != NULL) && (track_tag != NULL))
|
cd_delete(cd);
|
||||||
{
|
|
||||||
merge_tag = tag_merge(cd_tag, track_tag);
|
if (cd_tag != NULL && track_tag != NULL) {
|
||||||
|
struct tag *merge_tag = tag_merge(cd_tag, track_tag);
|
||||||
tag_free(cd_tag);
|
tag_free(cd_tag);
|
||||||
tag_free(track_tag);
|
tag_free(track_tag);
|
||||||
return merge_tag;
|
return merge_tag;
|
||||||
}
|
} else if (cd_tag != NULL)
|
||||||
|
|
||||||
else if (cd_tag != NULL)
|
|
||||||
{
|
|
||||||
return cd_tag;
|
return cd_tag;
|
||||||
}
|
|
||||||
|
|
||||||
else if (track_tag != NULL)
|
else if (track_tag != NULL)
|
||||||
{
|
|
||||||
return track_tag;
|
return track_tag;
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
|
|
||||||
struct tag;
|
struct tag;
|
||||||
|
|
||||||
struct tag*
|
struct tag *
|
||||||
cue_tag_file( FILE*,
|
cue_tag_file(FILE *file, unsigned tnum);
|
||||||
const unsigned int);
|
|
||||||
|
|
||||||
struct tag*
|
struct tag *
|
||||||
cue_tag_string( char*,
|
cue_tag_string(char *str, unsigned tnum);
|
||||||
const unsigned int);
|
|
||||||
|
|
||||||
#endif /* libcue */
|
#endif /* libcue */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user