cue_tag: changed runtime checks to assertions
It's illegal to pass NULL here. This should not be ignored silently.
This commit is contained in:
parent
5821bd1a21
commit
41a48b14e3
@ -3,6 +3,7 @@
|
|||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
#include <libcue/libcue.h>
|
#include <libcue/libcue.h>
|
||||||
|
#include <assert.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)
|
||||||
@ -10,8 +11,7 @@ cue_tag_cd(struct Cdtext *cdtext, struct Rem *rem)
|
|||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
//if (cdtext == NULL)
|
assert(cdtext != NULL);
|
||||||
//return NULL;
|
|
||||||
|
|
||||||
tag = tag_new();
|
tag = tag_new();
|
||||||
|
|
||||||
@ -98,8 +98,7 @@ cue_tag_track(struct Cdtext *cdtext, struct Rem *rem)
|
|||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
//if (cdtext == NULL)
|
assert(cdtext != NULL);
|
||||||
//return NULL;
|
|
||||||
|
|
||||||
tag = tag_new();
|
tag = tag_new();
|
||||||
|
|
||||||
@ -162,14 +161,12 @@ cue_tag_file(FILE *fp, unsigned tnum)
|
|||||||
struct Cd *cd;
|
struct Cd *cd;
|
||||||
struct tag *cd_tag, *track_tag;
|
struct tag *cd_tag, *track_tag;
|
||||||
|
|
||||||
|
assert(fp != NULL);
|
||||||
|
|
||||||
if (tnum > 256)
|
if (tnum > 256)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fp == NULL)
|
cd = cue_parse_file(fp);
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
cd = cue_parse_file(fp);
|
|
||||||
|
|
||||||
if (cd == NULL)
|
if (cd == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -201,14 +198,12 @@ cue_tag_string(char *str, unsigned tnum)
|
|||||||
struct Cd *cd;
|
struct Cd *cd;
|
||||||
struct tag *cd_tag, *track_tag;
|
struct tag *cd_tag, *track_tag;
|
||||||
|
|
||||||
|
assert(str != NULL);
|
||||||
|
|
||||||
if (tnum > 256)
|
if (tnum > 256)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (str == NULL)
|
cd = cue_parse_string(str);
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
cd = cue_parse_string(str);
|
|
||||||
|
|
||||||
if (cd == NULL)
|
if (cd == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user