vorbis_comment vc;
vorbis_info vi;
- char filename[PATH_MAX];
-
FILE *in;
bool opened;
long serial;
int prevW;
int extrapage;
int eosin;
+
+ char filename[0];
};
static void
}
static bool
-vcedit_state_init (vcedit_state *state)
+vcedit_state_init (vcedit_state *state, const char *filename)
{
state->refcount = 1;
+ strcpy (state->filename, filename);
+
return true;
}
vcedit_state_new (const char *filename)
{
vcedit_state *state;
+ size_t len;
- state = malloc (sizeof (vcedit_state));
+ len = strlen (filename);
+ if (len > PATH_MAX)
+ return NULL;
+
+ state = malloc (sizeof (vcedit_state) + len + 1);
if (!state)
return NULL;
memset (state, 0, sizeof (vcedit_state));
- if (!vcedit_state_init (state)) {
+ if (!vcedit_state_init (state, filename)) {
vcedit_state_free (state);
return NULL;
}
- snprintf (state->filename, sizeof (state->filename),
- "%s", filename);
-
return state;
}